package main import "testing" // Every name in the common-rares set must classify as "common". func TestClassifyCommon(t *testing.T) { if len(commonRares) != 74 { t.Fatalf("expected 74 common rares, got %d", len(commonRares)) } for name := range commonRares { if got := classify(name); got != "common" { t.Errorf("classify(%q) = %q, want common", name, got) } } } // Names not in the set (including near-misses) must classify as "great". func TestClassifyGreat(t *testing.T) { greats := []string{ "Shimmering Skeleton Key", "Star of Tukal", "Hieroglyph of the Bludgeoner", "Infinite Phial of Pyreal Flux", "Foolproof Hooks", "Staff of All Aphus", "Count Renari's Equctioneer", "Gelidite Long Sword", "Pearl of Blade Baning ", // trailing space — not an exact match "alchemist's crystal", // wrong case — not an exact match "Alchemist's Crystals", // plural — not an exact match "", } for _, name := range greats { if got := classify(name); got != "great" { t.Errorf("classify(%q) = %q, want great", name, got) } } }