X-Git-Url: http://gitweb.michael.orlitzky.com/?p=hath.git;a=blobdiff_plain;f=src%2FOctet.hs;h=78413e619bf3035b33639aa78bf962d6ca5fea81;hp=2e372fd4a489c14963508328253e466903d0e333;hb=d32fe2f0a6c83ba3046a405eda40f83c794c000d;hpb=22b9c60a6badcc6cb68902965d6f810634e30693 diff --git a/src/Octet.hs b/src/Octet.hs index 2e372fd..78413e6 100644 --- a/src/Octet.hs +++ b/src/Octet.hs @@ -2,8 +2,12 @@ module Octet where import Data.Maybe (fromJust) -import Test.HUnit -import Test.QuickCheck + +import Test.HUnit (assertEqual) +import Test.Framework (Test, testGroup) +import Test.Framework.Providers.HUnit (testCase) + +import Test.QuickCheck (Arbitrary(..), Gen) import Bit as B import Maskable @@ -128,37 +132,35 @@ max_octet = -- HUnit Tests test_octet_from_int1 :: Test test_octet_from_int1 = - TestCase $ assertEqual "octet_from_int 128 should parse as 10000000" oct1 oct2 + testCase desc $ assertEqual desc oct1 oct2 where + desc = "octet_from_int 128 should parse as 10000000" oct1 = Octet B.One B.Zero B.Zero B.Zero B.Zero B.Zero B.Zero B.Zero oct2 = fromJust $ octet_from_int 128 test_octet_mask1 :: Test test_octet_mask1 = - TestCase $ - assertEqual - "The network bits of 255/4 should equal 240" - oct2 - (apply_mask oct1 Four B.Zero) + testCase desc $ + assertEqual desc oct2 (apply_mask oct1 Four B.Zero) where + desc = "The network bits of 255/4 should equal 240" oct1 = fromJust $ octet_from_int 255 oct2 = fromJust $ octet_from_int 240 test_octet_mask2 :: Test test_octet_mask2 = - TestCase $ - assertEqual - "The network bits of 255/1 should equal 128" - oct2 - (apply_mask oct1 Maskbits.One B.Zero) + testCase desc $ + assertEqual desc oct2 (apply_mask oct1 Maskbits.One B.Zero) where + desc = "The network bits of 255/1 should equal 128" oct1 = fromJust $ octet_from_int 255 oct2 = fromJust $ octet_from_int 128 -octet_tests :: [Test] +octet_tests :: Test octet_tests = - [ test_octet_from_int1, + testGroup "Octet Tests" [ + test_octet_from_int1, test_octet_mask1, test_octet_mask2 ]