packages feed

Unique 0.4.7 → 0.4.7.1

raw patch · 2 files changed

+36/−2 lines, 2 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

Unique.cabal view
@@ -1,6 +1,6 @@ name:                Unique -version:             0.4.7+version:             0.4.7.1  synopsis:            It provides the functionality like unix "uniq" utility description:         Library provides the functions to find unique and duplicate elements in the list@@ -38,8 +38,9 @@                      , IsUnique                      , RepeatedBy                      , SortUniq+                     , AllUnique -  build-depends:       base >=4.0 && < 4.10+  build-depends:       base >=4.0 && < 5                      , hspec                      , containers                      , QuickCheck
+ tests/AllUnique.hs view
@@ -0,0 +1,33 @@+module AllUnique where++import Test.Hspec+import Test.QuickCheck+import Control.Exception (evaluate)+import Data.List (nub)++import Data.List.Unique+++allUnique' :: Eq a => [a] -> Bool+allUnique' ls = (nub ls) == ls++allUniqueTests :: SpecWith ()+allUniqueTests =+  describe "Data.List.Unique.allUnique" $ do+  it "allUnique: returns True with empty list" $ do+    allUnique "" `shouldBe` True++  it "allUnique: returns False when some element is not unique" $ do+    allUnique "foo bar" `shouldBe` False++  it "allUnique: returns True when list does not have duplicates" $ do+    allUnique ([1..1000] :: [Int]) `shouldBe` True++  it "allUnique: fails if list consist of duplicate elements and 'undefined' after them" $ do+    evaluate (allUnique ['a', 'a', undefined] )+      `shouldThrow`+      errorCall "Prelude.undefined"++  it "allUnique: Test the function using slower analog and random data" $+    property $+    \ xs -> (allUnique' (xs :: String)) == (allUnique xs)