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

Function TestTemporalStore_AddEternal

factstore/temporal_test.go:75–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestTemporalStore_AddEternal(t *testing.T) {
76 store := NewTemporalStore()
77
78 atom := ast.NewAtom("admin", name("/bob"))
79
80 added, err := store.AddEternal(atom)
81 if err != nil {
82 t.Errorf("AddEternal returned error: %v", err)
83 }
84 if !added {
85 t.Error("AddEternal should return true")
86 }
87
88 // Query at any time should return the fact
89 testTimes := []time.Time{
90 ast.Date(1900, 1, 1),
91 ast.Date(2024, 6, 15),
92 ast.Date(3000, 12, 31),
93 }
94
95 for _, queryTime := range testTimes {
96 if !store.ContainsAt(atom, queryTime) {
97 t.Errorf("ContainsAt(%v) = false, want true for eternal fact", queryTime)
98 }
99 }
100}
101
102func TestTemporalStore_IntervalLimit(t *testing.T) {
103 // Use a small custom limit for faster testing

Callers

nothing calls this directly

Calls 7

AddEternalMethod · 0.95
ContainsAtMethod · 0.95
NewAtomFunction · 0.92
DateFunction · 0.92
NewTemporalStoreFunction · 0.85
ErrorMethod · 0.80
nameFunction · 0.70

Tested by

no test coverage detected