From 55565ace6dd51fa5d97e126ec6f144201f92d1f2 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 10 Jul 2016 16:36:14 -0700 Subject: [PATCH] unicode.collation: better tests that don't spam the console. --- .../unicode/collation/collation-tests.factor | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/basis/unicode/collation/collation-tests.factor b/basis/unicode/collation/collation-tests.factor index 9d7d5cd8bf..14f597bac6 100644 --- a/basis/unicode/collation/collation-tests.factor +++ b/basis/unicode/collation/collation-tests.factor @@ -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 -[ 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