MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestDefaultRules

Function TestDefaultRules

pkg/advisor/optimizer_test.go:977–997  ·  view source on GitHub ↗

--------------------------------------------------------------------------- DefaultRules ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

975// ---------------------------------------------------------------------------
976
977func TestDefaultRules(t *testing.T) {
978 rules := DefaultRules()
979 if len(rules) != 20 {
980 t.Errorf("expected 20 default rules, got %d", len(rules))
981 }
982
983 ids := make(map[string]bool)
984 for _, rule := range rules {
985 if ids[rule.ID()] {
986 t.Errorf("duplicate rule ID: %s", rule.ID())
987 }
988 ids[rule.ID()] = true
989
990 if rule.Name() == "" {
991 t.Errorf("rule %s has empty name", rule.ID())
992 }
993 if rule.Description() == "" {
994 t.Errorf("rule %s has empty description", rule.ID())
995 }
996 }
997}
998
999// ---------------------------------------------------------------------------
1000// Rule interface methods

Callers

nothing calls this directly

Calls 5

DefaultRulesFunction · 0.85
ErrorfMethod · 0.65
IDMethod · 0.65
NameMethod · 0.65
DescriptionMethod · 0.65

Tested by

no test coverage detected