@@ -1,3 +1,4 @@
1+{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE ViewPatterns #-}
2{-# LANGUAGE ViewPatterns #-}
2import Control.Monad (replicateM)
3import Control.Monad (replicateM)
3import Data.Bits
4import Data.Bits
@@ -82,6 +83,22 @@ test_v5 = H.TestList [
82 where name = map (fromIntegral . ord) "www.widgets.com" :: [Word8]
83 where name = map (fromIntegral . ord) "www.widgets.com" :: [Word8]
83 uV5 = fromJust $ U.fromString "21f7f8de-8051-5b89-8680-0195ef798b6a"
84 uV5 = fromJust $ U.fromString "21f7f8de-8051-5b89-8680-0195ef798b6a"
87+-- | Test fromByteString with a fixed-input.
88+test_fromByteString :: H.Test
90+ "UUID fromByteString" ~:
91+ Just inputUUID @=? U.fromByteString "\165\202\133f\217\197H5\153\200\225\241>s\181\226"
93+-- | Test fromWords with a fixed-input
94+test_fromWords :: H.Test
97+ inputUUID @=? U.fromWords 2781513062 3653584949 2580079089 1047770594
100+inputUUID = read "a5ca8566-d9c5-4835-99c8-e1f13e73b5e2"
85prop_stringRoundTrip :: Test
102prop_stringRoundTrip :: Test
86prop_stringRoundTrip = testProperty "String round trip" stringRoundTrip
103prop_stringRoundTrip = testProperty "String round trip" stringRoundTrip
87 where stringRoundTrip :: U.UUID -> Bool
104 where stringRoundTrip :: U.UUID -> Bool
@@ -201,7 +218,9 @@ main = do
201 test_conv,
218 test_conv,
202 test_v1 v1s,
219 test_v1 v1s,
204− test_v5
221+ test_v5,
222+ test_fromByteString,
206 , [ prop_stringRoundTrip,
225 , [ prop_stringRoundTrip,
207 prop_readShowRoundTrip,
226 prop_readShowRoundTrip,