From 2b8aea01b22db9aedb5bd6bdc327a02bfa92e1c2 Mon Sep 17 00:00:00 2001 From: Daniel Schüssler Date: Mon, 19 Jan 2009 10:41:49 +0000 Subject: 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. --- lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h (limited to 'lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h') 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 @@ +#ifndef MIN_VERSION_QuickCheck +#define MIN_VERSION_QuickCheck(A,B,C) 1 +#endif + +#if MIN_VERSION_QuickCheck(2,0,0) +import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector + ,sized,classify,Testable,Property + + ,quickCheckWith,maxSize,stdArgs,shrink) + +#else +import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector + ,sized,classify,Testable,Property + + ,check,configSize,defaultConfig,trivial) +#endif + + + +#if MIN_VERSION_QuickCheck(2,0,0) +trivial :: Testable a => Bool -> a -> Property +trivial = (`classify` "trivial") +#else +#endif + + +-- define qCheck, which used to be in Tests.hs +#if MIN_VERSION_QuickCheck(2,0,0) +qCheck n = quickCheckWith stdArgs {maxSize = n} +#else +qCheck n = check defaultConfig {configSize = const n} +#endif + -- cgit v1.2.3