[uim-commit] r1391 - branches/r5rs/sigscheme/test
kzk at freedesktop.org
kzk at freedesktop.org
Sun Sep 4 06:49:15 EST 2005
Author: kzk
Date: 2005-09-03 13:49:10 -0700 (Sat, 03 Sep 2005)
New Revision: 1391
Modified:
branches/r5rs/sigscheme/test/test-char.scm
branches/r5rs/sigscheme/test/test-list.scm
branches/r5rs/sigscheme/test/test-num.scm
branches/r5rs/sigscheme/test/test-string.scm
Log:
* add testcases
* test/test-string.scm
- add testcase for "list->string". This test fails now.
* test/test-num.scm
- add testcase for "=", ">", "<", ">=", "<=", "abs"
* test/test-list.scm
- add testcase for "list?". checking circular list
* test/test-char.scm
- add testcase for #\\
Modified: branches/r5rs/sigscheme/test/test-char.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-char.scm 2005-09-03 20:21:33 UTC (rev 1390)
+++ branches/r5rs/sigscheme/test/test-char.scm 2005-09-03 20:49:10 UTC (rev 1391)
@@ -8,5 +8,6 @@
(assert "hiragana char" (char? #\¤¢))
(assert "( char" (char? #\())
(assert ") char" (char? #\)))
+(assert "\\ char" (char? #\\))
(total-report)
Modified: branches/r5rs/sigscheme/test/test-list.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-list.scm 2005-09-03 20:21:33 UTC (rev 1390)
+++ branches/r5rs/sigscheme/test/test-list.scm 2005-09-03 20:49:10 UTC (rev 1391)
@@ -28,11 +28,11 @@
; list?
(assert "list? test1" (list? '(a b c)))
(assert "list? test2" (list? '()))
-(assert-equal? "list? test3" #f (list? '(a . b)))
-; TODO : check finite length of the list!
-;(assert-equal? "list? test4" #f (let ((x (list 'a)))
-; (set-cdr! x x)
-; (list? x)))
+(assert-false "list? test3" (list? '(a . b)))
+(assert-false "list? test4" (list? '(a b . c)))
+(assert-false "list? test5" (let ((x (list 'a)))
+ (set-cdr! x x)
+ (list? x)))
; list
(assert-equal? "list test1" '(a 7 c) (list 'a (+ 3 4) 'c))
Modified: branches/r5rs/sigscheme/test/test-num.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-num.scm 2005-09-03 20:21:33 UTC (rev 1390)
+++ branches/r5rs/sigscheme/test/test-num.scm 2005-09-03 20:49:10 UTC (rev 1391)
@@ -1,13 +1,20 @@
-(load "test/unittest.scm")
+(load "./test/unittest.scm")
-;; TODO: add minus number comparisons
-(assert-true "= #1" (= 1 1))
-(assert-false "= #2" (= 1 2))
-(assert-true "= #3" (= 1 1 1))
-(assert-false "= #4" (= 1 2 1))
-(assert-false "= #5" (= 1 1 2))
+; check =
+(assert-true "= #1" (= 1 1))
+(assert-false "= #2" (= 1 2))
+(assert-true "= #3" (= 1 1 1))
+(assert-false "= #4" (= 1 2 1))
+(assert-false "= #5" (= 1 1 2))
+(assert-true "= #6" (= -1 -1))
+(assert-false "= #7" (= -1 -2))
+(assert-true "= #8" (= -1 -1 -1))
+(assert-false "= #9" (= -1 -2 -1))
+(assert-false "= #10" (= -1 -1 -2))
+(assert-false "= #11" (= -1 1))
+(assert-false "= #12" (= 1 -1))
-;; TODO: add minus number comparisons
+; check >
(assert-true "> #1" (> 1 0))
(assert-false "> #2" (> 1 1))
(assert-false "> #3" (> 1 2))
@@ -19,50 +26,131 @@
(assert-false "> #9" (> 1 1 1))
(assert-false "> #10" (> 1 2 1))
(assert-false "> #11" (> 1 2 0))
+(assert-true "> #12" (> 1 -1))
+(assert-true "> #13" (> 1 0 -1))
+(assert-true "> #14" (> -1 -2))
+(assert-true "> #15" (> -1 -2 -3))
+(assert-false "> #16" (> -2 -1))
+(assert-false "> #17" (> -3 -2 -1))
-;; TODO: add tests for <, >=, <=
+; check <
+(assert-true "< #1" (< 0 1))
+(assert-false "< #2" (< 1 1))
+(assert-false "< #3" (< 2 1))
+(assert-false "< #4" (< 0 0 1))
+(assert-true "< #5" (< -1 0 1))
+(assert-true "< #6" (< -1 0 1))
+(assert-false "< #7" (< 1 0 1))
+(assert-false "< #8" (< 1 0 1))
+(assert-false "< #9" (< 1 1 1))
+(assert-false "< #10" (< 1 2 1))
+(assert-false "< #11" (< 0 2 1))
+(assert-true "< #12" (< -1 1))
+(assert-true "< #13" (< -1 0 1))
+(assert-true "< #14" (< -2 -1))
+(assert-true "< #15" (< -3 -2 -1))
+(assert-false "< #16" (< -1 -2))
+(assert-false "< #17" (< -1 -2 -3))
+; check >=
+(assert-true ">= #1" (>= 1 0))
+(assert-true ">= #2" (>= 1 1))
+(assert-false ">= #3" (>= 1 2))
+(assert-true ">= #4" (>= 1 0 0))
+(assert-true ">= #5" (>= 1 0 -1))
+(assert-true ">= #6" (>= 1 0 -1))
+(assert-false ">= #7" (>= 1 0 1))
+(assert-true ">= #8" (>= 1 1 0))
+(assert-true ">= #9" (>= 1 1 1))
+(assert-false ">= #10" (>= 1 2 1))
+(assert-false ">= #11" (>= 1 2 0))
+(assert-true ">= #12" (>= 1 -1))
+(assert-true ">= #13" (>= 1 0 -1))
+(assert-true ">= #14" (>= -1 -2))
+(assert-true ">= #15" (>= -1 -2 -3))
+(assert-false ">= #16" (>= -2 -1))
+(assert-false ">= #17" (>= -3 -2 -1))
+(assert-true ">= #18" (>= -1 -1 -2))
+
+; check <=
+(assert-true "<= #1" (<= 0 1))
+(assert-true "<= #2" (<= 1 1))
+(assert-false "<= #3" (<= 2 1))
+(assert-true "<= #4" (<= 0 0 1))
+(assert-true "<= #5" (<= -1 0 1))
+(assert-true "<= #6" (<= -1 0 1))
+(assert-false "<= #7" (<= 1 0 1))
+(assert-false "<= #8" (<= 1 0 1))
+(assert-true "<= #9" (<= 1 1 1))
+(assert-false "<= #10" (<= 1 2 1))
+(assert-false "<= #11" (<= 0 2 1))
+(assert-true "<= #12" (<= -1 1))
+(assert-true "<= #13" (<= -1 0 1))
+(assert-true "<= #14" (<= -2 -1))
+(assert-true "<= #15" (<= -3 -2 -1))
+(assert-false "<= #16" (<= -1 -2))
+(assert-false "<= #17" (<= -1 -2 -3))
+(assert-true "<= #18" (<= -2 -1 -1))
+
+; check max
(assert-equal? "max test1" 0 (max 0))
(assert-equal? "max test2" 1 (max 0 1))
(assert-equal? "max test3" 2 (max 0 2 1))
(assert-equal? "max test4" 7 (max -1 -10 7))
+
+; check min
(assert-equal? "min test1" 0 (min 0))
(assert-equal? "min test2" 0 (min 0 1))
(assert-equal? "min test3" 0 (min 2 0 1))
(assert-equal? "min test4" -10 (min -1 -10 7))
+
+; check +
(assert-equal? "+ test1" 0 (+))
(assert-equal? "+ test2" 3 (+ 3))
(assert-equal? "+ test3" 3 (+ 1 2))
(assert-equal? "+ test4" 6 (+ 1 2 3))
+
+; check -
(assert-equal? "- test1" -3 (- 3))
(assert-equal? "- test2" -1 (- 1 2))
(assert-equal? "- test3" -4 (- 1 2 3))
+
+; check *
(assert-equal? "* test1" 1 (*))
(assert-equal? "* test2" 2 (* 2))
(assert-equal? "* test3" 24 (* 2 3 4))
+
+; check /
(assert-equal? "/ test1" 0 (/ 1 2))
(assert-equal? "/ test2" -1 (/ -2 2))
+; check abs
(assert-equal? "abs test1" 7 (abs -7))
(assert-equal? "abs test2" 7 (abs 7))
+(assert-equal? "abs test3" 0 (abs 0))
+; check quotient
(assert-equal? "quotient test1" 0 (/ 1 2))
(assert-equal? "quotient test2" -1 (/ -2 2))
+; check modulo
(assert-equal? "modulo test1" 1 (modulo 13 4))
(assert-equal? "modulo test2" 3 (modulo -13 4))
(assert-equal? "modulo test3" -3 (modulo 13 -4))
(assert-equal? "modulo test4" -1 (modulo -13 -4))
+; check remainder
(assert-equal? "remainder test1" 1 (remainder 13 4))
(assert-equal? "remainder test2" -1 (remainder -13 4))
(assert-equal? "remainder test3" 1 (remainder 13 -4))
(assert-equal? "remainder test4" -1 (remainder -13 -4))
+; check number->string
(assert-equal? "number->string test1" "1" (number->string 1))
(assert-equal? "number->string test2" "10" (number->string 10))
(assert-equal? "number->string test3" "100" (number->string 100))
+; check string->number
(assert-equal? "string->number test1" 1 (string->number "1"))
(assert-equal? "string->number test2" 10 (string->number "10"))
(assert-equal? "string->number test2" 100 (string->number "100"))
Modified: branches/r5rs/sigscheme/test/test-string.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-string.scm 2005-09-03 20:21:33 UTC (rev 1390)
+++ branches/r5rs/sigscheme/test/test-string.scm 2005-09-03 20:49:10 UTC (rev 1391)
@@ -41,7 +41,6 @@
(assert-equal? "hiragana string=? check" #t (string=? "¤¢¤¤¤¦¤¨¤ª" "¤¢¤¤¤¦¤¨¤ª"))
(assert-equal? "mixed string=? check" #t (string=? "a¤¤¤¦¤¨o" "a¤¤¤¦¤¨o"))
-
;; substring check
(assert "alphabet substring check" (string=? "iu" (substring "aiueo" 1 3)))
(assert "hiragana substring check" (string=? "¤¤¤¦" (substring "¤¢¤¤¤¦¤¨¤ª" 1 3)))
@@ -63,9 +62,9 @@
;; list->string
-(assert "list->string check" (string=? "¤¢a¤¤" (list->string '(#\¤¢ #\a #\¤¤))))
+(assert-equal? "list->string check" "¤¢a¤¤" (list->string '(#\¤¢ #\a #\¤¤)))
+(assert-equal? "string check #1" "\\" (list->string '(#\\)))
-
;; string-fill!
(assert "alphabet string-fill! check" (string=? "jjjjj" (begin
(define str "aiueo")
More information about the uim-commit
mailing list