[m-rev.] for review: new test case for time library

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Dec 16 15:26:34 AEDT 2003


Hi James,

On 16-Dec-2003, James Goddard <goddardjames at yahoo.com> wrote:
> Made the time_test test case slightly more comprehensive.
> 
> tests/time_test.m:
> 	Added test cases for entering and leaving daylight savings time.

Since these tests are timezone-specific, and different operating systems
might not support multiple timezones in the same way that Unix does,
I think it would be best to put them in a new test case rather than
adding them to the existing test case.  That way, we can keep the
existing test enabled on all hosts and enable the new test only for
hosts that support the TZ environment variable.

> Index: time_test.m
> +	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> +	% In Melbourne, daylight savings
> +	%   Starts: 2 am EST (Eastern Standard Time) on 26 October 2003
> +	%   Ends:   2 am EST (Eastern Standard Time) on 28 March   2004
> +	% At start of daylight saving period, move clock forward one hour
> +	% At end of daylight saving period, move clock back one hour
> +	%
> +	% Note: For this test to work, you must set:
> +	% 	TZ='Australia/Melbourne'; export TZ
> +	% XXX This should somehow be incorporated into Mmakefile.

This XXX will need to be addressed before the change is committed,
or at least before the new test case is enabled (if you put it in
a new test case as I suggested above) by listing it in the Mmakefile.

> +	% Sunday 2003-10-26 01:30:00
> +	{ BeforeStart = mktime(tm(103, 9, 26, 1, 30, 0, 298, 0,
> +				yes(standard_time))) },
> +	% Sunday 2003-10-26 03:30:00
> +	{ AfterStart = mktime(tm(103, 9, 26, 3, 30, 0, 298, 0,
> +				yes(daylight_time))) },
> +	% difference should be 1 hour
> +	( { difftime(AfterStart, BeforeStart) = 3600.0 } ->
> +		io__write_string("start DST succeeded\n")
> +	;
> +		io__write_string("start DST failed\n")
> +	),
> +
> +	% Sunday 2004-02-28 02:30:00 (occurs twice)
> +	{ BeforeEnd = mktime(tm(104, 2, 28, 2, 30, 0, 87, 0,
> +				yes(daylight_time))) },
> +	{ AfterEnd = mktime(tm(104, 2, 28, 2, 30, 0, 87, 0,
> +				yes(standard_time))) },
> +	% difference should be 1 hour
> +	( { difftime(AfterEnd, BeforeEnd) = 3600.0 } ->
> +		io__write_string("end DST succeeded\n")
> +	;
> +		io__write_string("end DST failed\n")
> +	),

Here you test time.mktime and time.difftime... could you please
also test time.localtime and time.gmtime?
Also, here you test the times 1:30, 2:30, 3:30... could you
please also test the times 01:59, 02:00, 02:01, 2:59, 3:00, and 3:01
on the change-over dates?  (It may be worth using a subroutine.)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list