mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-05 04:06:36 +02:00
adding basic string tests
This commit is contained in:
parent
72a2f237c7
commit
d29d7733fc
1 changed files with 48 additions and 0 deletions
|
@ -177,6 +177,10 @@
|
||||||
|
|
||||||
(test #t (equal? "abc" "abc"))
|
(test #t (equal? "abc" "abc"))
|
||||||
|
|
||||||
|
(test #f (equal? "abc" "abcd"))
|
||||||
|
|
||||||
|
(test #f (equal? "a" "b"))
|
||||||
|
|
||||||
(test #t (equal? 2 2))
|
(test #t (equal? 2 2))
|
||||||
|
|
||||||
;;(test #f (eqv? 2 2.0))
|
;;(test #f (eqv? 2 2.0))
|
||||||
|
@ -358,6 +362,50 @@
|
||||||
|
|
||||||
(test "Malvina" (symbol->string (string->symbol "Malvina")))
|
(test "Malvina" (symbol->string (string->symbol "Malvina")))
|
||||||
|
|
||||||
|
(test #t (string? "a"))
|
||||||
|
|
||||||
|
(test #f (string? 'a))
|
||||||
|
|
||||||
|
(test 0 (string-length ""))
|
||||||
|
|
||||||
|
(test 3 (string-length "abc"))
|
||||||
|
|
||||||
|
(test #\a (string-ref "abc" 0))
|
||||||
|
|
||||||
|
(test #\c (string-ref "abc" 2))
|
||||||
|
|
||||||
|
(test "axc" (let ((s (string #\a #\b #\c))) (string-set! s 1 #\x) s))
|
||||||
|
|
||||||
|
(test #t (string=? "a" (string #\a)))
|
||||||
|
|
||||||
|
(test #f (string=? "a" (string #\b)))
|
||||||
|
|
||||||
|
(test #t (string<? "a" "aa"))
|
||||||
|
|
||||||
|
(test #f (string<? "aa" "a"))
|
||||||
|
|
||||||
|
(test #f (string<? "a" "a"))
|
||||||
|
|
||||||
|
(test #t (string<=? "a" "aa"))
|
||||||
|
|
||||||
|
(test #t (string<=? "a" "a"))
|
||||||
|
|
||||||
|
(test #t (string=? "a" (make-string 1 #\a)))
|
||||||
|
|
||||||
|
(test #f (string=? "a" (make-string 1 #\b)))
|
||||||
|
|
||||||
|
(test "" (substring "abc" 0 0))
|
||||||
|
|
||||||
|
(test "a" (substring "abc" 0 1))
|
||||||
|
|
||||||
|
(test "bc" (substring "abc" 1 3))
|
||||||
|
|
||||||
|
(test "abc" (string-append "abc" ""))
|
||||||
|
|
||||||
|
(test "abc" (string-append "" "abc"))
|
||||||
|
|
||||||
|
(test "abc" (string-append "a" "bc"))
|
||||||
|
|
||||||
(test '#(0 ("Sue" "Sue") "Anna")
|
(test '#(0 ("Sue" "Sue") "Anna")
|
||||||
(let ((vec (vector 0 '(2 2 2 2) "Anna")))
|
(let ((vec (vector 0 '(2 2 2 2) "Anna")))
|
||||||
(vector-set! vec 1 '("Sue" "Sue"))
|
(vector-set! vec 1 '("Sue" "Sue"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue