1. cacol89
  2. YADI

Commits

cacol89  committed 2ad855f

added some tests

  • Participants
  • Parent commits 276c78b
  • Branches develop

Comments (0)

Files changed (2)

File test/expected/integration/payment.out

View file
+
+yadi$ 
+-------------
+| col0      |
+-------------
+| 674418.85 |
+-------------
+
+yadi$ 
+-----------------------------------------------------------
+| col0      | col1       | col2 | col3             | col4 |
+-----------------------------------------------------------
+| 674418.85 | 432176.435 | 0.1  | 25939.1865384615 | 26   |
+-----------------------------------------------------------
+
+yadi$ 
+-----------------------------------------------
+| col0     | col1     | col2 | col3    | col4 |
+-----------------------------------------------
+| 14011.11 | 7456.435 | 20.5 | 1556.79 | 9    |
+-----------------------------------------------
+
+yadi$ YADI execution error: Goal Person/2 contains an aggregate function as a variable, which is only allowed in rule heads
+
+yadi$ 

File test/integration/payment.datalog

View file
+%%%%%%%%%%%%%%%%%
+% Whole-table aggregates 
+%%%%%%%%%%%%%%%%%
+
+Total(sum(p)) :- Payment(_,_,p,_).
+?- Total(sp).
+/
+
+Stats(sum(p),max(p),min(p),avg(p),count(p)) :- Payment(_,_,p,_).
+?- Stats(x,y,z,v,w).
+/
+
+Harry_stats(sum(p),max(p),min(p),avg(p),count(p)) :- Payment(x,_,p,_), Person(x,'Harry').
+?- Harry_stats(x,y,z,v,w).
+/
+
+
+%%%%%%%%%%%%%%%%%
+% Aggregates in goals (not allowed)
+%%%%%%%%%%%%%%%%%
+
+Q(x,y) :- Person(x,avg(y)).
+?- Q(x,y).
+/
+
+
+
+%Total(p,sum(x)) :- Person(pid,p), Payment(a,_,x,_).
+%?- Total(x,y).
+%/
+%
+%Total(p,sum(x)) :- Person(pid,p), Payment(a,_,x,_), sum(x) < 100.
+%?- Total(x,y).
+%/
+%
+%Total(p,x) :- Person(pid,p), Payment(a,_,x,_), sum(x) < 100.
+%?- Total(x,y).
+%/
+