[uim-commit] r2239 - branches/r5rs/sigscheme/test
kzk at freedesktop.org
kzk at freedesktop.org
Wed Nov 23 00:03:57 PST 2005
Author: kzk
Date: 2005-11-23 00:03:38 -0800 (Wed, 23 Nov 2005)
New Revision: 2239
Modified:
branches/r5rs/sigscheme/test/test-enc-eucjp.scm
branches/r5rs/sigscheme/test/test-string.scm
Log:
* test/test-string.scm
* test/test-enc-eucjp.scm
- move testcases which uses eucjp multibyte string
to test-enc-eucjp.scm
Modified: branches/r5rs/sigscheme/test/test-enc-eucjp.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-enc-eucjp.scm 2005-11-23 06:28:48 UTC (rev 2238)
+++ branches/r5rs/sigscheme/test/test-enc-eucjp.scm 2005-11-23 08:03:38 UTC (rev 2239)
@@ -1,19 +1,87 @@
;; -*- euc-jp -*-
(load "./test/unittest.scm")
-(assert-equal? "string 1" "Èþ¿Í¤Ë¤Ï" (string #\Èþ #\¿Í #\¤Ë #\¤Ï))
-(assert-equal? "list->string 1" "3Æü¤Ç" (list->string '(#\3 #\Æü #\¤Ç)))
-(assert-equal? "string->list 1" '(#\¤¡ #\¤ #\¤ë) (string->list "¤¡¤¤ë"))
+;; string?
+(assert-true "string? check" (string? "¤¢¤¤¤¦¤¨¤ª"))
+;; make-string
+(assert-true "alphabet make-string check" (string=? "aaa" (make-string 3 #\a)))
+(assert-true "hiragana make-string check" (string=? "¤¢¤¢¤¢" (make-string 3 #\¤¢)))
+(assert-equal? "make-string 1" "ÊâÊâÊâÊâÊâ" (make-string 5 #\Êâ))
+
+;; string-ref
+(assert-equal? "hiragana string-ref check" #\¤ª (string-ref "¤¢¤¤¤¦¤¨¤ª" 4))
+(assert-equal? "mixed string-ref check" #\¤ª (string-ref "¤¢iue¤ª" 4))
+(assert-equal? "alphabet string-ref 0 check" #\a (string-ref "aiueo" 0))
+(assert-equal? "hiragena string-ref 0 check" #\¤¢ (string-ref "¤¢¤¤¤¦¤¨¤ª" 0))
(assert-equal? "string-ref 1" #\Êâ (string-ref "»õhiÊâÍÊâ" 3))
-(assert-equal? "make-string 1" "ÊâÊâÊâÊâÊâ" (make-string 5 #\Êâ))
-(assert-equal? "string-copy 1" "¶â¶ä¹á" (string-copy "¶â¶ä¹á"))
+
+
+;; string-set!
+(assert-true"hiragana string-set! check" (string=? "¤¢¤¤¤«¤¨¤ª"
+ (begin
+ (define str (string-copy "¤¢¤¤¤¦¤¨¤ª"))
+ (string-set! str 2 #\¤«)
+ str)))
+(assert-true"mixed string-set! check" (string=? "aiueo"
+ (begin
+ (define str (string-copy "ai¤¦eo"))
+ (string-set! str 2 #\u)
+ str)))
(assert-equal? "string-set! 1" "¶â·Ë¶Ì" (string-set!
(string-copy "¶â·Ë¤È")
2
#\¶Ì))
+;; string-length
+(assert-equal? "hiragana string-length check" 5 (string-length "¤¢¤¤¤¦¤¨¤ª"))
+
+;; string=?
+(assert-equal? "hiragana string=? check" #t (string=? "¤¢¤¤¤¦¤¨¤ª" "¤¢¤¤¤¦¤¨¤ª"))
+(assert-equal? "mixed string=? check" #t (string=? "a¤¤¤¦¤¨o" "a¤¤¤¦¤¨o"))
+
+;; substring
+(assert-true"hiragana substring check" (string=? "¤¤¤¦" (substring (string-copy "¤¢¤¤¤¦¤¨¤ª") 1 3)))
+(assert-true"mixed substring check" (string=? "¤¤u" (substring (string-copy "a¤¤u¤¨o") 1 3)))
+
+;; string-append
+(assert-true "hiragana 1 string-append check" (string=? "¤¢" (string-append "¤¢")))
+(assert-true "hiragana 2 string-append check" (string=? "¤¢¤¤" (string-append "¤¢" "¤¤")))
+(assert-true "hiragana 3 string-append check" (string=? "¤¢¤¤¤¦" (string-append "¤¢" "¤¤" "¤¦")))
+(assert-true "mixed 2 string-append check" (string=? "¤¢i" (string-append "¤¢" "i")))
+(assert-true "mixed 3 string-append check" (string=? "¤¢i¤¦" (string-append "¤¢" "i" "¤¦")))
+
+
+;; string->list
+(assert-true "string->list check" (equal? '(#\¤¢ #\i #\¤¦ #\e #\¤ª) (string->list "¤¢i¤¦e¤ª")))
+(assert-equal? "string->list 1" '(#\¤¡ #\¤ #\¤ë) (string->list "¤¡¤¤ë"))
+
+;; list->string
+(assert-equal? "list->string check" "¤¢a¤¤" (list->string '(#\¤¢ #\a #\¤¤)))
+(assert-equal? "list->string 1" "3Æü¤Ç" (list->string '(#\3 #\Æü #\¤Ç)))
+
+;; string-fill!
+(assert-true"hiragana string-fill! check" (string=? "¤¢¤¢¤¢¤¢¤¢" (begin
+ (define str (string-copy "aiueo"))
+ (string-fill! str #\¤¢)
+ str)))
+(assert-true"mixed string-fill! by alphabet check" (string=? "aaaaa" (begin
+ (define str (string-copy "a¤¤¤¦¤¨o"))
+ (string-fill! str #\a)
+ str)))
+(assert-true"mixed string-fill! by hiragana check" (string=? "¤¤¤¤¤¤¤¤¤¤" (begin
+ (define str (string-copy "a¤¤¤¦¤¨o"))
+ (string-fill! str #\¤¤)
+ str)))
+
+;; string
+(assert-equal? "string 1" "Èþ¿Í¤Ë¤Ï" (string #\Èþ #\¿Í #\¤Ë #\¤Ï))
+
+;; string-copy
+(assert-equal? "string-copy 1" "¶â¶ä¹á" (string-copy "¶â¶ä¹á"))
+
+
;; The character after ¡ù is from JIS X 0212. The one after ¡ý is
;; from JIS X 0213 plane 2. This violates all known standards, but
;; souldn't be a real problem.
Modified: branches/r5rs/sigscheme/test/test-string.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-string.scm 2005-11-23 06:28:48 UTC (rev 2238)
+++ branches/r5rs/sigscheme/test/test-string.scm 2005-11-23 08:03:38 UTC (rev 2239)
@@ -33,36 +33,20 @@
(load "./test/unittest.scm")
;; check string?
-(assert-true"string? check" (string? "aiueo"))
+(assert-true "string? check" (string? "aiueo"))
;; check make-string
-(assert-true"null make-string" (string? (make-string 6)))
-(assert-true"alphabet make-string check" (string=? "aaa" (make-string 3 #\a)))
-(assert-true"hiragana make-string check" (string=? "¤¢¤¢¤¢" (make-string 3 #\¤¢)))
+(assert-true "null make-string" (string? (make-string 6)))
;; check string-ref
(assert-equal? "alphabet string-ref check" #\o (string-ref "aiueo" 4))
-(assert-equal? "hiragana string-ref check" #\¤ª (string-ref "¤¢¤¤¤¦¤¨¤ª" 4))
-(assert-equal? "mixed string-ref check" #\¤ª (string-ref "¤¢iue¤ª" 4))
-(assert-equal? "alphabet string-ref 0 check" #\a (string-ref "aiueo" 0))
-(assert-equal? "hiragena string-ref 0 check" #\¤¢ (string-ref "¤¢¤¤¤¦¤¨¤ª" 0))
;; check string-set!
-(assert-true"alphabet string-set! check" (string=? "aikeo"
- (begin
- (define str "aiueo")
- (string-set! str 2 #\k)
- str)))
-(assert-true"hiragana string-set! check" (string=? "¤¢¤¤¤«¤¨¤ª"
- (begin
- (define str "¤¢¤¤¤¦¤¨¤ª")
- (string-set! str 2 #\¤«)
- str)))
-(assert-true"mixed string-set! check" (string=? "aiueo"
- (begin
- (define str "ai¤¦eo")
- (string-set! str 2 #\u)
- str)))
+(assert-equal? "alphabet string-set! check" "aikeo"
+ (begin
+ (define str (string-copy "aiueo"))
+ (string-set! str 2 #\k)
+ str))
;; immutable strings: See "3.4 Storage model" of R5RS
(assert-error "string-set! on constant string #1"
@@ -74,35 +58,23 @@
;; check string-length
(assert-equal? "alphabet string-length check" 5 (string-length "aiueo"))
-(assert-equal? "hiragana string-length check" 5 (string-length "¤¢¤¤¤¦¤¨¤ª"))
(assert-equal? "backslash string-length check" 1 (string-length "\\"))
(assert-equal? "backslash string-length check" 2 (string-length "\\\\"))
(assert-equal? "backslash string-length check" 3 (string-length "\\\\\\"))
;; string=? check
(assert-equal? "alphabet string=? check" #t (string=? "aiueo" "aiueo"))
-(assert-equal? "hiragana string=? check" #t (string=? "¤¢¤¤¤¦¤¨¤ª" "¤¢¤¤¤¦¤¨¤ª"))
-(assert-equal? "mixed string=? check" #t (string=? "a¤¤¤¦¤¨o" "a¤¤¤¦¤¨o"))
;; substring check
-(assert-true"alphabet substring check" (string=? "iu" (substring "aiueo" 1 3)))
-(assert-true"hiragana substring check" (string=? "¤¤¤¦" (substring "¤¢¤¤¤¦¤¨¤ª" 1 3)))
-(assert-true"mixed substring check" (string=? "¤¤u" (substring "a¤¤u¤¨o" 1 3)))
+(assert-true "alphabet substring check" (string=? "iu" (substring (string-copy "aiueo") 1 3)))
-
;; string-append check
-(assert-true"alphabet 1 string-append check" (string=? "a" (string-append "a")))
-(assert-true"alphabet 2 string-append check" (string=? "ai" (string-append "a" "i")))
-(assert-true"alphabet 3 string-append check" (string=? "aiu" (string-append "a" "i" "u")))
-(assert-true"hiragana 1 string-append check" (string=? "¤¢" (string-append "¤¢")))
-(assert-true"hiragana 2 string-append check" (string=? "¤¢¤¤" (string-append "¤¢" "¤¤")))
-(assert-true"hiragana 3 string-append check" (string=? "¤¢¤¤¤¦" (string-append "¤¢" "¤¤" "¤¦")))
-(assert-true"mixed 2 string-append check" (string=? "¤¢i" (string-append "¤¢" "i")))
-(assert-true"mixed 3 string-append check" (string=? "¤¢i¤¦" (string-append "¤¢" "i" "¤¦")))
+(assert-true "alphabet 1 string-append check" (string=? "a" (string-append "a")))
+(assert-true "alphabet 2 string-append check" (string=? "ai" (string-append "a" "i")))
+(assert-true "alphabet 3 string-append check" (string=? "aiu" (string-append "a" "i" "u")))
;; string->list
(assert-equal? "string->list check" '() (string->list ""))
-(assert-true"string->list check" (equal? '(#\¤¢ #\i #\¤¦ #\e #\¤ª) (string->list "¤¢i¤¦e¤ª")))
(assert-equal? "string->list check" '(#\\) (string->list "\\"))
(assert-equal? "string->list check" '(#\\ #\\) (string->list "\\\\"))
(assert-equal? "string->list check" '(#\\ #\\ #\\) (string->list "\\\\\\"))
@@ -120,7 +92,6 @@
;; list->string
(assert-equal? "list->string check" "" (list->string '()))
-(assert-equal? "list->string check" "¤¢a¤¤" (list->string '(#\¤¢ #\a #\¤¤)))
(assert-equal? "list->string check" "\\" (list->string '(#\\)))
(assert-equal? "list->string check" "\\\\" (list->string '(#\\ #\\)))
(assert-equal? "list->string check" "\\\\\\" (list->string '(#\\ #\\ #\\)))
@@ -139,21 +110,9 @@
;; string-fill!
(assert-true"alphabet string-fill! check" (string=? "jjjjj" (begin
- (define str "aiueo")
- (string-fill! str #\j)
- str)))
-(assert-true"hiragana string-fill! check" (string=? "¤¢¤¢¤¢¤¢¤¢" (begin
- (define str "aiueo")
- (string-fill! str #\¤¢)
- str)))
-(assert-true"mixed string-fill! by alphabet check" (string=? "aaaaa" (begin
- (define str "a¤¤¤¦¤¨o")
- (string-fill! str #\a)
- str)))
-(assert-true"mixed string-fill! by hiragana check" (string=? "¤¤¤¤¤¤¤¤¤¤" (begin
- (define str "a¤¤¤¦¤¨o")
- (string-fill! str #\¤¤)
- str)))
+ (define str (string-copy "aiueo"))
+ (string-fill! str #\j)
+ str)))
;;
;; escape sequences
@@ -175,9 +134,14 @@
(assert-equal? "R5RS escape sequence" '(#\newline) (string->list "\n")) ;; 110
;; R6RS(SRFI-75) compliant
-(assert-equal? "R6RS escape sequence" (integer->string 0) "\x00") ;; 0
-(assert-equal? "R6RS escape sequence" (list->string '(#\nul)) "\x00") ;; 0
-(assert-equal? "R6RS escape sequence" '(#\nul) (string->list "\x00")) ;; 0
+;
+; 2005/11/23 Kazuki Ohta <mover at hct.zaq.ne.jp>
+; temporally commented out, because we cannot handle "\x<x><x>" style escape
+; sequence yet.
+;
+;(assert-equal? "R6RS escape sequence" (integer->string 0) "\x00") ;; 0
+;(assert-equal? "R6RS escape sequence" (list->string '(#\nul)) "\x00") ;; 0
+;(assert-equal? "R6RS escape sequence" '(#\nul) (string->list "\x00")) ;; 0
(assert-equal? "R6RS escape sequence" (integer->string 7) "\a") ;; 97
(assert-equal? "R6RS escape sequence" (list->string '(#\alarm)) "\a") ;; 97
(assert-equal? "R6RS escape sequence" '(#\alarm) (string->list "\a")) ;; 97
More information about the uim-commit
mailing list