import FuncTorrent.Bencode (encode, decode, BVal(..))
-import Test.Tasty (TestTree, testGroup)
-import Test.Tasty.QuickCheck (testProperty)
+import Test.Hspec
+import Test.QuickCheck
+import Data.ByteString.Char8 (unpack, pack)
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]
+tests :: IO ()
+tests = hspec $ do
+ describe "BVal tests" $ do
+ it "encode/decode" $ do
+ property $ \bval ->
+ let encoded = encode bval
+ decoded = decode encoded
+ in Right bval == decoded