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

Function TestRuleMetadata

pkg/advisor/optimizer_test.go:1003–1023  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Rule interface methods ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

1001// ---------------------------------------------------------------------------
1002
1003func TestRuleMetadata(t *testing.T) {
1004 rules := DefaultRules()
1005
1006 expectedFirstIDs := []string{
1007 "OPT-001", "OPT-002", "OPT-003", "OPT-004",
1008 "OPT-005", "OPT-006", "OPT-007", "OPT-008",
1009 "OPT-009", "OPT-010", "OPT-011", "OPT-012",
1010 "OPT-013", "OPT-014", "OPT-015", "OPT-016",
1011 "OPT-017", "OPT-018", "OPT-019", "OPT-020",
1012 }
1013
1014 for i, expID := range expectedFirstIDs {
1015 if i >= len(rules) {
1016 t.Errorf("rule %d: expected ID %q but only %d rules registered", i, expID, len(rules))
1017 continue
1018 }
1019 if rules[i].ID() != expID {
1020 t.Errorf("rule %d: expected ID %q, got %q", i, expID, rules[i].ID())
1021 }
1022 }
1023}
1024
1025// ---------------------------------------------------------------------------
1026// Non-SELECT statements

Callers

nothing calls this directly

Calls 3

DefaultRulesFunction · 0.85
ErrorfMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected