]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Misc.hs
A bunch more test cleanup.
[spline3.git] / src / Misc.hs
index b9220cbbcefa7bf52ea9ec6c76b5f5d09467d4b6..16b0ead151ad1b29190028db01aa98ef34d6b797 100644 (file)
@@ -4,6 +4,11 @@ module Misc
 where
 
 import Data.List (intersect)
+import Test.Framework (Test, testGroup)
+import Test.Framework.Providers.HUnit (testCase)
+import Test.Framework.Providers.QuickCheck2 (testProperty)
+import Test.HUnit
+import Test.QuickCheck
 
 
 -- | The standard factorial function. See
@@ -75,3 +80,30 @@ all_equal xs =
 disjoint :: (Eq a) => [a] -> [a] -> Bool
 disjoint xs ys =
     intersect xs ys == []
+
+
+
+prop_factorial_greater :: Int -> Property
+prop_factorial_greater n =
+    n <= 20 ==> factorial n >= n
+
+
+test_flatten1 :: Assertion
+test_flatten1 =
+    assertEqual "flatten actually works" expected_list actual_list
+    where
+      target = [[[1::Int]], [[2, 3]]]
+      expected_list = [1, 2, 3]
+      actual_list = flatten target
+
+
+misc_tests :: Test.Framework.Test
+misc_tests =
+    testGroup "Misc Tests" [
+      testCase "flatten (1)" test_flatten1 ]
+
+
+misc_properties :: Test.Framework.Test
+misc_properties =
+    testGroup "Misc Properties" [
+      testProperty "factorial greater" prop_factorial_greater ]