[m-rev.] for review: changes to time_test

James Goddard goddardjames at yahoo.com
Tue Dec 16 17:15:22 AEDT 2003


Estimated hours taken: 0.25
Branches: main

Altered the time_test test case to be more lenient.

tests/time_test.m:
	mktime(localtime(Time)) is now considered to be close enough to the
	original Time if it is less than 1 second earlier.

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 06:14:11 -0000
@@ -8,11 +8,12 @@
 
 :- implementation.
 
-:- import_module std_util, time.
+:- import_module std_util, time, float.
 
 main -->
 	time(Time),
-	( { mktime(localtime(Time)) = Time } ->
+	{ Diff = difftime(Time, mktime(localtime(Time))) },
+	( { (Diff >= 0.0, Diff < 1.0) } ->
 		io__write_string("mktime succeeded\n")
 	;
 		io__write_string("mktime failed\n")
--------------------------------------------------------------------------
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