(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestTemporalStore_Add(t *testing.T) { |
| 31 | store := NewTemporalStore() |
| 32 | |
| 33 | atom := ast.NewAtom("employed", name("/alice")) |
| 34 | interval := ast.TimeInterval( |
| 35 | ast.Date(2020, 1, 1), |
| 36 | ast.Date(2023, 12, 31), |
| 37 | ) |
| 38 | |
| 39 | // First add should succeed |
| 40 | added, err := store.Add(atom, interval) |
| 41 | if err != nil { |
| 42 | t.Errorf("First Add returned error: %v", err) |
| 43 | } |
| 44 | if !added { |
| 45 | t.Error("First Add should return true") |
| 46 | } |
| 47 | |
| 48 | // Duplicate add should fail |
| 49 | added, err = store.Add(atom, interval) |
| 50 | if err != nil { |
| 51 | t.Errorf("Duplicate Add returned error: %v", err) |
| 52 | } |
| 53 | if added { |
| 54 | t.Error("Duplicate Add should return false") |
| 55 | } |
| 56 | |
| 57 | // Adding same atom with different interval should succeed |
| 58 | interval2 := ast.TimeInterval( |
| 59 | ast.Date(2024, 1, 1), |
| 60 | ast.Date(2024, 12, 31), |
| 61 | ) |
| 62 | added, err = store.Add(atom, interval2) |
| 63 | if err != nil { |
| 64 | t.Errorf("Add with different interval returned error: %v", err) |
| 65 | } |
| 66 | if !added { |
| 67 | t.Error("Add with different interval should return true") |
| 68 | } |
| 69 | |
| 70 | if store.EstimateFactCount() != 2 { |
| 71 | t.Errorf("EstimateFactCount = %d, want 2", store.EstimateFactCount()) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func TestTemporalStore_AddEternal(t *testing.T) { |
| 76 | store := NewTemporalStore() |
nothing calls this directly
no test coverage detected