From 580792ddf6ded9b5b48a8533a13ac63b023700e0 Mon Sep 17 00:00:00 2001 From: Stefan Friese Date: Tue, 4 Jun 2024 17:09:18 +0200 Subject: [PATCH] added base45 tests --- based | 1 - test/Main.hs | 27 +++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) delete mode 120000 based diff --git a/based b/based deleted file mode 120000 index f124192..0000000 --- a/based +++ /dev/null @@ -1 +0,0 @@ -./dist-newstyle/build/aarch64-linux/ghc-9.4.8/based-0.4.3.0/x/based/build/based/based \ No newline at end of file diff --git a/test/Main.hs b/test/Main.hs index ec00ad9..d8359ae 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -2,6 +2,7 @@ module Main where import Test.HUnit import Encoding.Base64 (enc64, dec64) +import Encoding.Base45 (enc45, dec45) import Encoding.Base32 (enc32, dec32) import Encoding.Base16 (enc16, dec16) import Encoding.Base8 (enc8, dec8) @@ -24,12 +25,17 @@ testDec64 = TestCase $ do assertEqual "for (dec64 \"AAEC\")," "\x00\x01\x02" (dec64 "AAEC") assertEqual "for (dec64 \"8J+Ygg==\")," "😂" (dec64 "8J+Ygg==") -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=") +testEnc45 :: Test +testEnc45 = TestCase $ do + assertEqual "for (enc45 \"Hello, World!\")," "%69 VDK2E:3404ESVDX0" (enc45 "Hello, World!") + assertEqual "for (enc45 \"Haskell\")," "Y69RQE: CI2" (enc45 "Haskell") + assertEqual "for (enc45 \"😂\")," "*IURCJ" (enc45 "😂") + +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 = TestCase $ do @@ -37,6 +43,13 @@ testEnc32 = TestCase $ do assertEqual "for (enc32 \"Haskell\")," "JBQXG23FNRWA====" (enc32 "Haskell") 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 = TestCase $ do assertEqual "for (enc16 \"Hello, World!\")," "48656C6C6F2C20576F726C6421" (enc16 "Hello, World!") @@ -76,6 +89,8 @@ testDec2 = TestCase $ do tests :: Test tests = TestList [TestLabel "Test enc64" testEnc64, TestLabel "Test dec64" testDec64, + TestLabel "Test enc32" testEnc45, + TestLabel "Test dec32" testDec45, TestLabel "Test enc32" testEnc32, TestLabel "Test dec32" testDec32, TestLabel "Test enc16" testEnc16,