2 Copyright (C) 2010-2011 jeanfi@gmail.com
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 int test_time_to_ISO8601_time(time_t t, const char *ref)
31 result = time_to_ISO8601_time(&t);
33 failure = !!strcmp(result, ref);
37 "test_time_to_ISO8601_time(%ld)=%s instead of %s.\n",
47 int test_time_to_ISO8601_date(time_t t, const char *ref)
52 result = time_to_ISO8601_date(&t);
54 failure = !!strcmp(result, ref);
58 "test_date_to_ISO8601_time(%ld)=%s instead of %s.\n",
68 static int tests_time_to_ISO8601_time()
74 failures += test_time_to_ISO8601_time(0, "1970-01-01T00:00:00");
75 failures += test_time_to_ISO8601_time(83, "1970-01-01T00:01:23");
76 failures += test_time_to_ISO8601_time(1392542321,
77 "2014-02-16T09:18:41");
82 static int tests_time_to_ISO8601_date()
88 failures += test_time_to_ISO8601_date(0, "1970-01-01");
89 failures += test_time_to_ISO8601_date(83, "1970-01-01");
90 failures += test_time_to_ISO8601_date(1392542321, "2014-02-16");
95 int main(int argc, char **argv)
101 failures += tests_time_to_ISO8601_time();
102 failures += tests_time_to_ISO8601_date();