Commits

cacol89  committed 1edc4ad

added new tests, and error tests in a different file

  • Participants
  • Parent commits d2798d0

Comments (0)

Files changed (5)

File test/expected/integration/family.out

 | Jackie  | Maggie |
 --------------------
 
-yadi$ YADI execution error: Predicate Ancestor1/2 is indirectly recursive.
-
 yadi$ 

File test/expected/integration/family2.out

+
+yadi$ YADI execution error: Predicate Ancestor1/2 is indirectly recursive.
+
+yadi$ YADI execution error: Predicate P/1 is indirectly recursive.
+
+yadi$ YADI execution error: Predicate Q/1 is negatively recursive
+
+yadi$ YADI execution error: Predicate Ancestor/2 contains more than one recursive definition
+
+yadi$ 

File test/integration/employees2.datalog

-%This file contains test cases with errors
+%............................................
+%............................................
+%............................................
+% All the test cases in this file contain
+% sintactic/semantic errors: they test if
+% yadi discovers and reports the errors.
+%............................................
+%............................................
+%............................................
 
 %%%%%%%%%%%%%%%%%
 % WRONG ARITY

File test/integration/family.datalog

 ?- Male_ancestor(x,y).
 /
 
+Ancestor(x,y) :- Parent(x,z), Ancestor(z,y).
+Ancestor(x,y) :- Parent(x,y).
 Parent(x,y) :- Father(x,y).
 Parent(x,y) :- Mother(x,y).
-Ancestor(x,y) :- Parent(x,y).
-Ancestor(x,y) :- Parent(x,z), Ancestor(z,y).
 ?- Ancestor(x,y).
 /
 
-%%%%%%%%%%%%%%%%%
-% Indirect recursion (not allowed)
-%%%%%%%%%%%%%%%%%
-
-Ancestor1(x,y) :- Father(x,y).
-Ancestor1(x,y) :- Father(x,z), Ancestor2(z,y).
-Ancestor2(x,y) :- Mother(x,y).
-Ancestor2(x,y) :- Mother(x,z), Ancestor1(z,y).
-Q(x,y) :- Ancestor1(x,y).
-Q(x,y) :- Ancestor2(x,y).
-?- Q(x,y).
-/
-

File test/integration/family2.datalog

+%............................................
+%............................................
+%............................................
+% All the test cases in this file contain
+% sintactic/semantic errors: they test if
+% yadi discovers and reports the errors.
+%............................................
+%............................................
+%............................................
+
+%%%%%%%%%%%%%%%%%
+% Indirect recursion (not allowed)
+%%%%%%%%%%%%%%%%%
+
+Ancestor1(x,y) :- Father(x,y).
+Ancestor1(x,y) :- Father(x,z), Ancestor2(z,y).
+Ancestor2(x,y) :- Mother(x,y).
+Ancestor2(x,y) :- Mother(x,z), Ancestor1(z,y).
+Q(x,y) :- Ancestor1(x,y).
+Q(x,y) :- Ancestor2(x,y).
+?- Q(x,y).
+/
+
+P(x) :- Q(x).
+Q(x) :- R(x), not P(x).
+R(x) :- Mother(x,_).
+?- P(x).
+/
+
+%%%%%%%%%%%%%%%%%%
+%% Negative recursion (not allowed)
+%%%%%%%%%%%%%%%%%%
+
+Q(x) :- Father(x,_).
+Q(x) :- Mother(x,_), not Q(x).
+?- Q(x).
+/
+
+%%%%%%%%%%%%%%%%%%
+% Multiple recursion (not allowed)
+%%%%%%%%%%%%%%%%%%
+
+Ancestor(x,y) :- Father(x,y).
+Ancestor(x,y) :- Mother(x,y).
+Ancestor(x,y) :- Father(x,z), Ancestor(z,y).
+Ancestor(x,y) :- Mother(x,z), Ancestor(z,y).
+?- Ancestor(x,y).
+/