package controller import ( "testing" "blazing/logic/service/player" playermodel "blazing/modules/player/model" ) func TestPetEVDiy_AppliesToBackupPet(t *testing.T) { p := player.NewPlayer(nil) p.Info = &playermodel.PlayerInfo{ EVPool: 20, PetList: []playermodel.PetInfo{ {CatchTime: 1}, }, BackupPetList: []playermodel.PetInfo{ { CatchTime: 2, Level: 100, Ev: [6]uint32{0, 4, 0, 0, 0, 0}, }, }, } data := &PetEV{ CacthTime: 2, EVs: [6]uint32{0, 8, 4, 0, 0, 0}, } _, err := (Controller{}).PetEVDiy(data, p) if err != 0 { t.Fatalf("PetEVDiy returned error: %v", err) } got := p.Info.BackupPetList[0].Ev want := [6]uint32{0, 8, 4, 0, 0, 0} if got != want { t.Fatalf("backup pet EV mismatch, got %v want %v", got, want) } if gotPool, wantPool := p.Info.EVPool, int64(12); gotPool != wantPool { t.Fatalf("EVPool mismatch, got %d want %d", gotPool, wantPool) } }