@@ -2,8 +2,6 @@ module Test.Data.Array.NonEmpty (testNonEmptyArray) where
2
2
3
3
import Prelude
4
4
5
- import Effect (Effect )
6
- import Effect.Console (log )
7
5
import Data.Array.NonEmpty as NEA
8
6
import Data.Const (Const (..))
9
7
import Data.Foldable (for_ , sum , traverse_ )
@@ -13,6 +11,8 @@ import Data.Monoid.Additive (Additive(..))
13
11
import Data.Semigroup.Foldable (foldMap1 )
14
12
import Data.Semigroup.Traversable (traverse1 )
15
13
import Data.Tuple (Tuple (..))
14
+ import Effect (Effect )
15
+ import Effect.Console (log , logShow )
16
16
import Partial.Unsafe (unsafePartial )
17
17
import Test.Assert (assert )
18
18
@@ -234,9 +234,12 @@ testNonEmptyArray = do
234
234
log " nub should remove duplicate elements from the list, keeping the first occurence"
235
235
assert $ NEA .nub (fromArray [1 , 2 , 2 , 3 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 4 ]
236
236
237
- log " nubBy should remove duplicate items from the list using a supplied predicate"
237
+ log " nubEq should remove duplicate elements from the list, keeping the first occurence"
238
+ assert $ NEA .nubEq (fromArray [1 , 2 , 2 , 3 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 4 ]
239
+
240
+ log " nubByEq should remove duplicate items from the list using a supplied predicate"
238
241
let nubPred = \x y -> if odd x then false else x == y
239
- assert $ NEA .nubBy nubPred (fromArray [1 , 2 , 2 , 3 , 3 , 4 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 3 , 4 , 1 ]
242
+ assert $ NEA .nubByEq nubPred (fromArray [1 , 2 , 2 , 3 , 3 , 4 , 4 , 1 ]) == fromArray [1 , 2 , 3 , 3 , 4 , 1 ]
240
243
241
244
log " union should produce the union of two arrays"
242
245
assert $ NEA .union (fromArray [1 , 2 , 3 ]) (fromArray [2 , 3 , 4 ]) == fromArray [1 , 2 , 3 , 4 ]
0 commit comments