on master help sign in
Add common TH derived tests similar to the Generic derived tests
88448b6Adithya Kumar
test/Streamly/Test/Data/Unbox.hs+3−7
@@ -27,11 +27,9 @@ import Data.Proxy (Proxy(..))
27import GHC.Generics (Generic, Rep(..))
27import GHC.Generics (Generic, Rep(..))
28import GHC.Real (Ratio(..))
28import GHC.Real (Ratio(..))
29
29
30−{-
30+#ifdef USE_TH
31−XXX Will be added in the future
32import Streamly.Internal.Data.Unbox.TH
31import Streamly.Internal.Data.Unbox.TH
33−import Language.Haskell.TH
32+#endif
34−-}
35
33
36import Streamly.Internal.Data.Unbox
34import Streamly.Internal.Data.Unbox
37 ( PeekRep(..)
35 ( PeekRep(..)
@@ -51,11 +49,9 @@ import Test.Hspec as H
51-- Types
49-- Types
52--------------------------------------------------------------------------------
50--------------------------------------------------------------------------------
53
51
54−-- #define USE_TH
55−
56#ifdef USE_TH
52#ifdef USE_TH
57#define MODULE_NAME "Data.Unbox.Deriving.TH"
53#define MODULE_NAME "Data.Unbox.Deriving.TH"
58−#define DERIVE_UNBOX(typ) $(makeUnbox ''typ)
54+#define DERIVE_UNBOX(typ) $(deriveUnbox ''typ)
59#else
55#else
60#define MODULE_NAME "Data.Unbox.Deriving.Generic"
56#define MODULE_NAME "Data.Unbox.Deriving.Generic"
61#define DERIVE_UNBOX(typ) deriving instance Unbox (typ)
57#define DERIVE_UNBOX(typ) deriving instance Unbox (typ)
test/streamly-tests.cabal+8−1
@@ -263,12 +263,19 @@ test-suite Data.Ring.Unboxed
263 if flag(use-streamly-core)
263 if flag(use-streamly-core)
264 buildable: False
264 buildable: False
265
265
266−test-suite Data.Unbox
266+test-suite Data.Unbox.Derive.Generic
267 import: test-options
267 import: test-options
268 type: exitcode-stdio-1.0
268 type: exitcode-stdio-1.0
269 main-is: Streamly/Test/Data/Unbox.hs
269 main-is: Streamly/Test/Data/Unbox.hs
270 ghc-options: -main-is Streamly.Test.Data.Unbox.main
270 ghc-options: -main-is Streamly.Test.Data.Unbox.main
271
271
272+test-suite Data.Unbox.Derive.TH
273+ import: test-options
274+ type: exitcode-stdio-1.0
275+ cpp-options: -DUSE_TH
276+ main-is: Streamly/Test/Data/Unbox.hs
277+ ghc-options: -main-is Streamly.Test.Data.Unbox.main
278+
272test-suite Data.Unbox.TH
279test-suite Data.Unbox.TH
273 import: test-options
280 import: test-options
274 type: exitcode-stdio-1.0
281 type: exitcode-stdio-1.0