Commits

Pierre Carbonnelle committed b7646ee

test for order of clauses for function

Comments (0)

Files changed (2)

pyDatalog/examples/queens.py

 print("First datalog run in %f seconds" % (time.time() - start_time))
 
 start = time.time()
-for i in range(100):  
+for i in range(20):  
     # there is a warm-up period for the JIT --> let's compute it again
     start_time = time.time()
     datalog_count = len(queens7(X0,X1,X2,X3,X4,X5,X6,X7))
     datalog_time = (time.time() - start_time)
     print(datalog_time)
-print("Average : %s" % ((time.time() - start)/100))
+print("Average : %s" % ((time.time() - start)/20))
 
 # pure python solution found on http://rosettacode.org/wiki/N-Queens#Python, for comparison purposes
 from itertools import permutations

pyDatalog/examples/test.py

         assert (ask(plus[plus[1,2]+1, 2+plus[2,3]] == plus[4, plus[2,5]])) == set([()])
         assert (ask(plus[plus[1,2]+1, 2+plus[2,3]] <  plus[5, plus[2,5]])) == set([()])
         assert (ask(plus[plus[1,2]+1, 2+plus[2,3]] <  plus[1, plus[2,5]])) == None
+
+        (discount[Total] == 100) <= (1000 < Total)
+        (discount[Total] == 10) <= (100 < Total)
+        assert (ask(discount[2000]==Y) == set([(100,)])) 
                 
     @pyDatalog.program()
     def function_comparison():