X-Git-Url: https://git.rkrishnan.org/?a=blobdiff_plain;f=test%2FBencodeTests.hs;h=6949e7958db4649a0216f5a41cba05fffdd215bc;hb=4861358f5573fb9ed27eda0dda72dd2ba1022e84;hp=8e54e93e1e431de55175092bad4e560eaa654b99;hpb=8dcb9c0c7d752fc9b6a76142064741c822d9d3a5;p=functorrent.git diff --git a/test/BencodeTests.hs b/test/BencodeTests.hs index 8e54e93..6949e79 100644 --- a/test/BencodeTests.hs +++ b/test/BencodeTests.hs @@ -1,3 +1,22 @@ +{- + - Copyright (C) 2015-2016 Ramakrishnan Muthukrishnan + - + - This file is part of FuncTorrent. + - + - FuncTorrent is free software; you can redistribute it and/or modify + - it under the terms of the GNU General Public License as published by + - the Free Software Foundation; either version 3 of the License, or + - (at your option) any later version. + - + - FuncTorrent is distributed in the hope that it will be useful, + - but WITHOUT ANY WARRANTY; without even the implied warranty of + - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + - GNU General Public License for more details. + - + - You should have received a copy of the GNU General Public License + - along with FuncTorrent; if not, see + -} + module BencodeTests (tests) where import FuncTorrent.Bencode (encode, decode, BVal(..)) @@ -14,23 +33,8 @@ propEncodeDecode bval = let encoded = encode bval tests :: IO () tests = hspec $ do describe "BVal tests" $ do - it "encode/decode bstr tests" $ do - property $ \s -> - let encoded = encode (Bstr s) - decoded = decode encoded - in Right (Bstr s) == decoded - it "encode/decode bint tests" $ do - property $ \i -> - let encoded = encode (Bint i) - decoded = decode encoded - in Right (Bint i) == decoded - it "encode/decode blist tests" $ do + it "encode/decode" $ do property $ \bval -> - let encoded = encode (Blist (take 1 bval)) + let encoded = encode bval decoded = decode encoded - in Right (Blist (take 1 bval)) == decoded - -- it "encode/decode" $ do - -- property $ \bval -> - -- let encoded = encode bval - -- decoded = decode encoded - -- in Right bval == decoded + in Right bval == decoded