]> gitweb.michael.orlitzky.com - hath.git/blobdiff - src/Octet.hs
Use test-framework for the tests, and bump some dependencies.
[hath.git] / src / Octet.hs
index 2e372fd4a489c14963508328253e466903d0e333..78413e619bf3035b33639aa78bf962d6ca5fea81 100644 (file)
@@ -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 ]