Mercurial > core / lisp/lib/q/tests/suite.lisp
changeset 577: |
806c2b214df8 |
child: |
571685ae64f1 |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 04 Aug 2024 20:51:07 -0400 |
permissions: |
-rw-r--r-- |
description: |
refactored q/tests, added rt/fuzz, more sql query work |
1 ;;; tests.lisp --- Q Tests 13 (is (make-instance 'query-engine :parser (make-instance 'query-parser)))) 15 (deftest sql-select () 16 (with-sql (expr "SELECT BAR FROM FOO") 17 (is (typep expr 'sql-select)) 18 (let ((tbl (make-hash-table :test 'equal)) 19 (df (make-instance 'data-frame))) 20 (setf (schema df) (make-schema)) 21 ;; (signals simple-sql-error (make-sql-data-frame expr tbl)) 22 (setf (gethash "FOO" tbl) df) 23 ;; (make-sql-data-frame expr tbl)) 27 (with-sql (expr "1 + 2 * 3") 28 (is (typep expr 'sql-math-expression)) 29 (is (typep (rhs expr) 'sql-math-expression)) 30 (is (typep (lhs expr) 'sql-number)))) 32 ;; https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_1.html 33 (deftest dql (:skip t) 50 (color 1 red a) (color 1 red b) 51 (color 2 blue a) (color 2 blue b) 52 (color 3 green a) (color 3 green b) 53 (color 4 yellow a) (color 4 blue b) 54 (color 5 blue a) (color 5 green b) 56 (:- (conflict ?coloring) 58 (color ?x ?color ?coloring) 59 (color ?y ?color ?coloring)) 62 (:- (conflict ?r1 ?r2 ?coloring) 64 (color ?r1 ?color ?coloring) 65 (color ?r2 ?color ?coloring)) 68 ;; there are several infix operators. 70 ;; let's mark variables with ? prefix. 74 (forall (conflict ?coloring) 75 (writeln (conflict ?coloring))) 76 (forall (conflict ?r1 ?r2 ?coloring) 77 (writeln (conflict ?r1 ?r2 ?coloring))) 78 (forall (conflict ?r1 ?r2 ?coloring) 79 (and (print-sexp (conflict ?r1 ?r2 ?coloring)) 83 (:- (initialization main)))