Repository : ssh://[email protected]/containers On branch : ghc-head Link : http://git.haskell.org/?p=packages/containers.git;a=commit;h=f14936a05a2be012211f25ac66dad6046cfacc66
>--------------------------------------------------------------- commit f14936a05a2be012211f25ac66dad6046cfacc66 Author: Milan Straka <[email protected]> Date: Sun Nov 11 15:45:49 2012 +0100 Reorder the tests in set-properties. HUnit tests first, then QuickCheck properties. >--------------------------------------------------------------- f14936a05a2be012211f25ac66dad6046cfacc66 tests/set-properties.hs | 60 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/set-properties.hs b/tests/set-properties.hs index 56e0b70..f1ce4f5 100644 --- a/tests/set-properties.hs +++ b/tests/set-properties.hs @@ -16,6 +16,10 @@ main = defaultMain [ testCase "lookupLT" test_lookupLT , testCase "lookupGT" test_lookupGT , testCase "lookupLE" test_lookupLE , testCase "lookupGE" test_lookupGE + , testCase "lookupIndex" test_lookupIndex + , testCase "findIndex" test_findIndex + , testCase "elemAt" test_elemAt + , testCase "deleteAt" test_deleteAt , testProperty "prop_Valid" prop_Valid , testProperty "prop_Single" prop_Single , testProperty "prop_Member" prop_Member @@ -37,10 +41,6 @@ main = defaultMain [ testCase "lookupLT" test_lookupLT , testProperty "prop_Diff" prop_Diff , testProperty "prop_IntValid" prop_IntValid , testProperty "prop_Int" prop_Int - , testCase "lookupIndex" test_lookupIndex - , testCase "findIndex" test_findIndex - , testCase "elemAt" test_elemAt - , testCase "deleteAt" test_deleteAt , testProperty "prop_Ordered" prop_Ordered , testProperty "prop_List" prop_List , testProperty "prop_DescList" prop_DescList @@ -95,6 +95,32 @@ test_lookupGE = do lookupGE 6 (fromList [3, 5]) @?= Nothing {-------------------------------------------------------------------- + Indexed +--------------------------------------------------------------------} + +test_lookupIndex :: Assertion +test_lookupIndex = do + isJust (lookupIndex 2 (fromList [5,3])) @?= False + fromJust (lookupIndex 3 (fromList [5,3])) @?= 0 + fromJust (lookupIndex 5 (fromList [5,3])) @?= 1 + isJust (lookupIndex 6 (fromList [5,3])) @?= False + +test_findIndex :: Assertion +test_findIndex = do + findIndex 3 (fromList [5,3]) @?= 0 + findIndex 5 (fromList [5,3]) @?= 1 + +test_elemAt :: Assertion +test_elemAt = do + elemAt 0 (fromList [5,3]) @?= 3 + elemAt 1 (fromList [5,3]) @?= 5 + +test_deleteAt :: Assertion +test_deleteAt = do + deleteAt 0 (fromList [5,3]) @?= singleton 5 + deleteAt 1 (fromList [5,3]) @?= singleton 3 + +{-------------------------------------------------------------------- Arbitrary, reasonably balanced trees --------------------------------------------------------------------} instance (Enum a) => Arbitrary (Set a) where @@ -236,32 +262,6 @@ prop_Int xs ys = toAscList (intersection (fromList xs) (fromList ys)) == List.sort (nub ((List.intersect) (xs) (ys))) {-------------------------------------------------------------------- - Indexed ---------------------------------------------------------------------} - -test_lookupIndex :: Assertion -test_lookupIndex = do - isJust (lookupIndex 2 (fromList [5,3])) @?= False - fromJust (lookupIndex 3 (fromList [5,3])) @?= 0 - fromJust (lookupIndex 5 (fromList [5,3])) @?= 1 - isJust (lookupIndex 6 (fromList [5,3])) @?= False - -test_findIndex :: Assertion -test_findIndex = do - findIndex 3 (fromList [5,3]) @?= 0 - findIndex 5 (fromList [5,3]) @?= 1 - -test_elemAt :: Assertion -test_elemAt = do - elemAt 0 (fromList [5,3]) @?= 3 - elemAt 1 (fromList [5,3]) @?= 5 - -test_deleteAt :: Assertion -test_deleteAt = do - deleteAt 0 (fromList [5,3]) @?= singleton 5 - deleteAt 1 (fromList [5,3]) @?= singleton 3 - -{-------------------------------------------------------------------- Lists --------------------------------------------------------------------} prop_Ordered :: Property _______________________________________________ ghc-commits mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-commits
