diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/Tests/C.hs | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/test/Tests/C.hs b/test/Tests/C.hs index 0530f53..97b425f 100644 --- a/test/Tests/C.hs +++ b/test/Tests/C.hs @@ -97,6 +97,17 @@ prop_sum_replicated doTranspose = property $      let rarr = rfromOrthotope inrank2 arrTrans      almostEq 1e-8 (rtoOrthotope (rsumOuter1 rarr)) (orSumOuter1 outrank arrTrans) +prop_negate_normalised :: Property +prop_negate_normalised = property $ +  genRank $ \rank@(SNat @n) -> do +    sh <- forAll $ genShR rank +    guard (all (> 0) (toList sh)) +    arr <- forAllT $ OR.fromVector @Double @n (toList sh) <$> +             genStorables (Range.singleton (product sh)) +                          (\w -> fromIntegral w / fromIntegral (maxBound :: Word64)) +    let rarr = rfromOrthotope rank arr +    rtoOrthotope (negate rarr) === OR.mapA negate arr +  tests :: TestTree  tests = testGroup "C"    [testGroup "sum" @@ -106,4 +117,7 @@ tests = testGroup "C"      ,testProperty "replicated" (prop_sum_replicated False)      ,testProperty "replicated_transposed" (prop_sum_replicated True)      ] +  ,testGroup "negate" +    [testProperty "normalised" prop_negate_normalised +    ]    ] | 
