[commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Properties for testing case-insensitivity. (bd8607f)
git at git.haskell.org
git at git.haskell.org
Mon Feb 20 21:13:36 UTC 2017
- Previous message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: prop_name helper for defining named properties. (c8bba9b)
- Next message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Case-insensitive parsing. (781548a)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Repository : ssh://git@git.haskell.org/time
On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link : http://git.haskell.org/packages/time.git/commitdiff/bd8607fd727c79c066aeae398104eee74b3faa53
>---------------------------------------------------------------
commit bd8607fd727c79c066aeae398104eee74b3faa53
Author: Bjorn Buckwalter <bjorn.buckwalter at gmail.com>
Date: Sun Jan 18 13:51:43 2009 -0800
Properties for testing case-insensitivity.
Note that not all formats being tested have alphabetical characters. The additional testing of those is "wasteful".
darcs-hash:20090118215143-03283-5ed4f9ba7cdc8fa09afdb4584e52ac017c4421db
>---------------------------------------------------------------
bd8607fd727c79c066aeae398104eee74b3faa53
test/TestParseTime.hs | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs
index 11b8787..76b897a 100644
--- a/test/TestParseTime.hs
+++ b/test/TestParseTime.hs
@@ -136,6 +136,22 @@ prop_parse_format_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t
=> String -> FormatString t -> NamedProperty
prop_parse_format_named = prop_named "prop_parse_format" prop_parse_format
+-- Verify case-insensitivity with upper case.
+prop_parse_format_upper :: (Eq t, FormatTime t, ParseTime t) => FormatString t -> t -> Bool
+prop_parse_format_upper (FormatString f) t = parse f (map toUpper $ format f t) == Just t
+
+prop_parse_format_upper_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t)
+ => String -> FormatString t -> NamedProperty
+prop_parse_format_upper_named = prop_named "prop_parse_format_upper" prop_parse_format_upper
+
+-- Verify case-insensitivity with lower case.
+prop_parse_format_lower :: (Eq t, FormatTime t, ParseTime t) => FormatString t -> t -> Bool
+prop_parse_format_lower (FormatString f) t = parse f (map toLower $ format f t) == Just t
+
+prop_parse_format_lower_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t)
+ => String -> FormatString t -> NamedProperty
+prop_parse_format_lower_named = prop_named "prop_parse_format_lower" prop_parse_format_lower
+
prop_format_parse_format :: (FormatTime t, ParseTime t) => FormatString t -> t -> Bool
prop_format_parse_format (FormatString f) t =
fmap (format f) (parse f (format f t) `asTypeOf` Just t) == Just (format f t)
@@ -207,6 +223,20 @@ properties =
++ map (prop_parse_format_named "ZonedTime") zonedTimeFormats
++ map (prop_parse_format_named "UTCTime") utcTimeFormats
+ ++ map (prop_parse_format_upper_named "Day") dayFormats
+ ++ map (prop_parse_format_upper_named "TimeOfDay") timeOfDayFormats
+ ++ map (prop_parse_format_upper_named "LocalTime") localTimeFormats
+ ++ map (prop_parse_format_upper_named "TimeZone") timeZoneFormats
+ ++ map (prop_parse_format_upper_named "ZonedTime") zonedTimeFormats
+ ++ map (prop_parse_format_upper_named "UTCTime") utcTimeFormats
+
+ ++ map (prop_parse_format_lower_named "Day") dayFormats
+ ++ map (prop_parse_format_lower_named "TimeOfDay") timeOfDayFormats
+ ++ map (prop_parse_format_lower_named "LocalTime") localTimeFormats
+ ++ map (prop_parse_format_lower_named "TimeZone") timeZoneFormats
+ ++ map (prop_parse_format_lower_named "ZonedTime") zonedTimeFormats
+ ++ map (prop_parse_format_lower_named "UTCTime") utcTimeFormats
+
++ map (prop_format_parse_format_named "Day") partialDayFormats
++ map (prop_format_parse_format_named "TimeOfDay") partialTimeOfDayFormats
++ map (prop_format_parse_format_named "LocalTime") partialLocalTimeFormats
- Previous message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: prop_name helper for defining named properties. (c8bba9b)
- Next message: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Case-insensitive parsing. (781548a)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ghc-commits
mailing list