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

Function testStore

factstore/simplecolumn_test.go:20–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func testStore(t *testing.T) *SimpleInMemoryStore {
21 t.Helper()
22 m := NewSimpleInMemoryStore()
23 facts := []ast.Atom{
24 atom("baz()"),
25 atom("foo(`\n/bar`)"),
26 atom("foo(/zzz)"),
27 atom("bar(/r,1,/z)"),
28 atom("bar(/t,2,'😤')"),
29 atom("bar(/g,3,/h)"),
30 evalAtom("bar([/abc],4,/def)"),
31 evalAtom("bar([/abc, /def], 5, /def)"),
32 evalAtom("qaz([/abc : 123, /def : 345], 10, b'\\x80\\x81')"),
33 evalAtom("qaz({/abc : 456, /def : 678}, 20, /zzz)"),
34 }
35 for _, f := range facts {
36 m.Add(f)
37 }
38 if m.EstimateFactCount() != len(facts) {
39 t.Fatalf("SimpleInMemoryStore.EstimateFactCount() = %d want %d", m.EstimateFactCount(), len(facts))
40 }
41 return &m
42}
43
44func TestOutput(t *testing.T) {
45 m := testStore(t)

Callers 4

TestOutputFunction · 0.85
TestRoundTripFunction · 0.85
TestStoreFunction · 0.85
TestFilteredFunction · 0.85

Calls 5

AddMethod · 0.95
EstimateFactCountMethod · 0.95
NewSimpleInMemoryStoreFunction · 0.85
atomFunction · 0.70
evalAtomFunction · 0.70

Tested by

no test coverage detected