consolidated logic, added date normalization and overlap methods.

This commit is contained in:
aj
2010-11-04 00:39:10 -07:00
parent e9d247784e
commit 2f727dd8bb
3 changed files with 90 additions and 46 deletions

View File

@@ -29,7 +29,15 @@ firstlast_day_of_test_() ->
compare_datetimes_test_() ->
[
?_assertEqual(false, ezic_date:compare_datetimes(
{{1997,3,lastSun},{tztime,{1,0,0},u}}
?_assertNot(ezic_date:compare_datetimes(
{{1997,3,{last, "Sun"}},{tztime,{1,0,0},u}}
, {1997,1,1} ))
].
overlap_test_() ->
[
?_assert(ezic_date:overlap({1978,only},{{{1977,1,1},#tztime{}}, {{1978,1,1},#tztime{}}}))
, ?_assert(ezic_date:overlap({1978,only},{{{1971,1,1},#tztime{}}, {{1978,1,1},#tztime{}}}))
, ?_assertNot(ezic_date:overlap({1978,only},{{{1971,1,1},#tztime{}}, {{1977,12,31},#tztime{}}}))
].