(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestTemporalStore_IntervalLimit(t *testing.T) { |
| 103 | // Use a small custom limit for faster testing |
| 104 | customLimit := 100 |
| 105 | store := NewTemporalStore(WithMaxIntervalsPerAtom(customLimit)) |
| 106 | atom := ast.NewAtom("test", name("/foo")) |
| 107 | |
| 108 | // Add intervals up to the limit |
| 109 | for i := 0; i < customLimit; i++ { |
| 110 | start := time.Date(2020, 1, 1, i, 0, 0, 0, time.UTC) |
| 111 | end := time.Date(2020, 1, 1, i, 59, 59, 0, time.UTC) |
| 112 | added, err := store.Add(atom, ast.TimeInterval(start, end)) |
| 113 | if err != nil { |
| 114 | t.Fatalf("Add %d returned unexpected error: %v", i, err) |
| 115 | } |
| 116 | if !added { |
| 117 | t.Fatalf("Add %d should return true", i) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | // Next add should fail with ErrIntervalLimitExceeded |
| 122 | start := time.Date(2020, 1, 1, customLimit, 0, 0, 0, time.UTC) |
| 123 | end := time.Date(2020, 1, 1, customLimit, 59, 59, 0, time.UTC) |
| 124 | added, err := store.Add(atom, ast.TimeInterval(start, end)) |
| 125 | if !errors.Is(err, ErrIntervalLimitExceeded) { |
| 126 | t.Errorf("Add beyond limit: err = %v, want ErrIntervalLimitExceeded", err) |
| 127 | } |
| 128 | if added { |
| 129 | t.Error("Add beyond limit should return false") |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func TestTemporalStore_NoLimit(t *testing.T) { |
| 134 | // Negative limit means no limit |
nothing calls this directly
no test coverage detected