diff options
author | Daniel Schüssler <danlex@gmx.de> | 2009-01-19 10:41:49 +0000 |
---|---|---|
committer | Daniel Schüssler <danlex@gmx.de> | 2009-01-19 10:41:49 +0000 |
commit | 2b8aea01b22db9aedb5bd6bdc327a02bfa92e1c2 (patch) | |
tree | 2029e9cd03c6f4d0e27a4220f08c2f63f3ff59d5 /lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h | |
parent | bde1d4bec13cfaa22fab938156c0860539637473 (diff) |
Compatibility with QuickCheck 2 as well as QuickCheck 1
Used the C preprocessor to make it compile against either QuickCheck version. Added some implementations for the new "shrink" method of class Arbitrary.
The tests (runTests 10) succeed when compiled with QC 1.
With QC 2 (runTests 10 too) the fourth "vector operations" test (complex trigonometry) now fails. I don't know whether this is a bug in my changes, or whether QC 2 just generates Doubles differently and thus uncovered a real bug.
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h b/lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h new file mode 100644 index 0000000..714587b --- /dev/null +++ b/lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef MIN_VERSION_QuickCheck | ||
2 | #define MIN_VERSION_QuickCheck(A,B,C) 1 | ||
3 | #endif | ||
4 | |||
5 | #if MIN_VERSION_QuickCheck(2,0,0) | ||
6 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | ||
7 | ,sized,classify,Testable,Property | ||
8 | |||
9 | ,quickCheckWith,maxSize,stdArgs,shrink) | ||
10 | |||
11 | #else | ||
12 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | ||
13 | ,sized,classify,Testable,Property | ||
14 | |||
15 | ,check,configSize,defaultConfig,trivial) | ||
16 | #endif | ||
17 | |||
18 | |||
19 | |||
20 | #if MIN_VERSION_QuickCheck(2,0,0) | ||
21 | trivial :: Testable a => Bool -> a -> Property | ||
22 | trivial = (`classify` "trivial") | ||
23 | #else | ||
24 | #endif | ||
25 | |||
26 | |||
27 | -- define qCheck, which used to be in Tests.hs | ||
28 | #if MIN_VERSION_QuickCheck(2,0,0) | ||
29 | qCheck n = quickCheckWith stdArgs {maxSize = n} | ||
30 | #else | ||
31 | qCheck n = check defaultConfig {configSize = const n} | ||
32 | #endif | ||
33 | |||