Shiro Kawai
shiro****@lava*****
2005年 3月 15日 (火) 20:43:02 JST
テストも間違っていたので、私が実装する時に仕様を勘違いしていた 可能性大です。次のパッチで治ると思います。 --shiro =================================================================== RCS file: /cvsroot/gauche/Gauche/lib/srfi-13/prefix.scm,v retrieving revision 1.4 diff -u -r1.4 prefix.scm --- lib/srfi-13/prefix.scm 5 Jul 2003 03:29:12 -0000 1.4 +++ lib/srfi-13/prefix.scm 15 Mar 2005 11:41:01 -0000 @@ -87,12 +87,14 @@ (let ((sp1 (make-string-pointer str1 -1)) (sp2 (make-string-pointer str2 -1))) (let loop ((ch1 (string-pointer-prev! sp1)) - (ch2 (string-pointer-prev! sp2))) - (cond ((eof-object? ch1) (action (string-pointer-index sp1) #t)) - ((eof-object? ch2) (action (string-pointer-index sp1) #f)) + (ch2 (string-pointer-prev! sp2)) + (count 0)) + (cond ((eof-object? ch1) (action count #t)) + ((eof-object? ch2) (action count #f)) ((= ch1 ch2) (loop (string-pointer-prev! sp1) - (string-pointer-prev! sp2))) - (else (action (+ (string-pointer-index sp1) 1) #f))) + (string-pointer-prev! sp2) + (+ count 1))) + (else (action count #f))) ))) (define (string-suffix-length s1 s2 . args) =================================================================== RCS file: /cvsroot/gauche/Gauche/test/srfi.scm,v retrieving revision 1.39 diff -u -r1.39 srfi.scm --- test/srfi.scm 1 Nov 2004 21:51:05 -0000 1.39 +++ test/srfi.scm 15 Mar 2005 11:41:02 -0000 @@ -736,9 +736,9 @@ (string-prefix-length "cancaNCAM" "cancancan")) (test* "string-prefix-length-ci" 8 (string-prefix-length-ci "cancaNCAM" "cancancan")) -(test* "string-suffix-length" 4 +(test* "string-suffix-length" 2 (string-suffix-length "CanCan" "cankancan")) -(test* "string-suffix-length-ci" 1 +(test* "string-suffix-length-ci" 5 (string-suffix-length-ci "CanCan" "cankancan")) (test* "string-prefix?" #t (string-prefix? "abcd" "abcdefg"))