File: Tests.hs

package info (click to toggle)
haskell-quickcheck-instances 0.3.30-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: haskell: 1,071; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 830 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{-# LANGUAGE CPP #-}
module Main (main) where

import Data.Proxy (Proxy (..))
import Test.QuickCheck
import Test.QuickCheck.Instances ()

import qualified Data.Tree as Tree
import qualified Data.Primitive as Prim

import           Data.UUID.Types (UUID)

#if MIN_VERSION_base(4,9,0)
import qualified Data.Array.Byte as AB
#endif

-- | Example law: == (and thus ===) should be reflexive.
eqReflexive
    :: (Eq a, Show a)
    => Proxy a
    -> a
    -> Property
eqReflexive _ x = x === x

main :: IO ()
main = do
    quickCheck $ eqReflexive (Proxy :: Proxy Int)
    quickCheck $ eqReflexive (Proxy :: Proxy (Tree.Tree Int))
    quickCheck $ eqReflexive (Proxy :: Proxy UUID)
    quickCheck $ eqReflexive (Proxy :: Proxy Prim.ByteArray)
#if MIN_VERSION_base(4,9,0)
    quickCheck $ eqReflexive (Proxy :: Proxy AB.ByteArray)
#endif