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