1 USING: io io.files splitting grouping unicode.collation
2 sequences kernel io.encodings.utf8 math.parser math.order
3 tools.test assocs words ;
4 IN: unicode.collation.tests
6 : parse-test ( -- strings )
7 "vocab:unicode/collation/CollationTest_SHIFTED.txt"
9 [ ";" split1 drop " " split [ hex> ] "" map-as ] map ;
11 : test-two ( str1 str2 -- )
12 [ +lt+ ] -rot [ string<=> ] 2curry unit-test ;
14 : test-equality ( str1 str2 -- ? ? ? ? )
15 { primary= secondary= tertiary= quaternary= }
16 [ execute( a b -- ? ) ] 2with map
19 [ f f f f ] [ "hello" "hi" test-equality ] unit-test
20 [ t f f f ] [ "hello" "h\u0000e9llo" test-equality ] unit-test
21 [ t t f f ] [ "hello" "HELLO" test-equality ] unit-test
22 [ t t t f ] [ "hello" "h e l l o." test-equality ] unit-test
23 [ t t t t ] [ "hello" "\0hello\0" test-equality ] unit-test
24 [ { "good bye" "goodbye" "hello" "HELLO" } ]
25 [ { "HELLO" "goodbye" "good bye" "hello" } sort-strings ]
29 [ test-two ] assoc-each