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

James Goddard goddardjames at yahoo.com
Tue Dec 16 14:23:30 AEDT 2003


Estimated hours taken: 3
Branches: main

Made the time_test test case slightly more comprehensive.

tests/time_test.m:
	Added test cases for entering and leaving daylight savings time.

tests/time_test.exp:
	Corresponding expected output.

Index: time_test.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/time_test.m,v
retrieving revision 1.2
diff -u -d -r1.2 time_test.m
--- time_test.m	31 May 2001 17:12:52 -0000	1.2
+++ time_test.m	16 Dec 2003 03:18:33 -0000
@@ -21,5 +21,42 @@
 	% Sunday 2001-01-07 03:02:01
 	{ TM = tm(101, 0, 7, 3, 2, 1, 6, 0, no) },
 	io__write_string(asctime(TM)),
+
+	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+	% 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.
+
+	% 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")
+	),
+
 	io__nl.
 
Index: time_test.exp
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/time_test.exp,v
retrieving revision 1.1
diff -u -d -r1.1 time_test.exp
--- time_test.exp	31 May 2001 09:11:30 -0000	1.1
+++ time_test.exp	16 Dec 2003 00:50:42 -0000
@@ -1,3 +1,5 @@
 mktime succeeded
 Sun Jan  7 03:02:01 2001
+start DST succeeded
+end DST succeeded
 
--------------------------------------------------------------------------
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