@@ -37,6 +37,7 @@ dataCharUnicodeTests = describe "module Data.Char.Unicode" do
37
37
toUpperTests
38
38
toLowerTests
39
39
toTitleTests
40
+ digitToIntTests
40
41
isLetterTests
41
42
isMarkTests
42
43
isNumberTests
@@ -321,6 +322,24 @@ toLowerTests = pure unit
321
322
toTitleTests :: forall eff . Spec eff Unit
322
323
toTitleTests = pure unit
323
324
325
+ digitToIntTests :: forall eff . Spec eff Unit
326
+ digitToIntTests = describe " digitToInt" do
327
+ it " '0'..'9' get mapped correctly" $
328
+ map digitToInt [' 0' ,' 1' ,' 2' ,' 3' ,' 4' ,' 5' ,' 6' ,' 7' ,' 8' ,' 9' ] `shouldEqual`
329
+ [Just 0 , Just 1 , Just 2 , Just 3 , Just 4 , Just 5 , Just 6 , Just 7 , Just 8 , Just 9 ]
330
+ it " 'a'..'f' get mapped correctly" $
331
+ map digitToInt [' a' ,' b' ,' c' ,' d' ,' e' ,' f' ] `shouldEqual`
332
+ [Just 10 , Just 11 , Just 12 , Just 13 , Just 14 , Just 15 ]
333
+ it " 'A'..'F' get mapped correctly" $
334
+ map digitToInt [' A' ,' B' ,' C' ,' D' ,' E' ,' F' ] `shouldEqual`
335
+ [Just 10 , Just 11 , Just 12 , Just 13 , Just 14 , Just 15 ]
336
+ it " 'G' is not a digit" $
337
+ digitToInt ' G' `shouldEqual` Nothing
338
+ it " '♥' is not a digit" $
339
+ digitToInt '♥' `shouldEqual` Nothing
340
+ it " '国' is not a digit" $
341
+ digitToInt '国' `shouldEqual` Nothing
342
+
324
343
isLetterTests :: forall eff . Spec (console :: CONSOLE , random :: RANDOM , err :: EXCEPTION | eff ) Unit
325
344
isLetterTests = describe " isLetter" do
326
345
prop " isLetter == isAlpha" \char -> isLetter char == isAlpha char
0 commit comments