MCPcopy Index your code
hub / github.com/google/mangle / TestCheckRulePositiveExtraFun

Function TestCheckRulePositiveExtraFun

analysis/validation_test.go:174–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

172}
173
174func TestCheckRulePositiveExtraFun(t *testing.T) {
175 tests := []ast.Clause{
176 clause("foo(Y) :- bar(X) |> let Y = fn:plus(X, X), let _ = fn:ring_the_alarm()."),
177 }
178 for _, clause := range tests {
179 analyzer, _ := New(map[ast.PredicateSym]ast.Decl{
180 ast.PredicateSym{"bar", 1}: makeSyntheticDecl(t, atom("bar(X)")),
181 }, nil, ErrorForBoundsMismatch)
182 analyzer.extraFunctions = map[ast.FunctionSym]ast.BaseTerm{
183 ast.FunctionSym{"fn:ring_the_alarm", 0}: ast.AnyBound,
184 }
185 err := analyzer.CheckRule(clause)
186 if err != nil {
187 t.Errorf("Expected rule %v to be valid, got %v", clause, err)
188 }
189 }
190}
191
192func TestCheckRuleNegative(t *testing.T) {
193 tests := []ast.Clause{

Callers

nothing calls this directly

Calls 5

CheckRuleMethod · 0.80
clauseFunction · 0.70
NewFunction · 0.70
makeSyntheticDeclFunction · 0.70
atomFunction · 0.70

Tested by

no test coverage detected