% % This program demonstrates the use of time_util.pl % % To run this program, type "go." % % License & documentation: http://cobra.umbc.edu/time/ % % author: Harry Chen (harry.chen@umbc.edu, http://umbc.edu/~hchen4/) % % cvs: $Revision: 1.2 $, $Date: 2003/12/10 21:32:22 $ % :- ensure_loaded('time_util'). go :- write('===== Testing the predicate [dt_before/2] ===== \n'), test_before('2003-01-01T12:00:00','2003-12-31T12:00:00',yes), test_before('2003-01-01T12:00:00','2002-12-31T12:00:00',no), test_before('2003-11-25T03:00:00','2003-11-25T03:00:01',yes), test_before('0003-02-22T11:00:00','0003-12-22T13:34:11',yes), test_before('2003-12-26T00:00:00Z','2003-12-26T13:00:00Z',yes), test_before('2003-02-26T00:00:00Z','2003-02-26T00:00:00+05:00',no), test_before('2003-02-11T00:00:00+05:00','2003-02-11T00:00:00Z',yes), test_before('1000-01-01T01:00:00-01:00', '1000-01-01T01:00:00-02:00',yes), test_before('1000-01-01T01:00:00+01:00', '1000-01-01T01:00:00+02:00',no), test_before('1000-01-01T01:00:00+01:00', '1000-01-01T01:00:00-03:00',yes), test_before('2050-12-25T02:25:25Z', '2050-12-25T02:25:25Z',no), test_before('2004-02-29T23:00:00-10:00', '2004-03-01T09:00:00Z',no), nl, write('==== Testing the predicate [dt_after/2] ====\n'), test_after('2003-01-01T12:00:00','2003-12-31T12:00:00',no), test_after('2003-01-01T12:00:00','2002-12-31T12:00:00',yes), test_after('2003-11-25T03:00:00','2003-11-25T03:00:01',no), test_after('0003-02-22T11:00:00','0003-12-22T13:34:11',no), test_after('2003-12-26T00:00:00Z','2003-12-26T13:00:00Z',no), test_after('2003-02-26T00:00:00Z','2003-02-26T00:00:00+05:00',yes), test_after('2003-02-11T00:00:00+05:00','2003-02-11T00:00:00Z',no), test_after('1000-01-01T01:00:00-01:00', '1000-01-01T01:00:00-02:00',no), test_after('1000-01-01T01:00:00+01:00', '1000-01-01T01:00:00+02:00',yes), test_after('1000-01-01T01:00:00+01:00', '1000-01-01T01:00:00-03:00',no), test_after('2050-12-25T02:25:25Z', '2050-12-25T02:25:25Z',no), test_after('2004-02-29T23:00:00-10:00', '2004-03-01T09:00:00Z',no), write('==== Testing the predicate [dt_equals/2] ====\n'), test_equals('2003-01-01T12:00:00','2003-12-31T12:00:00',no), test_equals('2003-01-01T12:00:00','2002-12-31T12:00:00',no), test_equals('2003-11-25T03:00:00','2003-11-25T03:00:01',no), test_equals('0003-02-22T11:00:00','0003-12-22T13:34:11',no), test_equals('2003-12-26T00:00:00Z','2003-12-26T13:00:00Z',no), test_equals('2003-02-26T00:00:00Z','2003-02-26T00:00:00+05:00',no), test_equals('2003-02-11T00:00:00+05:00','2003-02-11T00:00:00Z',no), test_equals('1000-01-01T01:00:00-01:00', '1000-01-01T01:00:00-02:00',no), test_equals('1000-01-01T01:00:00+01:00', '1000-01-01T01:00:00+02:00',no), test_equals('1000-01-01T01:00:00+01:00', '1000-01-01T01:00:00-03:00',no), test_equals('2050-12-25T02:25:25Z', '2050-12-25T02:25:25Z',yes), test_equals('2050-12-25T03:25:25+01:00', '2050-12-25T01:25:25-01:00',yes), test_equals('2004-02-29T23:00:00-10:00', '2004-03-01T09:00:00Z',yes). do_test(Goal) :- call(Goal), writef("[yes]\n"). do_test(Goal) :- not(call(Goal)), writef("[no].\n"). test_before(T1,T2,ExpAns) :- writef('Is %w before %w? \n',[T1,T2]), writef(' Expected answer is [%w]. Test result ', [ExpAns]), do_test(dt_before(T1,T2)),!. test_after(T1,T2,ExpAns) :- writef('Is %w after %w? \n',[T1,T2]), writef(' Expected answer is [%w]. Test result ', [ExpAns]), do_test(dt_after(T1,T2)),!. test_equals(T1,T2,ExpAns) :- writef('Is %w equals %w? \n',[T1,T2]), writef(' Expected answer is [%w]. Test result ', [ExpAns]), do_test(dt_equals(T1,T2)),!.