Monadic QuickCheck 测试不适用于任意 Repa 阵列
Monadic QuickCheck test not working for arbitrary Repa array
我正在尝试为 Haskell 中的任意 Repa 数组编写测试。出于某种原因,以下代码段:
import Test.QuickCheck
import Test.QuickCheck.Monadic
import Data.Array.Repa (Array, DIM2)
prop_id :: Array U DIM2 Double -> Property
prop_id array = monadicIO $ array `R.equalsP` array >>= assert
引发此异常:
*** Failed! (after 1 test):
Exception:
Test.QuickCheck.resize: negative size
CallStack (from HasCallStack):
error, called at ./Test/QuickCheck/Gen.hs:82:22 in QuickCheck-2.9.2-Jyj4gc4JxkEIgGFLAsGhs9:Test.QuickCheck.Gen
Exception thrown while printing test case:
Test.QuickCheck.resize: negative size
CallStack (from HasCallStack):
error, called at ./Test/QuickCheck/Gen.hs:82:22 in QuickCheck-2.9.2-Jyj4gc4JxkEIgGFLAsGhs9:Test.QuickCheck.Gen
我不确定如何解释这些信息。感谢您的帮助。
这是 repa 的 Arbitrary
实例中的错误。 arbitrary
在大小为 0 时崩溃。您可以同时修复 属性 使用的生成器:
quickCheck $ forAll (scale (+1) arbitrary) prop_id
我正在尝试为 Haskell 中的任意 Repa 数组编写测试。出于某种原因,以下代码段:
import Test.QuickCheck
import Test.QuickCheck.Monadic
import Data.Array.Repa (Array, DIM2)
prop_id :: Array U DIM2 Double -> Property
prop_id array = monadicIO $ array `R.equalsP` array >>= assert
引发此异常:
*** Failed! (after 1 test):
Exception:
Test.QuickCheck.resize: negative size
CallStack (from HasCallStack):
error, called at ./Test/QuickCheck/Gen.hs:82:22 in QuickCheck-2.9.2-Jyj4gc4JxkEIgGFLAsGhs9:Test.QuickCheck.Gen
Exception thrown while printing test case:
Test.QuickCheck.resize: negative size
CallStack (from HasCallStack):
error, called at ./Test/QuickCheck/Gen.hs:82:22 in QuickCheck-2.9.2-Jyj4gc4JxkEIgGFLAsGhs9:Test.QuickCheck.Gen
我不确定如何解释这些信息。感谢您的帮助。
这是 repa 的 Arbitrary
实例中的错误。 arbitrary
在大小为 0 时崩溃。您可以同时修复 属性 使用的生成器:
quickCheck $ forAll (scale (+1) arbitrary) prop_id