summaryrefslogtreecommitdiff
path: root/test/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/Main.hs')
-rw-r--r--test/Main.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/Main.hs b/test/Main.hs
index cc17b5d..d4a835f 100644
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -164,7 +164,7 @@ genShape = \n tpl -> do
sh <- genShapeNaive n tpl
let sz = shapeSize sh
factor = sz `div` 100 + 1
- return (shapeDiv sh factor)
+ return (shapeDiv sh tpl factor)
where
genShapeNaive :: SNat n -> DimNames n -> StateT (Map String Int) Gen (Shape n)
genShapeNaive SZ () = return ShNil
@@ -181,11 +181,12 @@ genShape = \n tpl -> do
Just dim -> return dim
genDim :: Int -> StateT (Map String Int) Gen Int
- genDim lo = Gen.integral (Range.linear lo 10)
+ genDim lo = Gen.integral (Range.linear lo (lo+10))
- shapeDiv :: Shape n -> Int -> Shape n
- shapeDiv ShNil _ = ShNil
- shapeDiv (sh `ShCons` n) f = shapeDiv sh f `ShCons` (n `div` f)
+ shapeDiv :: Shape n -> DimNames n -> Int -> Shape n
+ shapeDiv ShNil _ _ = ShNil
+ shapeDiv (ShNil `ShCons` n) (C _ lo) f = ShNil `ShCons` (max lo (n `div` f))
+ shapeDiv (sh@ShCons{} `ShCons` n) (tpl :$ C _ lo) f = shapeDiv sh tpl f `ShCons` (max lo (n `div` f))
genArray :: STy a -> Shape n -> Gen (Value (TArr n a))
genArray t sh =