summaryrefslogtreecommitdiff
path: root/not-quite-lisp/nql-test.scm
diff options
context:
space:
mode:
Diffstat (limited to 'not-quite-lisp/nql-test.scm')
-rw-r--r--not-quite-lisp/nql-test.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/not-quite-lisp/nql-test.scm b/not-quite-lisp/nql-test.scm
new file mode 100644
index 0000000..101ae36
--- /dev/null
+++ b/not-quite-lisp/nql-test.scm
@@ -0,0 +1,51 @@
+;; -*- compile-command: "guile -L . nql-test.scm"; -*-
+(use-modules (srfi srfi-64)
+ (nql))
+
+(test-begin "harness")
+
+
+(test-equal "( is 1"
+ 1
+ (paren->number #\())
+
+(test-equal ") is -1"
+ -1
+ (paren->number #\)))
+
+
+(test-equal "? is 0"
+ 0
+ (paren->number #\?))
+
+
+(test-equal "count all even"
+ 0
+ (nql "(())" #t))
+
+(test-equal "count all 3"
+ 3
+ (nql "(((" #t))
+
+(test-equal "count all 5-2"
+ 3
+ (nql "(()(()(" #t))
+
+(test-equal "count all -2+1"
+ -1
+ (nql "())" #t))
+
+(test-equal "first-negative never"
+ #f
+ (nql "(" #f))
+
+(test-equal "first-negative immediate"
+ 1
+ (nql ")" #f))
+
+(test-equal "first-negative five"
+ 5
+ (nql "()())" #f))
+
+
+(test-end "harness")