From 95e6eb45844b2318b1b7f0c9f8e7ce14f5262dd8 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 17 May 2025 11:12:13 +0200 Subject: test: Don't generate unreasonably large replicated arrays --- test/Tests/C.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/Tests') diff --git a/test/Tests/C.hs b/test/Tests/C.hs index 50e0e63..6881cd4 100644 --- a/test/Tests/C.hs +++ b/test/Tests/C.hs @@ -24,7 +24,7 @@ import Data.Array.Nested.Types (fromSNat') import Hedgehog import Hedgehog.Gen qualified as Gen -import Hedgehog.Internal.Property (forAllT) +import Hedgehog.Internal.Property (forAllT, LabelName (..)) import Hedgehog.Range qualified as Range import Test.Tasty import Test.Tasty.Hedgehog @@ -39,6 +39,9 @@ import Util fineTol :: Double fineTol = 1e-8 +debugCoverage :: Bool +debugCoverage = False + prop_sum_nonempty :: Property prop_sum_nonempty = property $ genRank $ \outrank@(SNat @n) -> do -- Test nonempty _results_. The first dimension of the input is allowed to be 0, because then OR.rerank doesn't fail yet. @@ -89,6 +92,10 @@ prop_sum_replicated doTranspose = property $ LTI -> return Refl -- actually we only continue if m < n _ -> discard (sh1, sh2, sh3) <- forAll $ genReplicatedShR inrank1 inrank2 + when debugCoverage $ do + label (LabelName ("rankdiff " ++ show (fromSNat' inrank2 - fromSNat' inrank1))) + label (LabelName ("size sh1 10^" ++ show (floor (logBase 10 (fromIntegral (shrSize sh1) :: Double)) :: Int))) + label (LabelName ("size sh3 10^" ++ show (floor (logBase 10 (fromIntegral (shrSize sh3) :: Double)) :: Int))) guard (all (> 0) sh3) arr <- forAllT $ OR.stretch (toList sh3) -- cgit v1.2.3-70-g09d2