package main import ( _ "embed" "encoding/json" "strings" "testing" "git.sunturtle.xyz/zephyr/horse" "github.com/google/go-cmp/cmp" ) //go:embed testdata.json var testJSON string func TestModel(t *testing.T) { want := WorkIdleSingleMode{ Chara: SingleModeChara{ SingleModeCharaID: 1823, CardID: 102401, CharaGrade: 1, Speed: 107, Stamina: 118, Power: 103, Wiz: 147, Guts: 133, Vital: 100, MaxSpeed: 1616, MaxStamina: 1300, MaxPower: 1318, MaxWiz: 1332, MaxGuts: 1516, DefaultMaxSpeed: 1200, DefaultMaxStamina: 1200, DefaultMaxPower: 1200, DefaultMaxWiz: 1200, DefaultMaxGuts: 1200, MaxVital: 100, Motivation: 3, Fans: 1, Rarity: 4, RaceProgramID: 0, ReserveRaceProgramID: 0, RaceRunningStyle: 1, IsShortRace: 0, TalentLevel: 5, Skills: []Skill{ {SkillID: 100241, Level: 2}, }, DisableSkillIDs: []horse.SkillID{}, SkillTips: []SkillTip{ {GroupID: 90014, Rarity: 1, Level: 2}, {GroupID: 90020, Rarity: 1, Level: 1}, }, SupportCards: []SingleModeSupportCard{ { Position: 1, SupportCardID: 30010, LimitBreakCount: 4, Exp: 118185, TrainingPartnerState: 0, OwnerViewerID: 0, RentalType: 0, }, { Position: 2, SupportCardID: 30108, LimitBreakCount: 4, Exp: 118185, TrainingPartnerState: 0, OwnerViewerID: 0, RentalType: 0, }, { Position: 3, SupportCardID: 30062, LimitBreakCount: 4, Exp: 118185, TrainingPartnerState: 0, OwnerViewerID: 0, RentalType: 0, }, { Position: 4, SupportCardID: 30107, LimitBreakCount: 4, Exp: 118185, TrainingPartnerState: 0, OwnerViewerID: 0, RentalType: 0, }, { Position: 5, SupportCardID: 30028, LimitBreakCount: 4, Exp: 118185, TrainingPartnerState: 0, OwnerViewerID: 0, RentalType: 0, }, { Position: 6, SupportCardID: 30052, LimitBreakCount: 4, Exp: 118185, TrainingPartnerState: 0, OwnerViewerID: 818784439809, RentalType: 0, }, }, SuccessionTrainedCharaID1: 4637, SuccessionTrainedCharaID2: 4670, ProperDistanceShort: horse.AptitudeLvD, ProperDistanceMile: horse.AptitudeLvC, ProperDistanceMiddle: horse.AptitudeLvA, ProperDistanceLong: horse.AptitudeLvA, ProperRunningStyleNige: horse.AptitudeLvA, ProperRunningStyleSenko: horse.AptitudeLvA, ProperRunningStyleSashi: horse.AptitudeLvB, ProperRunningStyleOikomi: horse.AptitudeLvB, ProperGroundTurf: horse.AptitudeLvA, ProperGroundDirt: horse.AptitudeLvA, Turn: 1, SkillPoint: 0, ShortCutState: 0, State: 0, PlayingState: 1, ScenarioID: 3, RouteID: 14, StartTime: "2026-07-27 15:37:29", Evaluations: []Evaluation{ { TargetID: 1, Evaluation: 15, IsOuting: 0, StoryStep: 0, IsAppear: 1, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 2, Evaluation: 20, IsOuting: 0, StoryStep: 0, IsAppear: 1, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 3, Evaluation: 30, IsOuting: 0, StoryStep: 0, IsAppear: 1, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 4, Evaluation: 30, IsOuting: 0, StoryStep: 0, IsAppear: 1, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 5, Evaluation: 35, IsOuting: 0, StoryStep: 0, IsAppear: 1, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 6, Evaluation: 30, IsOuting: 0, StoryStep: 0, IsAppear: 0, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 101, Evaluation: 0, IsOuting: 0, StoryStep: 0, IsAppear: 0, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 102, Evaluation: 0, IsOuting: 0, StoryStep: 0, IsAppear: 0, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 103, Evaluation: 0, IsOuting: 0, StoryStep: 0, IsAppear: 0, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 104, Evaluation: 0, IsOuting: 0, StoryStep: 0, IsAppear: 0, GroupOutingInfo: []GroupOuting{}, }, { TargetID: 106, Evaluation: 0, IsOuting: 0, StoryStep: 0, IsAppear: 0, GroupOutingInfo: []GroupOuting{}, }, }, TrainingLevels: []TrainingLevel{ {CommandID: 101, Level: 1}, {CommandID: 102, Level: 1}, {CommandID: 103, Level: 1}, {CommandID: 105, Level: 1}, {CommandID: 106, Level: 1}, {CommandID: 601, Level: 5}, {CommandID: 602, Level: 5}, {CommandID: 603, Level: 5}, {CommandID: 604, Level: 5}, {CommandID: 605, Level: 5}, }, NicknameIDs: []int32{}, CharaEffectIDs: []int32{}, RouteRaceIDs: []int32{ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, }, GuestOutings: []GuestOuting{}, SkillUpgrades: []SingleModeSkillUpgrade{}, }, StartTime: 1785166649, EndTime: 1785169649, ProgressLog: IdleSingleModeProgressLog{ CharaEffectLog: []CharaEffectLog{ {CharaEffectID: 7, IsActive: true}, }, SupportCardGains: []IdleSingleModeSupportCardGain{ { SupportCardID: 30010, GainInfo: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 56}, Stamina: IdleSingleModeSignedInt{Value: 33}, Power: IdleSingleModeSignedInt{Value: 33}, Wiz: IdleSingleModeSignedInt{Value: 193}, Guts: IdleSingleModeSignedInt{Value: 33}, SkillPoint: 319, SkillTips: []SkillTip{ {GroupID: 20019, Rarity: 1, Level: 1}, {GroupID: 20001, Rarity: 1, Level: 1}, }, }, }, { SupportCardID: 30108, GainInfo: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 54}, Stamina: IdleSingleModeSignedInt{Value: 35}, Power: IdleSingleModeSignedInt{Value: 35}, Wiz: IdleSingleModeSignedInt{Value: 135}, Guts: IdleSingleModeSignedInt{Value: 35}, SkillPoint: 408, SkillTips: []SkillTip{ {GroupID: 20157, Rarity: 1, Level: 4}, {GroupID: 20203, Rarity: 1, Level: 4}, {GroupID: 20156, Rarity: 1, Level: 4}, }, }, }, { SupportCardID: 30062, GainInfo: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 31}, Stamina: IdleSingleModeSignedInt{Value: 184}, Power: IdleSingleModeSignedInt{Value: 31}, Wiz: IdleSingleModeSignedInt{Value: 31}, Guts: IdleSingleModeSignedInt{Value: 65}, SkillPoint: 234, SkillTips: []SkillTip{ {GroupID: 20127, Rarity: 1, Level: 2}, }, }, }, { SupportCardID: 30107, GainInfo: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 136}, Stamina: IdleSingleModeSignedInt{Value: 35}, Power: IdleSingleModeSignedInt{Value: 88}, Wiz: IdleSingleModeSignedInt{Value: 35}, Guts: IdleSingleModeSignedInt{Value: 35}, SkillPoint: 287, SkillTips: []SkillTip{ {GroupID: 20043, Rarity: 1, Level: 3}, {GroupID: 20127, Rarity: 1, Level: 3}, {GroupID: 20124, Rarity: 1, Level: 3}, }, }, }, { SupportCardID: 30028, GainInfo: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 116}, Stamina: IdleSingleModeSignedInt{Value: 33}, Power: IdleSingleModeSignedInt{Value: 86}, Wiz: IdleSingleModeSignedInt{Value: 33}, Guts: IdleSingleModeSignedInt{Value: 33}, SkillPoint: 284, SkillTips: []SkillTip{ {GroupID: 20043, Rarity: 1, Level: 1}, {GroupID: 20076, Rarity: 1, Level: 3}, {GroupID: 20033, Rarity: 1, Level: 3}, {GroupID: 20118, Rarity: 1, Level: 3}, }, }, }, { SupportCardID: 30052, GainInfo: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 68}, Stamina: IdleSingleModeSignedInt{Value: 28}, Power: IdleSingleModeSignedInt{Value: 28}, Wiz: IdleSingleModeSignedInt{Value: 28}, Guts: IdleSingleModeSignedInt{Value: 68}, SkillPoint: 553, SkillTips: []SkillTip{}, }, }, }, EventGain: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 817}, Stamina: IdleSingleModeSignedInt{Value: 313}, Power: IdleSingleModeSignedInt{Value: 427}, Wiz: IdleSingleModeSignedInt{Value: 498}, Guts: IdleSingleModeSignedInt{Value: 300}, SkillPoint: 1819, SkillTips: []SkillTip{ {GroupID: 20166, Rarity: 2, Level: 3}, {GroupID: 20071, Rarity: 2, Level: 1}, {GroupID: 20027, Rarity: 1, Level: 2}, {GroupID: 20059, Rarity: 1, Level: 1}, {GroupID: 21007, Rarity: 1, Level: 1}, {GroupID: 21007, Rarity: 2, Level: 3}, {GroupID: 20021, Rarity: 1, Level: 1}, {GroupID: 20043, Rarity: 1, Level: 1}, {GroupID: 20043, Rarity: 2, Level: 1}, {GroupID: 20127, Rarity: 2, Level: 1}, {GroupID: 20135, Rarity: 1, Level: 1}, {GroupID: 20118, Rarity: 1, Level: 2}, {GroupID: 20207, Rarity: 1, Level: 1}, {GroupID: 20137, Rarity: 1, Level: 1}, {GroupID: 20209, Rarity: 1, Level: 1}, }, }, SuccessionGain: IdleSingleModeGainInfo{ Speed: IdleSingleModeSignedInt{Value: 67}, Stamina: IdleSingleModeSignedInt{Value: 0}, Power: IdleSingleModeSignedInt{Value: 94}, Wiz: IdleSingleModeSignedInt{Value: 118}, Guts: IdleSingleModeSignedInt{Value: 59}, MaxSpeed: 22, MaxStamina: 2, MaxPower: 28, MaxWiz: 45, MaxGuts: 22, ProperDistanceShort: 0, ProperDistanceMile: 1, ProperDistanceMiddle: 0, ProperDistanceLong: 0, ProperRunningStyleNige: 0, ProperRunningStyleSenko: 0, ProperRunningStyleSashi: 0, ProperRunningStyleOikomi: 0, ProperGroundTurf: 0, ProperGroundDirt: 5, SkillPoint: 0, SkillTips: []SkillTip{ {GroupID: 90014, Rarity: 1, Level: 2}, {GroupID: 90020, Rarity: 1, Level: 2}, {GroupID: 90019, Rarity: 1, Level: 2}, {GroupID: 20166, Rarity: 1, Level: 3}, {GroupID: 20233, Rarity: 1, Level: 2}, {GroupID: 20160, Rarity: 1, Level: 4}, {GroupID: 21005, Rarity: 1, Level: 3}, {GroupID: 20019, Rarity: 1, Level: 3}, {GroupID: 21001, Rarity: 1, Level: 4}, {GroupID: 20035, Rarity: 1, Level: 1}, {GroupID: 20091, Rarity: 1, Level: 4}, {GroupID: 20126, Rarity: 1, Level: 2}, {GroupID: 20159, Rarity: 1, Level: 2}, {GroupID: 20125, Rarity: 1, Level: 1}, {GroupID: 20007, Rarity: 1, Level: 1}, }, }, SuccessionFactorGains: []IdleSingleModeSuccessionFactorGain{ { Year: 1, GainFactorInfo: []Factor{ {FactorID: 103, Level: 0}, {FactorID: 10200101, Level: 0}, {FactorID: 503, Level: 0}, {FactorID: 1202, Level: 0}, {FactorID: 10140102, Level: 0}, {FactorID: 503, Level: 0}, {FactorID: 1202, Level: 0}, {FactorID: 403, Level: 0}, {FactorID: 3202, Level: 0}, {FactorID: 302, Level: 0}, {FactorID: 1203, Level: 0}, {FactorID: 302, Level: 0}, {FactorID: 1203, Level: 0}, }, }, { Year: 2, GainFactorInfo: []Factor{ {FactorID: 103, Level: 0}, {FactorID: 1000802, Level: 0}, {FactorID: 2016603, Level: 0}, {FactorID: 2023302, Level: 0}, {FactorID: 503, Level: 0}, {FactorID: 2102103, Level: 0}, {FactorID: 503, Level: 0}, {FactorID: 2016002, Level: 0}, {FactorID: 2100502, Level: 0}, {FactorID: 403, Level: 0}, {FactorID: 2001902, Level: 0}, {FactorID: 302, Level: 0}, {FactorID: 302, Level: 0}, {FactorID: 1203, Level: 0}, {FactorID: 10190102, Level: 0}, }, }, { Year: 3, GainFactorInfo: []Factor{ {FactorID: 103, Level: 0}, {FactorID: 2003501, Level: 0}, {FactorID: 2009102, Level: 0}, {FactorID: 10200101, Level: 0}, {FactorID: 503, Level: 0}, {FactorID: 1002002, Level: 0}, {FactorID: 2012502, Level: 0}, {FactorID: 503, Level: 0}, {FactorID: 2012602, Level: 0}, {FactorID: 2015902, Level: 0}, {FactorID: 403, Level: 0}, {FactorID: 302, Level: 0}, {FactorID: 302, Level: 0}, }, }, }, RaceHistory: []IdleSingleModeRaceHistory{ { RaceHistory: SingleRaceHistory{ Turn: 12, ProgramID: 1067, Weather: 2, GroundCondition: 2, RunningStyle: 1, ResultRank: 1, FrameOrder: 2, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 400}, }, RaceRewardBonus: []RaceReward{}, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 1398, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 44, ProgramID: 168, Weather: 1, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 11, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 11, ItemID: 83, ItemNum: 2}, {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 30, ItemID: 110, ItemNum: 40}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 23976, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 48, ProgramID: 81, Weather: 1, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 4, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 11, ItemID: 91, ItemNum: 2}, {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 30, ItemID: 110, ItemNum: 40}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 59940, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 54, ProgramID: 12, Weather: 2, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 7, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{}, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 13387, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 56, ProgramID: 4, Weather: 1, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 6, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 11, ItemID: 74, ItemNum: 2}, {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 30, ItemID: 110, ItemNum: 40}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 29970, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 60, ProgramID: 74, Weather: 2, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 8, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 11, ItemID: 80, ItemNum: 2}, {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 7, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 800}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 29970, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 68, ProgramID: 76, Weather: 1, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 14, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 11, ItemID: 84, ItemNum: 2}, {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 7, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 800}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 29970, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 72, ProgramID: 81, Weather: 2, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 6, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 11, ItemID: 91, ItemNum: 2}, {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 800}, {ItemType: 30, ItemID: 110, ItemNum: 40}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 59940, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 74, ProgramID: 2031, Weather: 2, GroundCondition: 2, RunningStyle: 1, ResultRank: 1, FrameOrder: 10, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 1200}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{}, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 13986, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 76, ProgramID: 2130, Weather: 1, GroundCondition: 1, RunningStyle: 1, ResultRank: 1, FrameOrder: 1, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 1200}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 30, ItemID: 110, ItemNum: 80}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 19980, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, { RaceHistory: SingleRaceHistory{ Turn: 78, ProgramID: 2228, Weather: 2, GroundCondition: 2, RunningStyle: 1, ResultRank: 1, FrameOrder: 4, NpcCount: 0, }, RaceRewardInfo: CharaRaceReward{ ResultRank: 1, ResultTime: 0, RaceReward: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 1200}, {ItemType: 11, ItemID: 10, ItemNum: 2}, }, RaceRewardBonus: []RaceReward{ {ItemType: 91, ItemID: 59, ItemNum: 1200}, {ItemType: 30, ItemID: 110, ItemNum: 80}, }, RaceRewardPlusBonus: []RaceReward{}, RaceRewardBonusWin: []RaceReward{}, RaceRewardLimit: []RaceRewardLimit{}, GainedFans: 59940, CampaignIDs: []int32{223}, }, LoseTipsID: 0, }, }, GainSkillIDs: []horse.SkillID{}, TotalSkillPoint: 3904, }, } var got WorkIdleSingleMode d := json.NewDecoder(strings.NewReader(testJSON)) d.DisallowUnknownFields() if err := d.Decode(&got); err != nil { t.Error(err) } if diff := cmp.Diff(want, got); diff != "" { t.Errorf("wrong data (+got/-want):\n%s", diff) } }