]> git.rkrishnan.org Git - functorrent.git/blobdiff - test/BencodeTests.hs
WIP: split tests into their own modules
[functorrent.git] / test / BencodeTests.hs
diff --git a/test/BencodeTests.hs b/test/BencodeTests.hs
new file mode 100644 (file)
index 0000000..c83e9cc
--- /dev/null
@@ -0,0 +1,17 @@
+module BencodeTests (tests) where
+
+import FuncTorrent.Bencode (encode, decode, BVal(..))
+
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.QuickCheck (testProperty)
+
+propEncodeDecode :: BVal -> Bool
+propEncodeDecode bval = let encoded = encode bval
+                            decoded = decode encoded
+                        in Right bval == decoded
+
+qcTests :: TestTree
+qcTests = testGroup "QuickCheck tests" [ testProperty "encode/decode" propEncodeDecode ]
+
+tests :: TestTree
+tests = testGroup "Tests" [qcTests]