require "vnd.stalwart.testsuite"; require "date"; require "variables"; test_set "currentdate" "Mon, 20 Jul 2009 21:44:43 +0000 "; /* "year" => the year, "0000" .. "9999". */ test "Year" { if not currentdate "year" "2009" { test_fail "failed to extract year part"; } } /* "month" => the month, "01" .. "12". */ test "Month" { if not currentdate "month" "07" { test_fail "failed to extract month part"; } } /* "day" => the day, "01" .. "31". */ test "Day" { if not currentdate "day" "20" { test_fail "failed to extract day part"; } } /* "date" => the date in "yyyy-mm-dd" format. */ test "Date" { if not currentdate "date" "2009-07-20" { test_fail "failed to extract date part"; } } /* "julian" => the Modified Julian Day, that is, the date expressed as an integer number of days since 00:00 UTC on November 17, 1858 (using the Gregorian calendar). This corresponds to the regular Julian Day minus 2400000.5. */ /*test "Julian" { if not currentdate "julian" "55032" { if date :matches :originalzone "date" "julian" "*" { } test_fail "failed to extract julian part: ${0}"; } if not date :originalzone "delivery-date" "julian" "55034" { if date :matches :originalzone "delivery-date" "julian" "*" { } test_fail "failed to extract julian part: ${0}"; } }*/ /* "hour" => the hour, "00" .. "23". */ test "Hour" { if not currentdate "hour" "21" { test_fail "failed to extract hour part"; } } /* "minute" => the minute, "00" .. "59". */ test "Minute" { if not currentdate "minute" "44" { test_fail "failed to extract minute part"; } } /* "second" => the second, "00" .. "60". */ test "Second" { if not currentdate "second" "43" { test_fail "failed to extract second part"; } } /* "time" => the time in "hh:mm:ss" format. */ test "Time" { if not currentdate "time" "21:44:43" { test_fail "failed to extract time part"; } } /* "iso8601" => the date and time in restricted ISO 8601 format. */ test "ISO8601" { if not currentdate "iso8601" "2009-07-20T21:44:43Z" { test_fail "failed to extract iso8601 part"; } } /* "std11" => the date and time in a format appropriate for use in a Date: header field [RFC2822]. */ test "STD11" { if not currentdate "std11" "Mon, 20 Jul 2009 21:44:43 +0000" { test_fail "failed to extract std11 part"; } } /* "zone" => the time zone in use. */ test "zone" { if not currentdate "zone" "+0000" { test_fail "failed to extract zone part"; } if not currentdate :zone "+0200" "zone" "+0200" { test_fail "failed to extract zone part"; } } /* "weekday" => the day of the week expressed as an integer between "0" and "6". "0" is Sunday, "1" is Monday, etc. */ test "Weekday" { if not currentdate "weekday" "1" { test_fail "failed to extract weekday part"; } }