1 module BencodeTests (tests) where
3 import FuncTorrent.Bencode (encode, decode, BVal(..))
7 import Data.ByteString.Char8 (unpack, pack)
9 propEncodeDecode :: BVal -> Bool
10 propEncodeDecode bval = let encoded = encode bval
11 decoded = decode encoded
12 in Right bval == decoded
16 describe "BVal tests" $ do
17 it "encode/decode bstr tests" $ do
19 let encoded = encode (Bstr s)
20 decoded = decode encoded
21 in Right (Bstr s) == decoded
22 it "encode/decode bint tests" $ do
24 let encoded = encode (Bint i)
25 decoded = decode encoded
26 in Right (Bint i) == decoded
27 -- describe "Bencode property tests" $ do
28 -- it "encode/decode" $ do
29 -- property $ \bval ->
30 -- let encoded = encode bval
31 -- decoded = decode encoded
32 -- in Right bval == decoded