@@ -8,51 +8,52 @@ import Data.Word
88import qualified Data.UUID.Types as U
99import Foreign (alloca, peek, poke)
1010import System.IO.Unsafe (unsafePerformIO)
11−import qualified Test.HUnit as H
12−import Test.HUnit hiding (Test)
11+
1312import Test.QuickCheck hiding ((.&.))
14−import Test.Framework (defaultMain, Test)
15−import Test.Framework.Providers.HUnit (hUnitTestToTests)
16−import Test.Framework.Providers.QuickCheck2 (testProperty)
13+
14+import Test.Tasty ( defaultMain, TestTree, testGroup )
15+import Test.Tasty.HUnit
16+import Test.Tasty.QuickCheck
1717
1818
1919instance Arbitrary U.UUID where
2020 -- the UUID random instance ignores bounds
2121 arbitrary = choose (U.nil, U.nil)
2222
23+type Test = TestTree
2324
24−test_null :: H.Test
25−test_null = H.TestList [
26− "nil is null" ~: assertBool "" (U.null U.nil)
27− ]
25+test_null :: Test
26+test_null =
27+ testCase "nil is null" $
28+ assertBool "" (U.null U.nil)
2829
29−test_nil :: H.Test
30−test_nil = H.TestList [
31− "nil string" ~: U.toString U.nil @?= "00000000-0000-0000-0000-000000000000",
32− "nil bytes" ~: U.toByteString U.nil @?= BL.pack (replicate 16 0)
30+test_nil :: Test
31+test_nil = testGroup "nil" [
32+ testCase "nil string" $ U.toString U.nil @?= "00000000-0000-0000-0000-000000000000",
33+ testCase "nil bytes" $ U.toByteString U.nil @?= BL.pack (replicate 16 0)
3334 ]
3435
35−test_conv :: H.Test
36−test_conv = H.TestList [
37− "conv bytes to string" ~:
36+test_conv :: Test
37+test_conv = testGroup "conversions" [
38+ testCase "conv bytes to string" $
3839 maybe "" (U.toString) (U.fromByteString b16) @?= s16,
39− "conv string to bytes" ~:
40+ testCase "conv string to bytes" $
4041 maybe BL.empty (U.toByteString) (U.fromString s16) @?= b16
4142 ]
4243 where b16 = BL.pack [1..16]
4344 s16 = "01020304-0506-0708-090a-0b0c0d0e0f10"
4445
4546-- | Test fromByteString with a fixed-input.
46−test_fromByteString :: H.Test
47+test_fromByteString :: Test
4748test_fromByteString =
48− "UUID fromByteString" ~:
49+ testCase "UUID fromByteString" $
4950 Just inputUUID @=?
5051 U.fromByteString (BL8.pack "\165\202\133f\217\197H5\153\200\225\241>s\181\226")
5152
5253-- | Test fromWords with a fixed-input
53−test_fromWords :: H.Test
54+test_fromWords :: Test
5455test_fromWords =
55− "UUID fromWords" ~:
56+ testCase "UUID fromWords" $
5657 inputUUID @=? U.fromWords 2781513062 3653584949 2580079089 1047770594
5758
5859inputUUID :: U.UUID
@@ -144,8 +145,9 @@ prop_storableRoundTrip =
144145main :: IO ()
145146main = do
146147 defaultMain $
148+ testGroup "tests" $
147149 concat $
148− [ hUnitTestToTests $ H.TestList [
150+ [ [
149151 test_null,
150152 test_nil,
151153 test_conv,