(t *testing.T)
| 304 | } |
| 305 | |
| 306 | func TestTemporalStore_IntervalTreeLimit(t *testing.T) { |
| 307 | store := NewTemporalStore(WithMaxIntervalsPerAtom(3)) |
| 308 | |
| 309 | atom := ast.Atom{ |
| 310 | Predicate: ast.PredicateSym{Symbol: "test", Arity: 1}, |
| 311 | Args: []ast.BaseTerm{ast.String("alice")}, |
| 312 | } |
| 313 | |
| 314 | // Add 3 intervals (should succeed) |
| 315 | for i := int64(0); i < 3; i++ { |
| 316 | _, err := store.Add(atom, makeTestInterval(i*100, i*100+50)) |
| 317 | if err != nil { |
| 318 | t.Fatalf("Add %d failed: %v", i, err) |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // 4th should fail |
| 323 | _, err := store.Add(atom, makeTestInterval(300, 350)) |
| 324 | if err == nil { |
| 325 | t.Error("Expected error when exceeding interval limit") |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | // makeInterval creates an interval from start and end nanoseconds. |
| 330 | func makeTestInterval(startNano, endNano int64) ast.Interval { |
nothing calls this directly
no test coverage detected