38 lines
1.6 KiB
Haskell
38 lines
1.6 KiB
Haskell
{-# LANGUAGE Unsafe #-} -- unsafe: I am using TemplateHaskell from a dependency
|
|
{-# LANGUAGE TemplateHaskell #-} -- for 'quickCheckAll'
|
|
{-# OPTIONS_GHC -Wno-all-missed-specialisations #-} -- a lot of warnings for unspecialized 'read' and 'show', which I cannot specialize
|
|
-- I wouldn't know how at least, they're not my datatypes, I cannot use the hint and add an 'INLINABLE' pragma
|
|
module Test.Data.Map.Implicit (testGroup) where
|
|
|
|
import Data.Functor.Identity (Identity)
|
|
|
|
import Data.Map.Implicit (ImplicitMap)
|
|
|
|
import Language.Scalie.Core.Definition (Definition)
|
|
|
|
import Test.QuickCheck (Property, allProperties)
|
|
import Test.QuickCheck.Roundtrip (roundtrips)
|
|
|
|
import Test.Tasty (TestTree)
|
|
import Test.Tasty.QuickCheck (QuickCheckMaxSize(QuickCheckMaxSize))
|
|
|
|
import Test.Tasty qualified as Tasty
|
|
import Test.Tasty.QuickCheck qualified as Tasty.QuickCheck
|
|
import Test.Tasty.TH (moduleName)
|
|
|
|
-- | This is testworthy since I have somehow hand-hacked the read/show de/serialization of 'ImplicitMap'
|
|
|
|
prop_readShowIdentityRoundtrip :: ImplicitMap (Definition Identity) -> Bool
|
|
prop_readShowIdentityRoundtrip = roundtrips read show
|
|
|
|
prop_readShowMaybeRoundtrip :: ImplicitMap (Definition Maybe) -> Bool
|
|
prop_readShowMaybeRoundtrip = roundtrips read show
|
|
|
|
pure []
|
|
allTests :: [(String, Property)]
|
|
allTests = $allProperties
|
|
|
|
testGroup :: TestTree
|
|
testGroup = Tasty.localOption (QuickCheckMaxSize 5) -- anything above 25 doesn't finish in reasonable time on my laptop
|
|
$ Tasty.QuickCheck.testProperties $moduleName allTests
|
|
-- I don't want to stress-tess or bench-mark it, just prove it works cause I hacked a little around it.
|