aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/string.lisp29
-rw-r--r--tests/tailcall-big.lisp24
-rw-r--r--tests/tailcall.lisp2
-rw-r--r--tests/test.lisp5
4 files changed, 34 insertions, 26 deletions
diff --git a/tests/string.lisp b/tests/string.lisp
new file mode 100644
index 0000000..a55e558
--- /dev/null
+++ b/tests/string.lisp
@@ -0,0 +1,29 @@
+(assert (equal "abc" (string #\a #\b #\c)))
+(assert (equal "ABC" (string 65 66 67)))
+
+(assert (string= "abc" (string #\a #\b #\c)))
+(assert (string= "ABC" (string 65 66 67)))
+
+(defvar s1 "a1s")
+(defvar s2 "a2s")
+
+(assert (string= s1 s1))
+(assert (string>= s1 s1))
+(assert (string<= s1 s1))
+(assert (string> s2 s1))
+(assert (string>= s2 s1))
+(assert (string< s1 s2))
+(assert (string<= s1 s2))
+(assert (string/= s1 s2))
+
+(assert (not (string/= s1 s1)))
+(assert (not (string< s1 s1)))
+(assert (not (string> s1 s1)))
+(assert (not (string<= s2 s1)))
+(assert (not (string< s2 s1)))
+(assert (not (string>= s1 s2)))
+(assert (not (string> s1 s2)))
+
+(assert (string= "abc" (strip-string "\n\tabc \t\n")))
+(assert (equal ("a" "b" "c") (split-string "a,b,c" #\,)))
+
diff --git a/tests/tailcall-big.lisp b/tests/tailcall-big.lisp
deleted file mode 100644
index ebf64c6..0000000
--- a/tests/tailcall-big.lisp
+++ /dev/null
@@ -1,24 +0,0 @@
-(assert (is-even 10000))
-(assert (cnt-down 10000))
-
-;; can pass without stack overflow,
-;; but comment out for too time-consuming
-;; (assert (is-even 1000000))
-;; (assert (cnt-down 1000000))
-
-(let ((my-evenp
- (lambda (x)
- (if (= x 0)
- #t
- (funcall my-oddp (- x 1)))))
- (my-oddp
- (lambda (x)
- (if (= x 0)
- #f
- (funcall my-evenp (- x 1))))))
- (assert (funcall my-evenp 10000))
- (assert (funcall my-oddp 10009))
- (assert (not (funcall my-evenp 10009)))
- (assert (not (funcall my-oddp 10000))))
-
-
diff --git a/tests/tailcall.lisp b/tests/tailcall.lisp
index 1aa5e38..1b39fb0 100644
--- a/tests/tailcall.lisp
+++ b/tests/tailcall.lisp
@@ -6,6 +6,7 @@
(defun is-odd (x)
(is-even (- x 1)))
+(assert (is-even 100))
(assert (is-even 10))
(assert (is-even 0))
(assert (is-odd 1))
@@ -17,3 +18,4 @@
(progn
(cnt-down (- x 1)))))
+(cnt-down 100)
diff --git a/tests/test.lisp b/tests/test.lisp
index 614fcec..a303ed3 100644
--- a/tests/test.lisp
+++ b/tests/test.lisp
@@ -12,12 +12,12 @@
(test-module error)
(test-module logic)
(test-module tailcall)
-(test-module tailcall-big)
(test-module control-flow)
(test-module lambda)
(test-module comment)
(test-module macro)
(test-module let-binding)
+(test-module string)
(princ "\n\nTest with intensive GC:\n\n")
(_alwaysgc #t)
@@ -26,13 +26,14 @@
(test-module symbol)
(test-module eq)
(test-module arithmetic)
-(test-module tailcall)
(test-module error)
(test-module logic)
+(test-module tailcall)
(test-module control-flow)
(test-module lambda)
(test-module comment)
(test-module macro)
(test-module let-binding)
+(test-module string)
(exit)