]> gitweb.factorcode.org Git - factor.git/commitdiff
unicode.collation: better tests that don't spam the console.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 10 Jul 2016 23:36:14 +0000 (16:36 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 10 Jul 2016 23:36:14 +0000 (16:36 -0700)
basis/unicode/collation/collation-tests.factor

index 9d7d5cd8bf58034e7fd79343d5896dcf783e8015..14f597bac62f34f3ea4caec30ee370b008cbac39 100644 (file)
@@ -1,16 +1,7 @@
-USING: io io.files splitting grouping unicode
-sequences kernel io.encodings.utf8 math.parser math.order
-tools.test assocs words ;
+USING: assocs grouping io.encodings.utf8 io.files kernel
+math.order math.parser sequences splitting tools.test unicode ;
 IN: unicode.collation.tests
 
-: parse-test ( -- strings )
-    "vocab:unicode/collation/CollationTest_SHIFTED.txt"
-    utf8 file-lines 5 tail
-    [ ";" split1 drop " " split [ hex> ] "" map-as ] map ;
-
-: test-two ( str1 str2 -- )
-    [ +lt+ ] -rot [ string<=> ] 2curry unit-test ;
-
 : test-equality ( str1 str2 -- ? ? ? ? )
     { primary= secondary= tertiary= quaternary= }
     [ execute( a b -- ? ) ] 2with map
@@ -25,5 +16,9 @@ IN: unicode.collation.tests
 [ { "HELLO" "goodbye" "good bye" "hello" } sort-strings ]
 unit-test
 
-parse-test 2 <clumps>
-[ test-two ] assoc-each
+{ { } } [
+    "vocab:unicode/collation/CollationTest_SHIFTED.txt"
+    utf8 file-lines 5 tail
+    [ ";" split1 drop " " split [ hex> ] "" map-as ] map
+    2 clump [ string<=> +lt+ eq? ] assoc-reject
+] unit-test