/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "test-common.h"
#include "iso8601-date.h"
#include <time.h>
struct iso8601_date_test {
const char *date_in;
const char *date_out;
int zone_offset;
};
/* Valid date tests */
{
.date_in = "2007-11-07T23:05:34+00:00",
.tm = {
},{
.date_in = "2011-01-07T21:03:31+00:30",
.tm = {
.zone_offset = 30
},{
.date_in = "2006-05-09T18:04:12+05:30",
.tm = {
},{
.date_in = "1975-10-30T06:33:29Z",
.date_out = "1975-10-30T06:33:29+00:00",
.tm = {
},{
.date_in = "1988-04-24t15:02:12z",
.date_out = "1988-04-24T15:02:12+00:00",
.tm = {
},{
.date_in = "2012-02-29T08:12:34.23198Z",
.date_out = "2012-02-29T08:12:34+00:00",
.tm = {
}
};
static void test_iso8601_date_valid(void)
{
unsigned int i;
for (i = 0; i < valid_date_test_count; i++) T_BEGIN {
bool result;
if (result) {
}
test_end();
} T_END;
}
/* Invalid date tests */
const char *invalid_date_tests[] = {
"200-11-17T23:05:34+00:00",
"2007:11-17T23:05:34+00:00",
"2007-11?17T23:05:34+00:00",
"2007-49-17T23:05:34+00:00",
"2007-11-77T23:05:34+00:00",
"2007-11-17K23:05:34+00:00",
"2007-11-13T59:05:34+00:00",
"2007-112-13T12:15:34+00:00",
"2007-11-133T12:15:34+00:00",
"2007-11-13T12J15:34+00:00",
"2007-11-13T12:15*34+00:00",
"2007-11-13T12:15:34/00:00",
"2007-11-13T12:15:34+00-00",
"2007-11-13T123:15:34+00:00",
"2007-11-13T12:157:34+00:00",
"2007-11-13T12:15:342+00:00",
"2007-11-13T12:15:34+001:00",
"2007-11-13T12:15:32+00:006",
"2007-02-29T15:13:21Z"
};
static void test_iso8601_date_invalid(void)
{
unsigned int i;
for (i = 0; i < invalid_date_test_count; i++) T_BEGIN {
const char *date_in;
int tz;
bool result;
date_in = invalid_date_tests[i];
test_end();
} T_END;
}
void test_iso8601_date(void)
{
}