main = defaultMain $ Group "foundation"
    [ Group "Numerical"
        [ Group "Int"
            [ testAdditive (Proxy :: Proxy Int)
            ]
        , Group "Word64"
            [ testAdditive (Proxy :: Proxy Word64)
            ]
        , Group "Number" testNumberRefs
        ]
    , Basement.tests
    , Bits.tests
    , Group "String"
        [ Group "reading"
            [ Group "integer"
                [ Property "empty"         $ readInteger "" === Nothing
                , Property "just-sign"     $ readInteger "-" === Nothing
                , Property "extra-content" $ readInteger "-123a" === Nothing
                , Property "any"           $ \i -> readInteger (show i) === Just i
                ]
            , Group "floating-exact"
                [ Property "empty"         $ readFloatingExact' "" === Nothing
                , Property "just-sign"     $ readFloatingExact' "-" === Nothing
                , Property "extra-content" $ readFloatingExact' "-123a" === Nothing
                , Property "no-dot-after"  $ readFloatingExact' "-123." === Nothing
                , Property "case0"         $ readFloatingExact' "124890" === Just (False, 124890, 0, Nothing)
                , Property "case1"         $ readFloatingExact' "-123.1" === Just (True, 1231, 1, Nothing)
                , Property "case2"         $ readFloatingExact' "10001.001" === Just (False, 10001001, 3, Nothing)
{-
                , Property "any"           $ \s i (v :: Word8) n ->
                                                let (integral,floating) = i `divMod` (10^v)
                                                let vw = integralUpsize v :: Word
                                                    sfloat = show n
                                                    digits = integralCast (length sfloat) + vw
                                                 in readFloatingExact' ((if s then "-" else "") <> show i <> "." <> replicate vw '0' <> sfloat) === Just (s, i, Just (digits, n), Nothing)
-}
                ]
            , Group "Double"
                [ Property "case1" $ readDouble "96152.5" === Just 96152.5
                , Property "case2" $ maybe (propertyFail "Nothing") (doubleEqualApprox 1.2300000000000002e102) $ readDouble "1.2300000000000002e102"
                , Property "case3" $ maybe (propertyFail "Nothing") (doubleEqualApprox 0.00001204) $ readDouble "0.00001204"
                , Property "case4" $ maybe (propertyFail "Nothing") (doubleEqualApprox 2.5e12) $ readDouble "2.5e12"
                , Property "case5" $ maybe (propertyFail "Nothing") (doubleEqualApprox 6.0e-4) $ readDouble "6.0e-4"
                , Property "case6" $ maybe (propertyFail "Nothing") ((===) (-31.548)) $ readDouble "-31.548"
                , Property "case7" $ readDouble "1e100000000" === Just (1/0)
                , Property "Prelude.read" $ \(d :: Double) -> case readDouble (show d) of
                                                                  Nothing -> propertyFail "Nothing"
                                                                  Just d' -> d' `doubleEqualApprox` (Prelude.read $ toList $ show d)
                ]
            , Group "rational"
                [ Property "case1" $ readRational "124.098" === Just (124098 % 1000)
                ]
            ]
        , Group "conversion"
            [ Property "lower" $ lower "This is MY test" === "this is my test"
            , Property "upper" $ upper "This is MY test" === "THIS IS MY TEST"
            ]
        ]
    , collectionProperties "DList a" (Proxy :: Proxy (DList Word8)) arbitrary
    , collectionProperties "Bitmap"  (Proxy :: Proxy Bitmap)  arbitrary
    , Group "Array"
      [ matrixToGroup "Block" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Block " <> s) (functorProxy (Proxy :: Proxy Block) prx) arb
      , matrixToGroup "Unboxed" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Unboxed " <> s) (functorProxy (Proxy :: Proxy UArray) prx) arb
      , Group "Boxed"
        [ collectionProperties "Array(W8)"  (Proxy :: Proxy (Array Word8))  arbitrary
        , collectionProperties "Array(W16)" (Proxy :: Proxy (Array Word16)) arbitrary
        , collectionProperties "Array(W32)" (Proxy :: Proxy (Array Word32)) arbitrary
        , collectionProperties "Array(W64)" (Proxy :: Proxy (Array Word64)) arbitrary
        , collectionProperties "Array(I8)"  (Proxy :: Proxy (Array Int8))   arbitrary
        , collectionProperties "Array(I16)" (Proxy :: Proxy (Array Int16))  arbitrary
        , collectionProperties "Array(I32)" (Proxy :: Proxy (Array Int32))  arbitrary
        , collectionProperties "Array(I64)" (Proxy :: Proxy (Array Int64))  arbitrary
        , collectionProperties "Array(F32)" (Proxy :: Proxy (Array Float))  arbitrary
        , collectionProperties "Array(F64)" (Proxy :: Proxy (Array Double)) arbitrary
        , collectionProperties "Array(Int)" (Proxy :: Proxy (Array Int))  arbitrary
        , collectionProperties "Array(Int,Int)" (Proxy :: Proxy (Array (Int,Int)))  arbitrary
        , collectionProperties "Array(Integer)" (Proxy :: Proxy (Array Integer)) arbitrary
        , collectionProperties "Array(CChar)"   (Proxy :: Proxy (Array CChar))  (CChar <$> arbitrary)
        , collectionProperties "Array(CUChar)"  (Proxy :: Proxy (Array CUChar)) (CUChar <$> arbitrary)
        , collectionProperties "Array(BE W16)"  (Proxy :: Proxy (Array (BE Word16))) (toBE <$> arbitrary)
        , collectionProperties "Array(BE W32)"  (Proxy :: Proxy (Array (BE Word32))) (toBE <$> arbitrary)
        , collectionProperties "Array(BE W64)"  (Proxy :: Proxy (Array (BE Word64))) (toBE <$> arbitrary)
        , collectionProperties "Array(LE W16)"  (Proxy :: Proxy (Array (LE Word16))) (toLE <$> arbitrary)
        , collectionProperties "Array(LE W32)"  (Proxy :: Proxy (Array (LE Word32))) (toLE <$> arbitrary)
        , collectionProperties "Array(LE W64)"  (Proxy :: Proxy (Array (LE Word64))) (toLE <$> arbitrary)
        ]
      ]
    , Group "ChunkedUArray"
      [ matrixToGroup "Unboxed" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Unboxed " <> s) (functorProxy (Proxy :: Proxy ChunkedUArray) prx) arb
      ]
    , testStringRefs
    , testForeignStorableRefs
    , testNetworkIPv4
    , testNetworkIPv6
    , testBase64Refs
    , testHexadecimal
    , testUUID
    , testRandom
    , testConduit
#if MIN_VERSION_base(4,9,0)
    , testBlockN
#endif
    , testFormat
    ]
main = defaultMain $ Group "foundation"
    [ Group "Numerical"
        [ Group "Int"
            [ testAdditive (Proxy :: Proxy Int)
            ]
        , Group "Word64"
            [ testAdditive (Proxy :: Proxy Word64)
            ]
        , Group "Number" testNumberRefs
        ]
    , Basement.tests
    , Bits.tests
    , Group "String"
        [ Group "reading"
            [ Group "integer"
                [ Property "empty"         $ readInteger "" === Nothing
                , Property "just-sign"     $ readInteger "-" === Nothing
                , Property "extra-content" $ readInteger "-123a" === Nothing
                , Property "any"           $ \i -> readInteger (show i) === Just i
                ]
            , Group "floating-exact"
                [ Property "empty"         $ readFloatingExact' "" === Nothing
                , Property "just-sign"     $ readFloatingExact' "-" === Nothing
                , Property "extra-content" $ readFloatingExact' "-123a" === Nothing
                , Property "no-dot-after"  $ readFloatingExact' "-123." === Nothing
                , Property "case0"         $ readFloatingExact' "124890" === Just (False, 124890, 0, Nothing)
                , Property "case1"         $ readFloatingExact' "-123.1" === Just (True, 1231, 1, Nothing)
                , Property "case2"         $ readFloatingExact' "10001.001" === Just (False, 10001001, 3, Nothing)
{-
                , Property "any"           $ \s i (v :: Word8) n ->
                                                let (integral,floating) = i `divMod` (10^v)
                                                let vw = integralUpsize v :: Word
                                                    sfloat = show n
                                                    digits = integralCast (length sfloat) + vw
                                                 in readFloatingExact' ((if s then "-" else "") <> show i <> "." <> replicate vw '0' <> sfloat) === Just (s, i, Just (digits, n), Nothing)
-}
                ]
            , Group "Double"
                [ Property "case1" $ readDouble "96152.5" === Just 96152.5
                , Property "case2" $ maybe (propertyFail "Nothing") (doubleEqualApprox 1.2300000000000002e102) $ readDouble "1.2300000000000002e102"
                , Property "case3" $ maybe (propertyFail "Nothing") (doubleEqualApprox 0.00001204) $ readDouble "0.00001204"
                , Property "case4" $ maybe (propertyFail "Nothing") (doubleEqualApprox 2.5e12) $ readDouble "2.5e12"
                , Property "case5" $ maybe (propertyFail "Nothing") (doubleEqualApprox 6.0e-4) $ readDouble "6.0e-4"
                , Property "case6" $ maybe (propertyFail "Nothing") ((===) (-31.548)) $ readDouble "-31.548"
                , Property "case7" $ readDouble "1e100000000" === Just (1/0)
                , Property "Prelude.read" $ \(d :: Double) -> case readDouble (show d) of
                                                                  Nothing -> propertyFail "Nothing"
                                                                  Just d' -> d' `doubleEqualApprox` (Prelude.read $ toList $ show d)
                ]
            , Group "rational"
                [ Property "case1" $ readRational "124.098" === Just (124098 % 1000)
                ]
            ]
        , Group "conversion"
            [ Property "lower" $ lower "This is MY test" === "this is my test"
            , Property "upper" $ upper "This is MY test" === "THIS IS MY TEST"
            ]
        ]
    , collectionProperties "DList a" (Proxy :: Proxy (DList Word8)) arbitrary
    , collectionProperties "Bitmap"  (Proxy :: Proxy Bitmap)  arbitrary
    , Group "Array"
      [ matrixToGroup "Block" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Block " <> s) (functorProxy (Proxy :: Proxy Block) prx) arb
      , matrixToGroup "Unboxed" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Unboxed " <> s) (functorProxy (Proxy :: Proxy UArray) prx) arb
      , Group "Boxed"
        [ collectionProperties "Array(W8)"  (Proxy :: Proxy (Array Word8))  arbitrary
        , collectionProperties "Array(W16)" (Proxy :: Proxy (Array Word16)) arbitrary
        , collectionProperties "Array(W32)" (Proxy :: Proxy (Array Word32)) arbitrary
        , collectionProperties "Array(W64)" (Proxy :: Proxy (Array Word64)) arbitrary
        , collectionProperties "Array(I8)"  (Proxy :: Proxy (Array Int8))   arbitrary
        , collectionProperties "Array(I16)" (Proxy :: Proxy (Array Int16))  arbitrary
        , collectionProperties "Array(I32)" (Proxy :: Proxy (Array Int32))  arbitrary
        , collectionProperties "Array(I64)" (Proxy :: Proxy (Array Int64))  arbitrary
        , collectionProperties "Array(F32)" (Proxy :: Proxy (Array Float))  arbitrary
        , collectionProperties "Array(F64)" (Proxy :: Proxy (Array Double)) arbitrary
        , collectionProperties "Array(Int)" (Proxy :: Proxy (Array Int))  arbitrary
        , collectionProperties "Array(Int,Int)" (Proxy :: Proxy (Array (Int,Int)))  arbitrary
        , collectionProperties "Array(Integer)" (Proxy :: Proxy (Array Integer)) arbitrary
        , collectionProperties "Array(CChar)"   (Proxy :: Proxy (Array CChar))  (CChar <$> arbitrary)
        , collectionProperties "Array(CUChar)"  (Proxy :: Proxy (Array CUChar)) (CUChar <$> arbitrary)
        , collectionProperties "Array(BE W16)"  (Proxy :: Proxy (Array (BE Word16))) (toBE <$> arbitrary)
        , collectionProperties "Array(BE W32)"  (Proxy :: Proxy (Array (BE Word32))) (toBE <$> arbitrary)
        , collectionProperties "Array(BE W64)"  (Proxy :: Proxy (Array (BE Word64))) (toBE <$> arbitrary)
        , collectionProperties "Array(LE W16)"  (Proxy :: Proxy (Array (LE Word16))) (toLE <$> arbitrary)
        , collectionProperties "Array(LE W32)"  (Proxy :: Proxy (Array (LE Word32))) (toLE <$> arbitrary)
        , collectionProperties "Array(LE W64)"  (Proxy :: Proxy (Array (LE Word64))) (toLE <$> arbitrary)
        ]
      ]
    , Group "ChunkedUArray"
      [ matrixToGroup "Unboxed" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Unboxed " <> s) (functorProxy (Proxy :: Proxy ChunkedUArray) prx) arb
      ]
    , testStringRefs
    , testForeignStorableRefs
    , testNetworkIPv4
    , testNetworkIPv6
    , testBase64Refs
    , testHexadecimal
    , testUUID
    , testRandom
    , testConduit
#if MIN_VERSION_base(4,9,0)
    , testBlockN
#endif
    , testFormat
    ]
main = defaultMain $ Group "foundation"
    [ Group "Numerical"
        [ Group "Int"
            [ testAdditive (Proxy :: Proxy Int)
            ]
        , Group "Word64"
            [ testAdditive (Proxy :: Proxy Word64)
            ]
        , Group "Number" testNumberRefs
        ]
    , Basement.tests
    , Bits.tests
    , Group "String"
        [ Group "reading"
            [ Group "integer"
                [ Property "empty"         $ readInteger "" === Nothing
                , Property "just-sign"     $ readInteger "-" === Nothing
                , Property "extra-content" $ readInteger "-123a" === Nothing
                , Property "any"           $ \i -> readInteger (show i) === Just i
                ]
            , Group "floating-exact"
                [ Property "empty"         $ readFloatingExact' "" === Nothing
                , Property "just-sign"     $ readFloatingExact' "-" === Nothing
                , Property "extra-content" $ readFloatingExact' "-123a" === Nothing
                , Property "no-dot-after"  $ readFloatingExact' "-123." === Nothing
                , Property "case0"         $ readFloatingExact' "124890" === Just (False, 124890, 0, Nothing)
                , Property "case1"         $ readFloatingExact' "-123.1" === Just (True, 1231, 1, Nothing)
                , Property "case2"         $ readFloatingExact' "10001.001" === Just (False, 10001001, 3, Nothing)
{-
                , Property "any"           $ \s i (v :: Word8) n ->
                                                let (integral,floating) = i `divMod` (10^v)
                                                let vw = integralUpsize v :: Word
                                                    sfloat = show n
                                                    digits = integralCast (length sfloat) + vw
                                                 in readFloatingExact' ((if s then "-" else "") <> show i <> "." <> replicate vw '0' <> sfloat) === Just (s, i, Just (digits, n), Nothing)
-}
                ]
            , Group "Double"
                [ Property "case1" $ readDouble "96152.5" === Just 96152.5
                , Property "case2" $ maybe (propertyFail "Nothing") (doubleEqualApprox 1.2300000000000002e102) $ readDouble "1.2300000000000002e102"
                , Property "case3" $ maybe (propertyFail "Nothing") (doubleEqualApprox 0.00001204) $ readDouble "0.00001204"
                , Property "case4" $ maybe (propertyFail "Nothing") (doubleEqualApprox 2.5e12) $ readDouble "2.5e12"
                , Property "case5" $ maybe (propertyFail "Nothing") (doubleEqualApprox 6.0e-4) $ readDouble "6.0e-4"
                , Property "case6" $ maybe (propertyFail "Nothing") ((===) (-31.548)) $ readDouble "-31.548"
                , Property "case7" $ readDouble "1e100000000" === Just (1/0)
                , Property "Prelude.read" $ \(d :: Double) -> case readDouble (show d) of
                                                                  Nothing -> propertyFail "Nothing"
                                                                  Just d' -> d' `doubleEqualApprox` (Prelude.read $ toList $ show d)
                ]
            , Group "rational"
                [ Property "case1" $ readRational "124.098" === Just (124098 % 1000)
                ]
            ]
        , Group "conversion"
            [ Property "lower" $ lower "This is MY test" === "this is my test"
            , Property "upper" $ upper "This is MY test" === "THIS IS MY TEST"
            ]
        ]
    , collectionProperties "DList a" (Proxy :: Proxy (DList Word8)) arbitrary
    , collectionProperties "Bitmap"  (Proxy :: Proxy Bitmap)  arbitrary
    , Group "Array"
      [ matrixToGroup "Block" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Block " <> s) (functorProxy (Proxy :: Proxy Block) prx) arb
      , matrixToGroup "Unboxed" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Unboxed " <> s) (functorProxy (Proxy :: Proxy UArray) prx) arb
      , Group "Boxed"
        [ collectionProperties "Array(W8)"  (Proxy :: Proxy (Array Word8))  arbitrary
        , collectionProperties "Array(W16)" (Proxy :: Proxy (Array Word16)) arbitrary
        , collectionProperties "Array(W32)" (Proxy :: Proxy (Array Word32)) arbitrary
        , collectionProperties "Array(W64)" (Proxy :: Proxy (Array Word64)) arbitrary
        , collectionProperties "Array(I8)"  (Proxy :: Proxy (Array Int8))   arbitrary
        , collectionProperties "Array(I16)" (Proxy :: Proxy (Array Int16))  arbitrary
        , collectionProperties "Array(I32)" (Proxy :: Proxy (Array Int32))  arbitrary
        , collectionProperties "Array(I64)" (Proxy :: Proxy (Array Int64))  arbitrary
        , collectionProperties "Array(F32)" (Proxy :: Proxy (Array Float))  arbitrary
        , collectionProperties "Array(F64)" (Proxy :: Proxy (Array Double)) arbitrary
        , collectionProperties "Array(Int)" (Proxy :: Proxy (Array Int))  arbitrary
        , collectionProperties "Array(Int,Int)" (Proxy :: Proxy (Array (Int,Int)))  arbitrary
        , collectionProperties "Array(Integer)" (Proxy :: Proxy (Array Integer)) arbitrary
        , collectionProperties "Array(CChar)"   (Proxy :: Proxy (Array CChar))  (CChar <$> arbitrary)
        , collectionProperties "Array(CUChar)"  (Proxy :: Proxy (Array CUChar)) (CUChar <$> arbitrary)
        , collectionProperties "Array(BE W16)"  (Proxy :: Proxy (Array (BE Word16))) (toBE <$> arbitrary)
        , collectionProperties "Array(BE W32)"  (Proxy :: Proxy (Array (BE Word32))) (toBE <$> arbitrary)
        , collectionProperties "Array(BE W64)"  (Proxy :: Proxy (Array (BE Word64))) (toBE <$> arbitrary)
        , collectionProperties "Array(LE W16)"  (Proxy :: Proxy (Array (LE Word16))) (toLE <$> arbitrary)
        , collectionProperties "Array(LE W32)"  (Proxy :: Proxy (Array (LE Word32))) (toLE <$> arbitrary)
        , collectionProperties "Array(LE W64)"  (Proxy :: Proxy (Array (LE Word64))) (toLE <$> arbitrary)
        ]
      ]
    , Group "ChunkedUArray"
      [ matrixToGroup "Unboxed" $ primTypesMatrixArbitrary $ \prx arb s ->
            collectionProperties ("Unboxed " <> s) (functorProxy (Proxy :: Proxy ChunkedUArray) prx) arb
      ]
    , testStringRefs
    , testForeignStorableRefs
    , testNetworkIPv4
    , testNetworkIPv6
    , testBase64Refs
    , testHexadecimal
    , testUUID
    , testRandom
    , testConduit
#if MIN_VERSION_base(4,9,0)
    , testBlockN
#endif
    , testFormat
    ]