on master help sign in
Added property test for `toTitle`
4b1fc4cal_skipp
tests/Tests/Properties.hs+4−1
@@ -326,6 +326,8 @@ t_toUpper_upper t = p (T.toUpper t) >= p t
326 where p = T.length . T.filter isUpper
326 where p = T.length . T.filter isUpper
327tl_toUpper_upper t = p (TL.toUpper t) >= p t
327tl_toUpper_upper t = p (TL.toUpper t) >= p t
328 where p = TL.length . TL.filter isUpper
328 where p = TL.length . TL.filter isUpper
329+t_toTitle_title t = all (<= 1) (caps t)
330+ where caps = fmap (T.length . T.filter isUpper) . T.words . T.toTitle
329
331
330justifyLeft k c xs = xs ++ L.replicate (k - length xs) c
332justifyLeft k c xs = xs ++ L.replicate (k - length xs) c
331justifyRight m n xs = L.replicate (m - length xs) n ++ xs
333justifyRight m n xs = L.replicate (m - length xs) n ++ xs
@@ -1030,7 +1032,8 @@ tests =
1030 testProperty "tl_toLower_lower" tl_toLower_lower,
1032 testProperty "tl_toLower_lower" tl_toLower_lower,
1031 testProperty "t_toUpper_length" t_toUpper_length,
1033 testProperty "t_toUpper_length" t_toUpper_length,
1032 testProperty "t_toUpper_upper" t_toUpper_upper,
1034 testProperty "t_toUpper_upper" t_toUpper_upper,
1033− testProperty "tl_toUpper_upper" tl_toUpper_upper
1035+ testProperty "tl_toUpper_upper" tl_toUpper_upper,
1036+ testProperty "t_toTitle_title" t_toTitle_title
1034 ],
1037 ],
1035
1038
1036 testGroup "justification" [
1039 testGroup "justification" [