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

Function TestTemporalGraphIntervals

examples/examples_test.go:31–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestTemporalGraphIntervals(t *testing.T) {
32 program := readExample(t, "temporal_graph_intervals.mg")
33 facts := runEvaluate(t, program)
34
35 expected := []string{
36 "reachable(/a,/b)",
37 "reachable(/b,/c)",
38 "reachable(/c,/d)",
39 "reachable(/a,/c)",
40 "reachable(/b,/d)",
41 }
42
43 for _, want := range expected {
44 if !containsFact(facts, want) {
45 t.Errorf("Missing expected fact: %s", want)
46 }
47 }
48
49 // Verify specific intervals for interesting derived facts
50 // reachable(/a, /c) should be [2024-01-05, 2024-01-10]
51 // Start: max(Jan 1, Jan 5) = Jan 5
52 // End: min(Jan 10, Jan 15) = Jan 10
53 verifyInterval(t, facts, "reachable(/a,/c)", "2024-01-05", "2024-01-10")
54
55 // reachable(/b, /d) should be [2024-01-12, 2024-01-15]
56 // Start: max(Jan 5, Jan 12) = Jan 12
57 // End: min(Jan 15, Jan 20) = Jan 15
58 verifyInterval(t, facts, "reachable(/b,/d)", "2024-01-12", "2024-01-15")
59}
60
61func TestTemporalGraphPoints(t *testing.T) {
62 program := readExample(t, "temporal_graph_points.mg")

Callers

nothing calls this directly

Calls 4

readExampleFunction · 0.85
runEvaluateFunction · 0.85
containsFactFunction · 0.85
verifyIntervalFunction · 0.85

Tested by

no test coverage detected