From: "Leslie P. Polzer" <s...@viridian-project.de>
Date: Tue, 4 Aug 2009 08:58:03 +0200 (CEST)

>   Could you also add new tests that show the problem?

Below listing is test code, uses attached utf-8 encoded file.
File was constructed by six lines, have below format.
     #\<a-char>:UTF-(8|16|32) char-code:<hex-value of (char-code #\<a-char>)>

-------------------- >8 -- >8 --------------------
(require :elephant)

(use-package :elephant)

(defpclass c ()
  ((l :initarg :l :accessor l :index t)))

(defun test (path)
  (with-open-store (`(:bdb ,(ensure-directories-exist "/var/tmp/test-db/")))
    (print 'x)
    (with-open-file (f path :external-format :utf-8)
      (print 'y)
      (loop for line = (read-line f nil nil)
            while line
            do (print (make-instance 'c :l line)))
      (let* ((un-sorted (mapcar #'l (get-instances-by-range 'c 'l nil nil)))
             (sorted (sort (copy-list un-sorted) #'string<)))
        (if (equal un-sorted sorted)
            (print "pass")
            (print "error"))))))

(test #p"path-to-attached-file")
-------------------- >8 -- >8 --------------------

>  Is the change compatible with existing incorrectly sorted
>  databases?

In my experience;
  GET-ININSTACE-BY-VALUE and GET-ININSTACES-BY-VALUE are
  works correctly.

  GET-INSTACES-BY-RANGE does not work correctly with
  incorrectly sorted data.
a:UTF-8 char-code:61
x:UTF-8 char-code:78
あ:UTF-16 char-code:3042
漢:UTF-16 char-code:6F22
𪎌:UTF-32 char-code:2A38C
𪐷:UTF-32 char-code:2A437
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to