26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{
void *pool = objc_autoreleasePoolPush();
OFDate *d1, *d2;
struct tm tm;
int16_t tz;
const char *dstr = "Wed, 09 Jun 2021 +0200x";
TEST(@"of_strptime()",
of_strptime(dstr, "%a, %d %b %Y %z", &tm, &tz) == dstr + 22 &&
tm.tm_wday == 3 && tm.tm_mday == 9 && tm.tm_mon == 5 &&
tm.tm_year == 2021 - 1900 && tz == 2 * 60)
TEST(@"+[dateWithTimeIntervalSince1970:]",
(d1 = [OFDate dateWithTimeIntervalSince1970: 0]))
TEST(@"-[dateByAddingTimeInterval:]",
|
|
|
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{
void *pool = objc_autoreleasePoolPush();
OFDate *d1, *d2;
struct tm tm;
int16_t tz;
const char *dstr = "Wed, 09 Jun 2021 +0200x";
TEST(@"OFStrPTime()",
OFStrPTime(dstr, "%a, %d %b %Y %z", &tm, &tz) == dstr + 22 &&
tm.tm_wday == 3 && tm.tm_mday == 9 && tm.tm_mon == 5 &&
tm.tm_year == 2021 - 1900 && tz == 2 * 60)
TEST(@"+[dateWithTimeIntervalSince1970:]",
(d1 = [OFDate dateWithTimeIntervalSince1970: 0]))
TEST(@"-[dateByAddingTimeInterval:]",
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
[OFDate dateWithLocalDateString: @"2000-06-20T12:34:56+0200x"
format: @"%Y-%m-%dT%H:%M:%S%z"])
TEST(@"-[isEqual:]",
[d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] &&
![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0.0000001]])
TEST(@"-[compare:]", [d1 compare: d2] == OF_ORDERED_ASCENDING)
TEST(@"-[second]", d1.second == 0 && d2.second == 5)
TEST(@"-[microsecond]", d1.microsecond == 0 && d2.microsecond == 2)
TEST(@"-[minute]", d1.minute == 0 && d2.minute == 0)
|
|
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
[OFDate dateWithLocalDateString: @"2000-06-20T12:34:56+0200x"
format: @"%Y-%m-%dT%H:%M:%S%z"])
TEST(@"-[isEqual:]",
[d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] &&
![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0.0000001]])
TEST(@"-[compare:]", [d1 compare: d2] == OFOrderedAscending)
TEST(@"-[second]", d1.second == 0 && d2.second == 5)
TEST(@"-[microsecond]", d1.microsecond == 0 && d2.microsecond == 2)
TEST(@"-[minute]", d1.minute == 0 && d2.minute == 0)
|