diff --git a/test/Main.hs b/test/Main.hs index a49f8cf..93a2093 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -17,6 +17,8 @@ import Encoding.Base2 (enc2, dec2) import Encoding.QuotedPrintable (encqp, decqp) import Encoding.UnixToUnix (encuu, decuu) import Encoding.Xx (encxx, decxx) +import Encoding.Yenc (ency, decy) +import Encoding.Rotate (rotate) import System.Exit (exitFailure, exitSuccess) helloWorldBS :: B.ByteString @@ -218,6 +220,23 @@ testDecXx = TestCase $ do assertEqual "for (decxx \"NaxjMa3m\")," (BSU.fromString "foobar") (decxx $ BSU.fromString "NaxjMa3m") assertEqual "for (decxx \"w7yMUU\")," (BSU.fromString "😂") (decxx $ BSU.fromString "w7yMUU") +testEncYenc :: Test +testEncYenc = TestCase $ do + assertEqual "for (ency \"Hello, World!\")," (B.pack [114, 143, 150, 150, 153, 86, 74, 129, 153, 156, 150, 142, 75]) (ency helloWorldBS) + assertEqual "for (ency \"😂\")," (B.pack [26, 201, 194, 172] ) (ency emojiBS) + +testDecYenc:: Test +testDecYenc= TestCase $ do + assertEqual "for (decy \"r<8f><96><96><99>VJ<81><99><9c><96><8e>K\")," helloWorldBS (decy $ B.pack [114, 143, 150, 150, 153, 86, 74, 129, 153, 156, 150, 142, 75] ) + assertEqual "for (decy \"^Z¬\")," (BSU.fromString "😂") (decy $ B.pack [26, 201, 194, 172]) + +testRotate :: Test +testRotate = TestCase $ do + assertEqual "for (rotate 13 \"Hello, World!\")," (BSU.fromString "Uryyb, Jbeyq!") (rotate 13 (BSU.fromString "Hello, World!")) + assertEqual "for (rotate 8 \"Hello, World!\")," (BSU.fromString "Pmttw, Ewztl!") (rotate 8 (BSU.fromString "Hello, World!")) + assertEqual "for (rotate 2 \"😂\")," (BSU.fromString "😂") (rotate 2 (BSU.fromString "😂")) + + tests :: Test tests = TestList [TestLabel "Test enc91" testEnc91, TestLabel "Test dec91" testDec91, @@ -248,7 +267,9 @@ tests = TestList [TestLabel "Test enc91" testEnc91, TestLabel "Test decuu" testDecUu, TestLabel "Test encuu" testEncUu, TestLabel "Test decuu" testDecXx, - TestLabel "Test encuu" testEncXx] + TestLabel "Test encuu" testEncXx, + TestLabel "Test ency" testEncYenc, + TestLabel "Test rot" testRotate] -- main :: IO Counts