package validate import "testing" func TestValidateMobAttackTypes(t *testing.T) { cases := []struct { name string types []string wantError bool }{ {"single melee", []string{"crush"}, false}, {"melee plus ranged", []string{"stab", "ranged"}, false}, {"melee plus both", []string{"slash", "ranged", "science"}, false}, {"empty", nil, true}, {"no melee", []string{"ranged"}, true}, {"two melee", []string{"stab", "crush"}, true}, {"invalid entry", []string{"crush", "magic"}, true}, {"duplicate", []string{"crush", "ranged", "ranged"}, true}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { issues := validateMobAttackTypes("test_mob", c.types) if c.wantError && len(issues) == 0 { t.Errorf("validateMobAttackTypes(%v): expected error, got none", c.types) } if !c.wantError && len(issues) != 0 { t.Errorf("validateMobAttackTypes(%v): expected no error, got %v", c.types, issues) } }) } }