added test for rotate function and yencode/decode
This commit is contained in:
parent
5e4a146b4f
commit
63a0fd3c05
23
test/Main.hs
23
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<c9>¬\")," (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
|
||||
|
|
Loading…
Reference in New Issue