(t *testing.T)
| 1021 | } |
| 1022 | |
| 1023 | func TestAnalyzeTemporal(t *testing.T) { |
| 1024 | program := ` |
| 1025 | Decl temp(Name) temporal bound [/name]. |
| 1026 | Decl derived(Name, Time) bound [/name, /any]. |
| 1027 | |
| 1028 | temp(/a)@[2024-01-01]. |
| 1029 | derived(X, T) :- temp(X)@[T]. |
| 1030 | ` |
| 1031 | unit, err := parse.Unit(strings.NewReader(program)) |
| 1032 | if err != nil { |
| 1033 | t.Fatalf("parse error: %v", err) |
| 1034 | } |
| 1035 | info, err := AnalyzeOneUnit(unit, nil) |
| 1036 | if err != nil { |
| 1037 | t.Fatalf("AnalyzeOneUnit failed: %v", err) |
| 1038 | } |
| 1039 | if len(info.InitialFacts) != 1 { |
| 1040 | t.Errorf("Expected 1 initial fact, got %d", len(info.InitialFacts)) |
| 1041 | } |
| 1042 | if len(info.InitialFactTimes) != 1 || info.InitialFactTimes[0] == nil { |
| 1043 | t.Error("Expected temporal info for initial fact, got nil") |
| 1044 | } |
| 1045 | if len(info.Rules) != 1 { |
| 1046 | t.Errorf("Expected 1 rule, got %d", len(info.Rules)) |
| 1047 | } |
| 1048 | } |
nothing calls this directly
no test coverage detected