on master help sign in
Add common TH derived tests similar to the Generic derived tests
commit88448b6b776ae40636a8ba4beb029c391f70a107 authorAdithya Kumar <adithya@composewell.com> dateSat 29 Jul 2023, 00:05 (3 years ago) parent63407dc
2 files changed+11−8
test/Streamly/Test/Data/Unbox.hs+3−7 test/streamly-tests.cabal+8−1
test/Streamly/Test/Data/Unbox.hs+3−7
@@ -27,11 +27,9 @@ import Data.Proxy (Proxy(..))
2727import GHC.Generics (Generic, Rep(..))
2828import GHC.Real (Ratio(..))
2929
30−{-
31−XXX Will be added in the future
30+#ifdef USE_TH
3231import Streamly.Internal.Data.Unbox.TH
33−import Language.Haskell.TH
34−-}
32+#endif
3533
3634import Streamly.Internal.Data.Unbox
3735 ( PeekRep(..)
@@ -51,11 +49,9 @@ import Test.Hspec as H
5149-- Types
5250--------------------------------------------------------------------------------
5351
54−-- #define USE_TH
55−
5652#ifdef USE_TH
5753#define MODULE_NAME "Data.Unbox.Deriving.TH"
58−#define DERIVE_UNBOX(typ) $(makeUnbox ''typ)
54+#define DERIVE_UNBOX(typ) $(deriveUnbox ''typ)
5955#else
6056#define MODULE_NAME "Data.Unbox.Deriving.Generic"
6157#define DERIVE_UNBOX(typ) deriving instance Unbox (typ)
test/streamly-tests.cabal+8−1
@@ -263,12 +263,19 @@ test-suite Data.Ring.Unboxed
263263 if flag(use-streamly-core)
264264 buildable: False
265265
266−test-suite Data.Unbox
266+test-suite Data.Unbox.Derive.Generic
267267 import: test-options
268268 type: exitcode-stdio-1.0
269269 main-is: Streamly/Test/Data/Unbox.hs
270270 ghc-options: -main-is Streamly.Test.Data.Unbox.main
271271
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+
272279test-suite Data.Unbox.TH
273280 import: test-options
274281 type: exitcode-stdio-1.0