Skip to content
Snippets Groups Projects
Commit 36740aba authored by rtoy's avatar rtoy
Browse files

norm-test.lisp:

word-break-test.lisp:
o Change the name of PARSE-LINE to be unique so we can load and run
  both tests in the same lisp instance.
parent 68f0165a
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
(in-package "CL-USER") (in-package "CL-USER")
(defvar *normalization-test* "target:i18n/tests/NormalizationTest.txt") (defvar *normalization-test* "target:i18n/tests/NormalizationTest.txt")
(defun parse-line (line) (defun parse-norm-line (line)
(declare (string line)) (declare (string line))
(cond ((or (char= (aref line 0) #\@) (cond ((or (char= (aref line 0) #\@)
(char= (aref line 0) #\#)) (char= (aref line 0) #\#))
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
(failures 0)) (failures 0))
(loop for line = (read-line testfile nil nil) while line do (loop for line = (read-line testfile nil nil) while line do
(multiple-value-bind (c1 c2 c3 c4 c5) (multiple-value-bind (c1 c2 c3 c4 c5)
(parse-line line) (parse-norm-line line)
(when c1 (when c1
(incf total) (incf total)
(let ((test1 (lisp::string-to-nfd c1)) (let ((test1 (lisp::string-to-nfd c1))
...@@ -78,8 +78,9 @@ ...@@ -78,8 +78,9 @@
(let ((total 0) (let ((total 0)
(failures 0)) (failures 0))
(loop for line = (read-line testfile nil nil) while line do (loop for line = (read-line testfile nil nil) while line do
;;(format t "line = ~S~%" line)
(multiple-value-bind (c1 c2 c3 c4 c5) (multiple-value-bind (c1 c2 c3 c4 c5)
(parse-line line) (parse-norm-line line)
(when c1 (when c1
(incf total) (incf total)
(let ((test1 (lisp::string-to-nfkd c1)) (let ((test1 (lisp::string-to-nfkd c1))
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
(failures 0)) (failures 0))
(loop for line = (read-line testfile nil nil) while line do (loop for line = (read-line testfile nil nil) while line do
(multiple-value-bind (c1 c2 c3 c4 c5) (multiple-value-bind (c1 c2 c3 c4 c5)
(parse-line line) (parse-norm-line line)
(when c1 (when c1
(incf total) (incf total)
(let ((test1 (lisp::string-to-nfc c1)) (let ((test1 (lisp::string-to-nfc c1))
...@@ -144,7 +145,7 @@ ...@@ -144,7 +145,7 @@
(failures 0)) (failures 0))
(loop for line = (read-line testfile nil nil) while line do (loop for line = (read-line testfile nil nil) while line do
(multiple-value-bind (c1 c2 c3 c4 c5) (multiple-value-bind (c1 c2 c3 c4 c5)
(parse-line line) (parse-norm-line line)
(when c1 (when c1
(incf total) (incf total)
(let ((test1 (lisp::string-to-nfkc c1)) (let ((test1 (lisp::string-to-nfkc c1))
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(defvar *word-break-test* "target:i18n/tests/WordBreakTest.txt") (defvar *word-break-test* "target:i18n/tests/WordBreakTest.txt")
(defun parse-line (line) (defun parse-word-break-line (line)
(let* ((eos (or (position #\# line) (let* ((eos (or (position #\# line)
(length line)))) (length line))))
;; See WordBreakTest.txt for the format of the file. Basically ;; See WordBreakTest.txt for the format of the file. Basically
...@@ -63,13 +63,13 @@ ...@@ -63,13 +63,13 @@
(let ((count 0) (let ((count 0)
(failed 0)) (failed 0))
(format t "Run WordBreakTest~%") (format t "Run WordBreakTest~%")
(with-open-file (s file :direction :input :external-format :utf8) (with-open-file (s file :direction :input :external-format :utf)
(loop for line = (read-line s nil nil) (loop for line = (read-line s nil nil)
while line while line
do do
(progn (progn
(multiple-value-bind (s b) (multiple-value-bind (s b)
(parse-line line) (parse-word-break-line line)
(when s (when s
(incf count) (incf count)
(incf failed (if (do-test s b) 0 1))))))) (incf failed (if (do-test s b) 0 1)))))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment