(t *testing.T)
| 290 | } |
| 291 | |
| 292 | func TestSimpleEval(t *testing.T) { |
| 293 | store := factstore.NewSimpleInMemoryStore() |
| 294 | store.Add(atom("node(/a)")) |
| 295 | store.Add(atom("node(/b)")) |
| 296 | store.Add(atom("label(/b, 100)")) |
| 297 | store.Add(atom("node(/c)")) |
| 298 | store.Add(atom("node(/d)")) |
| 299 | store.Add(atom("edge(/a,/b)")) |
| 300 | store.Add(atom("edge(/b,/c)")) |
| 301 | store.Add(atom("edge(/c,/d)")) |
| 302 | |
| 303 | if err := analyzeAndEvalProgram(t, program, store); err != nil { |
| 304 | t.Errorf("Program evaluation failed %v program %v", err, program) |
| 305 | return |
| 306 | } |
| 307 | |
| 308 | expected := []ast.Atom{ |
| 309 | atom("path(/a,/b)"), |
| 310 | atom("path(/a,/c)"), |
| 311 | atom("path(/a,/d)"), |
| 312 | atom("path(/b,/c)"), |
| 313 | atom("path(/b,/d)"), |
| 314 | atom("path(/c,/d)"), |
| 315 | atom("neighbor_label(/a, /b, 100)"), |
| 316 | atom("has_neighbor(/c)"), |
| 317 | atom("expanded_stuff(1)"), |
| 318 | atom("expanded_stuff(2)"), |
| 319 | atom("expanded_stuff(3)"), |
| 320 | } |
| 321 | |
| 322 | for _, fact := range expected { |
| 323 | if !store.Contains(fact) { |
| 324 | t.Errorf("expected fact %v in store %v", fact, store) |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | func TestSimpleEvalDefer(t *testing.T) { |
| 330 | store := factstore.NewSimpleInMemoryStore() |
nothing calls this directly
no test coverage detected