@@ -8,51 +8,52 @@ import Data.Word
8import qualified Data.UUID.Types as U
8import qualified Data.UUID.Types as U
9import Foreign (alloca, peek, poke)
9import Foreign (alloca, peek, poke)
10import System.IO.Unsafe (unsafePerformIO)
10import System.IO.Unsafe (unsafePerformIO)
11−import qualified Test.HUnit as H
11+
12−import Test.HUnit hiding (Test)
13import Test.QuickCheck hiding ((.&.))
12import Test.QuickCheck hiding ((.&.))
14−import Test.Framework (defaultMain, Test)
14+import Test.Tasty ( defaultMain, TestTree, testGroup )
15−import Test.Framework.Providers.HUnit (hUnitTestToTests)
15+import Test.Tasty.HUnit
16−import Test.Framework.Providers.QuickCheck2 (testProperty)
16+import Test.Tasty.QuickCheck
19instance Arbitrary U.UUID where
19instance Arbitrary U.UUID where
20 -- the UUID random instance ignores bounds
20 -- the UUID random instance ignores bounds
21 arbitrary = choose (U.nil, U.nil)
21 arbitrary = choose (U.nil, U.nil)
24−test_null :: H.Test
25+test_null :: Test
25−test_null = H.TestList [
26+test_null =
27+ testCase "nil is null" $
26− "nil is null" ~: assertBool "" (U.null U.nil)
28+ assertBool "" (U.null U.nil)
29−test_nil :: H.Test
30+test_nil :: Test
30−test_nil = H.TestList [
31+test_nil = testGroup "nil" [
31− "nil string" ~: U.toString U.nil @?= "00000000-0000-0000-0000-000000000000",
32+ testCase "nil string" $ U.toString U.nil @?= "00000000-0000-0000-0000-000000000000",
32− "nil bytes" ~: U.toByteString U.nil @?= BL.pack (replicate 16 0)
33+ testCase "nil bytes" $ U.toByteString U.nil @?= BL.pack (replicate 16 0)
35−test_conv :: H.Test
36+test_conv :: Test
36−test_conv = H.TestList [
37+test_conv = testGroup "conversions" [
37− "conv bytes to string" ~:
38+ testCase "conv bytes to string" $
38 maybe "" (U.toString) (U.fromByteString b16) @?= s16,
39 maybe "" (U.toString) (U.fromByteString b16) @?= s16,
39− "conv string to bytes" ~:
40+ testCase "conv string to bytes" $
40 maybe BL.empty (U.toByteString) (U.fromString s16) @?= b16
41 maybe BL.empty (U.toByteString) (U.fromString s16) @?= b16
42 where b16 = BL.pack [1..16]
43 where b16 = BL.pack [1..16]
43 s16 = "01020304-0506-0708-090a-0b0c0d0e0f10"
44 s16 = "01020304-0506-0708-090a-0b0c0d0e0f10"
45-- | Test fromByteString with a fixed-input.
46-- | Test fromByteString with a fixed-input.
46−test_fromByteString :: H.Test
47+test_fromByteString :: Test
47test_fromByteString =
48test_fromByteString =
48− "UUID fromByteString" ~:
49+ testCase "UUID fromByteString" $
49 Just inputUUID @=?
50 Just inputUUID @=?
50 U.fromByteString (BL8.pack "\165\202\133f\217\197H5\153\200\225\241>s\181\226")
51 U.fromByteString (BL8.pack "\165\202\133f\217\197H5\153\200\225\241>s\181\226")
52-- | Test fromWords with a fixed-input
53-- | Test fromWords with a fixed-input
53−test_fromWords :: H.Test
54+test_fromWords :: Test
54test_fromWords =
55test_fromWords =
55− "UUID fromWords" ~:
56+ testCase "UUID fromWords" $
56 inputUUID @=? U.fromWords 2781513062 3653584949 2580079089 1047770594
57 inputUUID @=? U.fromWords 2781513062 3653584949 2580079089 1047770594
58inputUUID :: U.UUID
59inputUUID :: U.UUID
@@ -144,8 +145,9 @@ prop_storableRoundTrip =
144main :: IO ()
145main :: IO ()
146 defaultMain $
147 defaultMain $
148− [ hUnitTestToTests $ H.TestList [
150+ [ [
149 test_null,
151 test_null,
150 test_nil,
152 test_nil,
151 test_conv,
153 test_conv,