(t *testing.T)
| 80 | } |
| 81 | |
| 82 | func TestIntegration_TemporalDeclarations(t *testing.T) { |
| 83 | tests := []struct { |
| 84 | name string |
| 85 | program string |
| 86 | predName string |
| 87 | wantTemporal bool |
| 88 | }{ |
| 89 | { |
| 90 | name: "temporal predicate declaration", |
| 91 | program: "Decl employee(X) temporal bound [/name].", |
| 92 | predName: "employee", |
| 93 | wantTemporal: true, |
| 94 | }, |
| 95 | { |
| 96 | name: "non-temporal predicate declaration", |
| 97 | program: "Decl config(X) bound [/string].", |
| 98 | predName: "config", |
| 99 | wantTemporal: false, |
| 100 | }, |
| 101 | { |
| 102 | name: "temporal with documentation", |
| 103 | program: `Decl status(X, Y) temporal |
| 104 | descr [doc("Employee status over time")] |
| 105 | bound [/name, /string].`, |
| 106 | predName: "status", |
| 107 | wantTemporal: true, |
| 108 | }, |
| 109 | } |
| 110 | |
| 111 | for _, test := range tests { |
| 112 | t.Run(test.name, func(t *testing.T) { |
| 113 | unit, err := parse.Unit(strings.NewReader(test.program)) |
| 114 | if err != nil { |
| 115 | t.Fatalf("Failed to parse program: %v", err) |
| 116 | } |
| 117 | |
| 118 | // Find the declaration (skip Package decl) |
| 119 | var decl ast.Decl |
| 120 | for _, d := range unit.Decls { |
| 121 | if d.DeclaredAtom.Predicate.Symbol == test.predName { |
| 122 | decl = d |
| 123 | break |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if decl.DeclaredAtom.Predicate.Symbol != test.predName { |
| 128 | t.Fatalf("Declaration not found for predicate %s", test.predName) |
| 129 | } |
| 130 | |
| 131 | if decl.IsTemporal() != test.wantTemporal { |
| 132 | t.Errorf("Decl.IsTemporal() = %v, want %v", decl.IsTemporal(), test.wantTemporal) |
| 133 | } |
| 134 | }) |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | func TestIntegration_TemporalOperators(t *testing.T) { |
| 139 | tests := []struct { |
nothing calls this directly
no test coverage detected