MCPcopy
hub / github.com/google/mangle / TestBoundsAnalyzerWithManyInitialFacts

Function TestBoundsAnalyzerWithManyInitialFacts

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

Source from the content-addressed store, hash-verified

943}
944
945func TestBoundsAnalyzerWithManyInitialFacts(t *testing.T) {
946 test := newBoundsTestCaseWithNameTrie(t, []ast.Clause{
947 clause("a(X) :- b(X)."),
948 }, []ast.Decl{
949 makeSimpleDecl(atom("a(X)"), name("/foo")),
950 makeSimpleDecl(atom("b(X)"), name("/foo")),
951 },
952 symbols.NewNameTrie().Add([]string{"foo"}),
953 )
954 var facts []ast.Atom
955 for i := 0; i < 100000; i++ {
956 facts = append(facts, atom(fmt.Sprintf("b(/foo/bar%d)", i)))
957 }
958 bc, err := newBoundsAnalyzer(&test.programInfo, test.nameTrie, facts, test.rulesMap)
959 if err != nil {
960 t.Fatal(err)
961 }
962 if err := bc.BoundsCheck(); err != nil {
963 t.Errorf("BoundsCheck(%v, %v) returns error when it shouldn't: %v", test.programInfo, test.rulesMap, err)
964 }
965}
966
967func TestBoundsAnalyzerWithNamesNegative(t *testing.T) {
968 test := newBoundsTestCaseWithNameTrie(t, []ast.Clause{

Callers

nothing calls this directly

Calls 9

NewNameTrieFunction · 0.92
makeSimpleDeclFunction · 0.85
newBoundsAnalyzerFunction · 0.85
BoundsCheckMethod · 0.80
clauseFunction · 0.70
atomFunction · 0.70
nameFunction · 0.70
AddMethod · 0.65

Tested by

no test coverage detected