--- /dev/null
+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]
import Test.Tasty (TestTree, testGroup, defaultMain)
import Test.Tasty.HUnit (testCase, (@?=))
-import Test.Tasty.QuickCheck (testProperty)
import FuncTorrent.Bencode (encode, decode, BVal(..))
import FuncTorrent.Metainfo (Info(..), Metainfo(..), mkMetaInfo)
import FuncTorrent.Peer (Peer(..))
import FuncTorrent.Tracker
+import qualified BencodeTests
+
-- Parsed .torrent file
file :: BVal
file = Bdict (fromList [
unitTests = testGroup "Unit tests" [testFile, testMkMetaInfo, testResponse1,
testResponse2]
-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" [unitTests, qcTests]
+tests = testGroup "Tests" [unitTests, BencodeTests.tests]
main :: IO ()
main = defaultMain tests