@@ -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)
@@ -230,6 +230,13 @@ sf_uncons p = (uncons . L.filter p) `eqP`
230230 (fmap (second unpackS) . S.uncons . S.filter p)
231231t_uncons = uncons `eqP` (fmap (second unpackS) . T.uncons)
232232tl_uncons = uncons `eqP` (fmap (second unpackS) . TL.uncons)
233+
234+unsnoc xs@(_:_) = Just (init xs, last xs)
235+unsnoc [] = Nothing
236+
237+t_unsnoc = unsnoc `eqP` (fmap (first unpackS) . T.unsnoc)
238+tl_unsnoc = unsnoc `eqP` (fmap (first unpackS) . TL.unsnoc)
239+
233240s_head = head `eqP` S.head
234241sf_head p = (head . L.filter p) `eqP` (S.head . S.filter p)
235242t_head = head `eqP` T.head
@@ -976,6 +983,8 @@ tests =
976983 testProperty "sf_uncons" sf_uncons,
977984 testProperty "t_uncons" t_uncons,
978985 testProperty "tl_uncons" tl_uncons,
986+ testProperty "t_unsnoc" t_unsnoc,
987+ testProperty "tl_unsnoc" tl_unsnoc,
979988 testProperty "s_head" s_head,
980989 testProperty "sf_head" sf_head,
981990 testProperty "t_head" t_head,