added base45 tests
This commit is contained in:
parent
87089a314b
commit
580792ddf6
1
based
1
based
|
@ -1 +0,0 @@
|
||||||
./dist-newstyle/build/aarch64-linux/ghc-9.4.8/based-0.4.3.0/x/based/build/based/based
|
|
27
test/Main.hs
27
test/Main.hs
|
@ -2,6 +2,7 @@ module Main where
|
||||||
|
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
import Encoding.Base64 (enc64, dec64)
|
import Encoding.Base64 (enc64, dec64)
|
||||||
|
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.Base8 (enc8, dec8)
|
import Encoding.Base8 (enc8, dec8)
|
||||||
|
@ -24,12 +25,17 @@ testDec64 = TestCase $ do
|
||||||
assertEqual "for (dec64 \"AAEC\")," "\x00\x01\x02" (dec64 "AAEC")
|
assertEqual "for (dec64 \"AAEC\")," "\x00\x01\x02" (dec64 "AAEC")
|
||||||
assertEqual "for (dec64 \"8J+Ygg==\")," "😂" (dec64 "8J+Ygg==")
|
assertEqual "for (dec64 \"8J+Ygg==\")," "😂" (dec64 "8J+Ygg==")
|
||||||
|
|
||||||
testDec32 :: Test
|
testEnc45 :: Test
|
||||||
testDec32 = TestCase $ do
|
testEnc45 = TestCase $ do
|
||||||
assertEqual "for (dec32 \"JBSWY3DPFQQFO33SNRSCC===\")," "Hello, World!" (dec32 "JBSWY3DPFQQFO33SNRSCC===")
|
assertEqual "for (enc45 \"Hello, World!\")," "%69 VDK2E:3404ESVDX0" (enc45 "Hello, World!")
|
||||||
assertEqual "for (dec32 \"JBQXG23FNRWA====\")," "Haskell" (dec32 "JBQXG23FNRWA====")
|
assertEqual "for (enc45 \"Haskell\")," "Y69RQE: CI2" (enc45 "Haskell")
|
||||||
-- assertEqual "for (dec32 \"AAEC\")," "\x00\x01\x02" (dec32 "AAEC")
|
assertEqual "for (enc45 \"😂\")," "*IURCJ" (enc45 "😂")
|
||||||
assertEqual "for (dec32 \"6CPZRAQ=\")," "😂" (dec32 "6CPZRAQ=")
|
|
||||||
|
testDec45 :: Test
|
||||||
|
testDec45 = TestCase $ do
|
||||||
|
assertEqual "for (dec45 \"%69 VDK2E:3404ESVDX0\")," "Hello, World!" (dec45 "%69 VDK2E:3404ESVDX0")
|
||||||
|
assertEqual "for (dec45 \"Y69RQE: CI2\")," "Haskell" (dec45 "Y69RQE: CI2")
|
||||||
|
assertEqual "for (dec45 \"*IURCJ\")," "😂" (dec45 "*IURCJ")
|
||||||
|
|
||||||
testEnc32 :: Test
|
testEnc32 :: Test
|
||||||
testEnc32 = TestCase $ do
|
testEnc32 = TestCase $ do
|
||||||
|
@ -37,6 +43,13 @@ testEnc32 = TestCase $ do
|
||||||
assertEqual "for (enc32 \"Haskell\")," "JBQXG23FNRWA====" (enc32 "Haskell")
|
assertEqual "for (enc32 \"Haskell\")," "JBQXG23FNRWA====" (enc32 "Haskell")
|
||||||
assertEqual "for (enc32 \"😂\")," "6CPZRAQ=" (enc32 "😂")
|
assertEqual "for (enc32 \"😂\")," "6CPZRAQ=" (enc32 "😂")
|
||||||
|
|
||||||
|
testDec32 :: Test
|
||||||
|
testDec32 = TestCase $ do
|
||||||
|
assertEqual "for (dec32 \"JBSWY3DPFQQFO33SNRSCC===\")," "Hello, World!" (dec32 "JBSWY3DPFQQFO33SNRSCC===")
|
||||||
|
assertEqual "for (dec32 \"JBQXG23FNRWA====\")," "Haskell" (dec32 "JBQXG23FNRWA====")
|
||||||
|
-- assertEqual "for (dec32 \"AAEC\")," "\x00\x01\x02" (dec32 "AAEC")
|
||||||
|
assertEqual "for (dec32 \"6CPZRAQ=\")," "😂" (dec32 "6CPZRAQ=")
|
||||||
|
|
||||||
testEnc16 :: Test
|
testEnc16 :: Test
|
||||||
testEnc16 = TestCase $ do
|
testEnc16 = TestCase $ do
|
||||||
assertEqual "for (enc16 \"Hello, World!\")," "48656C6C6F2C20576F726C6421" (enc16 "Hello, World!")
|
assertEqual "for (enc16 \"Hello, World!\")," "48656C6C6F2C20576F726C6421" (enc16 "Hello, World!")
|
||||||
|
@ -76,6 +89,8 @@ testDec2 = TestCase $ do
|
||||||
tests :: Test
|
tests :: Test
|
||||||
tests = TestList [TestLabel "Test enc64" testEnc64,
|
tests = TestList [TestLabel "Test enc64" testEnc64,
|
||||||
TestLabel "Test dec64" testDec64,
|
TestLabel "Test dec64" testDec64,
|
||||||
|
TestLabel "Test enc32" testEnc45,
|
||||||
|
TestLabel "Test dec32" testDec45,
|
||||||
TestLabel "Test enc32" testEnc32,
|
TestLabel "Test enc32" testEnc32,
|
||||||
TestLabel "Test dec32" testDec32,
|
TestLabel "Test dec32" testDec32,
|
||||||
TestLabel "Test enc16" testEnc16,
|
TestLabel "Test enc16" testEnc16,
|
||||||
|
|
Loading…
Reference in New Issue