packages feed

naturalcomp-0.0.2: tests/colltest.hs

-- -*- coding: utf-8 -*-

import Data.List (sortBy)
import Test.HUnit
import Text.NaturalComp.Collation

-- from rfc5051 docs
a = "Abe Oeb abe abé oeb Ábe Äbe Ôeb ábe äbe ôeb"
b = "Abe abe abé Ábe ábe Äbe äbe Oeb oeb Ôeb ôeb"

sortTest x y = assertEqual "" y $ unwords $ sortBy naturalCollate $ words x

tests = TestList [ TestLabel "test1" $ TestCase $ sortTest a b ]

main = runTestTT tests