* Re: srfi-14 char-set<= problem
2014-11-27 17:45 srfi-14 char-set<= problem Seth Alves
@ 2014-12-01 6:02 ` Jamison Hope
2014-12-01 21:51 ` Per Bothner
0 siblings, 1 reply; 3+ messages in thread
From: Jamison Hope @ 2014-12-01 6:02 UTC (permalink / raw)
To: kawa
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
On Nov 27, 2014, at 12:45 PM, Seth Alves <alves@hungry.com> wrote:
> (import (scheme base) (scheme write) (srfi 14))
> (write (char-set<= (char-set #\u) (char-set #\u)))
> (newline)
> (write (char-set<= (char-set #\u) (char-set #\u #\a)))
> (newline)
>
> This prints:
>
> #t
> #f
>
> -seth
Yup, there was a bug in the char-set<= logic. The attached patch should fix it. Per, if you would do the honors..
--
Jamison Hope
The PTR Group
www.theptrgroup.com
[-- Attachment #2: srfi14-fix.patch --]
[-- Type: application/octet-stream, Size: 2227 bytes --]
Index: gnu/kawa/slib/ChangeLog
===================================================================
--- gnu/kawa/slib/ChangeLog (revision 8186)
+++ gnu/kawa/slib/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2014-12-01 Jamison Hope <jrh@theptrgroup.com>
+
+ * srfi14.scm (char-set<=): Fix bug reported by Seth Alves.
+
2014-11-27 Seth Alves <alves@hungry.com>
* srfi60.scm: Add more aliases.
Index: gnu/kawa/slib/srfi14.scm
===================================================================
--- gnu/kawa/slib/srfi14.scm (revision 8186)
+++ gnu/kawa/slib/srfi14.scm (working copy)
@@ -483,6 +483,9 @@
((= (inversion-list (- ai 1))
(cs:inversion-list (- bi 1)))
(loop (- ai 2) (- bi 2)))
+ ((> (inversion-list ai)
+ (cs:inversion-list (- bi 1)))
+ (loop ai (- bi 2)))
(else #f))))
((contains? (char ::character)) ::boolean
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 8186)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2014-12-01 Jamison Hope <jrh@theptrgroup.com>
+
+ * lib-test.scm: Add test for char-set<= bug reported by Seth
+ Alves.
+
2014-11-26 Seth Alves <alves@hungry.com>
Per Bothner <per@bothner.com>
Index: testsuite/lib-test.scm
===================================================================
--- testsuite/lib-test.scm (revision 8186)
+++ testsuite/lib-test.scm (working copy)
@@ -1,6 +1,6 @@
;; -*- coding: utf-8 -*-
-(test-begin "libs" 257)
+(test-begin "libs" 259)
(test-begin "vectors")
(test-equal '(dah dah didah)
@@ -509,7 +509,7 @@
(test-end)
-(test-begin "char-sets" 89)
+(test-begin "char-sets" 91)
(import (srfi :14 char-sets))
(import (rnrs sorting))
@@ -526,6 +526,8 @@
(test-equal #t (char-set<= char-set:empty char-set:full))
(test-equal #t (char-set<= char-set:empty char-set:lower-case
char-set:full))
+(test-equal #t (char-set<= (char-set #\u) (char-set #\u)))
+(test-equal #t (char-set<= (char-set #\u) (char-set #\u #\a)))
; char-set-hash
(test-equal #t (= (char-set-hash char-set:empty)
(char-set-hash (char-set))))
^ permalink raw reply [flat|nested] 3+ messages in thread