]> git.rkrishnan.org Git - functorrent.git/blob - test/BencodeTests.hs
UDP Tracker: connect + announce. Does not work
[functorrent.git] / test / BencodeTests.hs
1 module BencodeTests (tests) where
2
3 import FuncTorrent.Bencode (encode, decode, BVal(..))
4
5 import Test.Tasty (TestTree, testGroup)
6 import Test.Tasty.QuickCheck (testProperty)
7
8 propEncodeDecode :: BVal -> Bool
9 propEncodeDecode bval = let encoded = encode bval
10                             decoded = decode encoded
11                         in Right bval == decoded
12
13 qcTests :: TestTree
14 qcTests = testGroup "QuickCheck tests" [ testProperty "encode/decode" propEncodeDecode ]
15
16 tests :: TestTree
17 tests = testGroup "Tests" [qcTests]