@@ -9,7 +9,7 @@ module Tests.Properties
99 ) where
1010
1111import Control.Applicative ((<$>), (<*>))
12−import Control.Arrow ((***), second)
12+import Control.Arrow ((***), first, second)
1313import Data.Bits ((.&.))
1414import Data.Char (chr, isDigit, isHexDigit, isLower, isSpace, isLetter, isUpper, ord)
1515import Data.Int (Int8, Int16, Int32, Int64)
@@ -232,6 +232,13 @@ sf_uncons p = (uncons . L.filter p) `eqP`
232232 (fmap (second unpackS) . S.uncons . S.filter p)
233233t_uncons = uncons `eqP` (fmap (second unpackS) . T.uncons)
234234tl_uncons = uncons `eqP` (fmap (second unpackS) . TL.uncons)
235+
236+unsnoc xs@(_:_) = Just (init xs, last xs)
237+unsnoc [] = Nothing
238+
239+t_unsnoc = unsnoc `eqP` (fmap (first unpackS) . T.unsnoc)
240+tl_unsnoc = unsnoc `eqP` (fmap (first unpackS) . TL.unsnoc)
241+
235242s_head = head `eqP` S.head
236243sf_head p = (head . L.filter p) `eqP` (S.head . S.filter p)
237244t_head = head `eqP` T.head
@@ -996,6 +1003,8 @@ tests =
9961003 testProperty "sf_uncons" sf_uncons,
9971004 testProperty "t_uncons" t_uncons,
9981005 testProperty "tl_uncons" tl_uncons,
1006+ testProperty "t_unsnoc" t_unsnoc,
1007+ testProperty "tl_unsnoc" tl_unsnoc,
9991008 testProperty "s_head" s_head,
10001009 testProperty "sf_head" sf_head,
10011010 testProperty "t_head" t_head,