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

Function verifyInterval

examples/examples_test.go:143–161  ·  view source on GitHub ↗
(t *testing.T, facts []factstore.TemporalFact, prefix, startStr, endStr string)

Source from the content-addressed store, hash-verified

141}
142
143func verifyInterval(t *testing.T, facts []factstore.TemporalFact, prefix, startStr, endStr string) {
144 found := false
145 for _, f := range facts {
146 if strings.Contains(f.Atom.String(), prefix) {
147 start := f.Interval.Start.Time().UTC()
148 end := f.Interval.End.Time().UTC()
149 // Basic date check YYYY-MM-DD
150 s := start.Format("2006-01-02")
151 e := end.Format("2006-01-02")
152 if s == startStr && e == endStr {
153 found = true
154 break
155 }
156 }
157 }
158 if !found {
159 t.Errorf("Expected fact %s with interval [%s, %s], not found", prefix, startStr, endStr)
160 }
161}
162
163func verifyPoint(t *testing.T, facts []factstore.TemporalFact, prefix, pointStr string) {
164 // Point interval has Start == End (or close enough for this check)

Callers 2

verifyPointFunction · 0.85

Calls 3

TimeMethod · 0.80
ContainsMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected