From 736627ff3d38cb8102a968636e426ba7c61e1f7b Mon Sep 17 00:00:00 2001 From: Stefan Friese Date: Sun, 9 Jun 2024 22:14:50 +0200 Subject: [PATCH] added tests for base10 --- test/Main.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/Main.hs b/test/Main.hs index 1b7806e..738a0de 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -10,6 +10,7 @@ import Encoding.Base62 (enc62, dec62) import Encoding.Base45 (enc45, dec45) import Encoding.Base32 (enc32, dec32) import Encoding.Base16 (enc16, dec16) +import Encoding.Base10 (enc10, dec10) import Encoding.Base8 (enc8, dec8) import Encoding.Base2 (enc2, dec2) import Encoding.QuotedPrintable (encqp, decqp) @@ -113,6 +114,18 @@ testDec16 = TestCase $ do assertEqual "for (dec16 \"4861736B656C6C\")," haskellBS (dec16 $ BSU.fromString "4861736B656C6C") 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 = TestCase $ do 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 enc16" testEnc16, TestLabel "Test dec16" testDec16, + TestLabel "Test enc10" testEnc10, + TestLabel "Test dec10" testDec10, TestLabel "Test enc8 " testEnc8 , TestLabel "Test dec8 " testDec8 , TestLabel "Test dec2 " testDec2 ,