aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


server/gamedata/player_appearances_test.go (1130B)


      1 package gamedata
      2 
      3 import "testing"
      4 
      5 func TestPlayerAppearanceCatalogContainsTheOriginalCreatorChoices(t *testing.T) {
      6 	expected := []struct {
      7 		breed, sex  uint16
      8 		count       int
      9 		first, last uint32
     10 	}{
     11 		{1, 2, 52, 40681, 40680}, {1, 3, 52, 40629, 40628},
     12 		{2, 2, 30, 40261, 40284}, {2, 3, 31, 40224, 40246},
     13 		{3, 2, 30, 40185, 40206}, {3, 3, 30, 40151, 40169},
     14 		{4, 1, 30, 40111, 40132},
     15 	}
     16 
     17 	groups := make(map[[2]uint16][]uint32)
     18 	meshes := make(map[uint32]bool)
     19 	for _, head := range PlayerAppearances.Heads {
     20 		if meshes[head.Mesh] {
     21 			t.Fatal("duplicate creator head mesh")
     22 		}
     23 		meshes[head.Mesh] = true
     24 		key := [2]uint16{head.Breed, head.Sex}
     25 		groups[key] = append(groups[key], head.Mesh)
     26 	}
     27 
     28 	if len(PlayerAppearances.Heads) != 255 || len(PlayerAppearances.Bodies) != 7 || len(groups) != 7 {
     29 		t.Fatal("creator choices are incomplete")
     30 	}
     31 	for _, group := range expected {
     32 		heads := groups[[2]uint16{group.breed, group.sex}]
     33 		if len(heads) != group.count || heads[0] != group.first || heads[len(heads)-1] != group.last {
     34 			t.Fatalf("unexpected breed %d sex %d head catalog", group.breed, group.sex)
     35 		}
     36 	}
     37 }