1import qualified Data.ByteString.Lazy as B
3import qualified Data.UUID as U
4import qualified Data.UUID.V5 as U
11instance Arbitrary U.UUID where
12 arbitrary = (fst . random) `fmap` rand
13 coarbitrary = undefined
16 "nil is null" ~: assertBool "" (U.null U.nil),
17 "namespaceDNS is not null" ~: assertBool "" (not $ U.null U.namespaceDNS)
21 "nil string" ~: U.toString U.nil @?= "00000000-0000-0000-0000-000000000000",
22 "nil bytes" ~: U.toByteString U.nil @?= B.pack (replicate 16 0)
26 "conv bytes to string" ~:
27 maybe "" (U.toString) (U.fromByteString b16) @?= s16,
28 "conv string to bytes" ~:
29 maybe B.empty (U.toByteString) (U.fromString s16) @?= b16
31 where b16 = B.pack [1..16]
32 s16 = "01020304-0506-0708-090a-0b0c0d0e0f10"
34prop_stringRoundTrip = label "String round trip" stringRoundTrip
35 where stringRoundTrip :: U.UUID -> Bool
36 stringRoundTrip u = maybe False (== u) $ U.fromString (U.toString u)
38prop_byteStringRoundTrip = label "ByteString round trip" byteStringRoundTrip
39 where byteStringRoundTrip :: U.UUID -> Bool
40 byteStringRoundTrip u = maybe False (== u)
41 $ U.fromByteString (U.toByteString u)
43prop_stringLength = label "String length" stringLength
44 where stringLength :: U.UUID -> Bool
45 stringLength u = length (U.toString u) == 36
47prop_byteStringLength = label "ByteString length" byteStringLength
48 where byteStringLength :: U.UUID -> Bool
49 byteStringLength u = B.length (U.toByteString u) == 16
54 runTestText (putTextToHandle stderr False) (TestList [
61 prop_byteStringRoundTrip,
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list