summaryrefslogtreecommitdiffstats
path: root/test/Spec.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/Spec.hs')
-rw-r--r--test/Spec.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Spec.hs b/test/Spec.hs
index 6cf4d2f..24a17e2 100644
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
import Blessings.Internal as B
@@ -43,6 +44,22 @@ main =
property $ \(x :: Blessings String) ->
normalize (B.take 1 x <> B.drop 1 x) == normalize x
+ it "uncurry (<>) (splitAt i x) == x" $
+ property $ \(i :: Int, x :: Blessings String) ->
+ unsafeTimeout 100000 $
+ normalize (uncurry (<>) (B.splitAt i x)) == normalize x
+
+ it "splitAt produces pairs with elements of proper length" $
+ property $ \(i :: Int, x :: Blessings String) ->
+ unsafeTimeout 100000 $
+ let
+ (l, r) = B.splitAt i x
+ n = B.length x
+ in
+ if | i <= 0 -> B.length l == 0 && B.length r == n
+ | i <= n -> B.length l == i && B.length r == n - i
+ | otherwise -> B.length l == n && B.length r == 0
+
let infx = mconcat (repeat (Plain "x" :: Blessings String))
it "can take from infinite structure" $