(t *testing.T)
| 677 | } |
| 678 | |
| 679 | func TestEmptyArrayProgram(t *testing.T) { |
| 680 | store := factstore.NewSimpleInMemoryStore() |
| 681 | program := []ast.Clause{ |
| 682 | clause(`a_list([]).`), |
| 683 | } |
| 684 | if err := analyzeAndEvalProgram(t, program, store); err != nil { |
| 685 | t.Errorf("Program evaluation failed %v program %v", err, program) |
| 686 | return |
| 687 | } |
| 688 | |
| 689 | goal := atom("a_list(A)") |
| 690 | facts := make(map[uint64]ast.Atom) |
| 691 | if err := store.GetFacts(goal, func(storefact ast.Atom) error { |
| 692 | subst, err := unionfind.UnifyTerms(goal.Args, storefact.Args) |
| 693 | if err != nil { |
| 694 | return nil |
| 695 | } |
| 696 | fact := goal.ApplySubst(subst).(ast.Atom) |
| 697 | facts[fact.Hash()] = fact |
| 698 | return nil |
| 699 | }); err != nil { |
| 700 | t.Errorf("GetFacts(%v): %v", goal, err) |
| 701 | } |
| 702 | if got, want := len(facts), 1; got != want { |
| 703 | t.Errorf("GetFacts: %d!=%d got: %v", got, want, facts) |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | func TestTransformMax(t *testing.T) { |
| 708 | for _, tt := range []struct { |
nothing calls this directly
no test coverage detected