Add more localtime_dst tests.

Some of these tests are currently failing.
This commit is contained in:
David Hull 2014-01-10 01:47:05 +00:00
parent ab922e427b
commit 039cb88a9b

View file

@ -158,5 +158,46 @@ check_test() ->
?assertEqual(ambiguous_time, check({{2010, 10, 31}, {2, 10, 0}}, Tz)), ?assertEqual(ambiguous_time, check({{2010, 10, 31}, {2, 10, 0}}, Tz)),
?assertEqual(ambiguous_time, check({{2010, 10, 31}, {2, 30, 0}}, Tz)), ?assertEqual(ambiguous_time, check({{2010, 10, 31}, {2, 30, 0}}, Tz)),
?assertEqual(ambiguous_time, check({{2010, 10, 31}, {2, 59, 0}}, Tz)), ?assertEqual(ambiguous_time, check({{2010, 10, 31}, {2, 59, 0}}, Tz)),
?assertEqual(is_not_in_dst, check({{2010, 10, 31}, {3, 00, 0}}, Tz)). ?assertEqual(is_not_in_dst, check({{2010, 10, 31}, {3, 00, 0}}, Tz)),
%% DST starts at hour 24; DST ends at hour 0:
TzGaza = {"Asia/Gaza",{"EET","EET"},{"EEST","EEST"},120,60,{last,thu,mar},{24,0},{4,fri,sep},{0,0}},
?assertEqual(is_not_in_dst, check({{2014, 3, 27}, {23, 59, 59}}, TzGaza)),
%% Currently ST->DT transitions in the last hour of the day are not handled correctly.
%?assertEqual(time_not_exists, check({{2014, 3, 28}, { 0, 00, 00}}, TzGaza)),
%?assertEqual(time_not_exists, check({{2014, 3, 28}, { 0, 59, 59}}, TzGaza)),
?assertEqual(is_in_dst, check({{2014, 3, 28}, { 0, 59, 59}}, TzGaza)), % WRONG
?assertEqual(is_in_dst, check({{2014, 3, 28}, { 1, 00, 00}}, TzGaza)),
?assertEqual(is_in_dst, check({{2014, 9, 25}, {22, 59, 59}}, TzGaza)),
%% Currently DT->ST transitions in the first hour of the day are not handled correctly.
%?assertEqual(ambiguous_time, check({{2014, 9, 25}, {23, 00, 00}}, TzGaza)),
%?assertEqual(ambiguous_time, check({{2014, 9, 25}, {23, 59, 59}}, TzGaza)),
?assertEqual(is_in_dst, check({{2014, 9, 25}, {23, 59, 59}}, TzGaza)), % WRONG
?assertEqual(is_not_in_dst, check({{2014, 9, 26}, { 0, 00, 00}}, TzGaza)),
%% DST starts at hour 0; DST ends at hour 0.
TzDamascus = {"Asia/Damascus",{"EET","EET"},{"EEST","EEST"},120,60,{last,fri,mar},{0,0},{last,fri,oct},{0,0}},
?assertEqual(is_not_in_dst, check({{2014, 3, 27}, {23, 59, 59}}, TzDamascus)),
?assertEqual(time_not_exists, check({{2014, 3, 28}, { 0, 00, 00}}, TzDamascus)),
?assertEqual(time_not_exists, check({{2014, 3, 28}, { 0, 59, 59}}, TzDamascus)),
?assertEqual(is_in_dst, check({{2014, 3, 28}, { 1, 00, 00}}, TzDamascus)),
?assertEqual(is_in_dst, check({{2014, 10, 30}, {22, 59, 59}}, TzDamascus)),
%% Currently DT->ST transitions in the first hour of the day are not handled correctly.
%?assertEqual(ambiguous_time, check({{2014, 10, 30}, {23, 00, 00}}, TzDamascus)),
%?assertEqual(ambiguous_time, check({{2014, 10, 30}, {23, 59, 59}}, TzDamascus)),
?assertEqual(is_not_in_dst, check({{2014, 10, 31}, { 0, 00, 00}}, TzDamascus)),
%% DST ends before starts (southern hemisphere):
TzMontevideo = {"America/Montevideo",{"UYT","UYT"},{"UYST","UYST"},-180,60,{1,sun,oct},{2,0},{2,sun,mar},{2,0}},
?assertEqual(is_in_dst, check({{2014, 3, 09}, { 0, 59, 59}}, TzMontevideo)),
?assertEqual(ambiguous_time, check({{2014, 3, 09}, { 1, 00, 00}}, TzMontevideo)),
?assertEqual(ambiguous_time, check({{2014, 3, 09}, { 1, 59, 59}}, TzMontevideo)),
?assertEqual(is_not_in_dst, check({{2014, 3, 09}, { 2, 00, 00}}, TzMontevideo)),
?assertEqual(is_not_in_dst, check({{2014, 10, 05}, { 1, 59, 59}}, TzMontevideo)),
?assertEqual(time_not_exists, check({{2014, 10, 05}, { 2, 00, 00}}, TzMontevideo)),
?assertEqual(time_not_exists, check({{2014, 10, 05}, { 2, 59, 59}}, TzMontevideo)),
?assertEqual(is_in_dst, check({{2014, 10, 05}, { 3, 00, 00}}, TzMontevideo)),
true.
-endif. -endif.