added tests for base10

This commit is contained in:
Stefan Friese 2024-06-09 22:14:50 +02:00
parent 37985bd205
commit 736627ff3d
1 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import Encoding.Base62 (enc62, dec62)
import Encoding.Base45 (enc45, dec45) import Encoding.Base45 (enc45, dec45)
import Encoding.Base32 (enc32, dec32) import Encoding.Base32 (enc32, dec32)
import Encoding.Base16 (enc16, dec16) import Encoding.Base16 (enc16, dec16)
import Encoding.Base10 (enc10, dec10)
import Encoding.Base8 (enc8, dec8) import Encoding.Base8 (enc8, dec8)
import Encoding.Base2 (enc2, dec2) import Encoding.Base2 (enc2, dec2)
import Encoding.QuotedPrintable (encqp, decqp) import Encoding.QuotedPrintable (encqp, decqp)
@ -113,6 +114,18 @@ testDec16 = TestCase $ do
assertEqual "for (dec16 \"4861736B656C6C\")," haskellBS (dec16 $ BSU.fromString "4861736B656C6C") assertEqual "for (dec16 \"4861736B656C6C\")," haskellBS (dec16 $ BSU.fromString "4861736B656C6C")
assertEqual "for (dec16 \"F09F9882\")," emojiBS (dec16 $ BSU.fromString "F09F9882") assertEqual "for (dec16 \"F09F9882\")," emojiBS (dec16 $ BSU.fromString "F09F9882")
testEnc10 :: Test
testEnc10 = TestCase $ do
assertEqual "for (enc10 \"Hello, World!\")," (BSU.fromString "72 101 108 108 111 44 32 87 111 114 108 100 33") (enc10 helloWorldBS)
assertEqual "for (enc10 \"Haskell\")," (BSU.fromString "72 97 115 107 101 108 108") (enc10 haskellBS)
assertEqual "for (enc10 \"😂\")," (BSU.fromString "240 159 152 130") (enc10 emojiBS)
testDec10 :: Test
testDec10 = TestCase $ do
assertEqual "for (dec10 \"72 101 108 108 111 44 32 87 111 114 108 100 33\")," helloWorldBS (dec10 $ BSU.fromString "72 101 108 108 111 44 32 87 111 114 108 100 33")
assertEqual "for (dec10 \"72 97 115 107 101 108 108\")," haskellBS (dec10 $ BSU.fromString "72 97 115 107 101 108 108")
assertEqual "for (dec10 \"240 159 152 130\")," emojiBS (dec10 $ BSU.fromString "240 159 152 130")
testEnc8 :: Test testEnc8 :: Test
testEnc8 = TestCase $ do testEnc8 = TestCase $ do
assertEqual "for (enc8 \"Hello, World!\")," (BSU.fromString "110 145 154 154 157 54 40 127 157 162 154 144 41") (enc8 helloWorldBS) assertEqual "for (enc8 \"Hello, World!\")," (BSU.fromString "110 145 154 154 157 54 40 127 157 162 154 144 41") (enc8 helloWorldBS)
@ -189,6 +202,8 @@ tests = TestList [TestLabel "Test enc91" testEnc91,
TestLabel "Test dec32" testDec32, TestLabel "Test dec32" testDec32,
TestLabel "Test enc16" testEnc16, TestLabel "Test enc16" testEnc16,
TestLabel "Test dec16" testDec16, TestLabel "Test dec16" testDec16,
TestLabel "Test enc10" testEnc10,
TestLabel "Test dec10" testDec10,
TestLabel "Test enc8 " testEnc8 , TestLabel "Test enc8 " testEnc8 ,
TestLabel "Test dec8 " testDec8 , TestLabel "Test dec8 " testDec8 ,
TestLabel "Test dec2 " testDec2 , TestLabel "Test dec2 " testDec2 ,