30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDate *d1, *d2;
TEST(@"+[dateWithTimeIntervalSince1970:]",
(d1 = [OFDate dateWithTimeIntervalSince1970: 0]))
TEST(@"+[dateWithTimeIntervalSince1970:microseconds:]",
(d2 = [OFDate dateWithTimeIntervalSince1970: 3600 * 25 + 5
microseconds: 1]))
TEST(@"-[description]",
[[d1 description] isEqual: @"1970-01-01T00:00:00Z"] &&
[[d2 description] isEqual: @"1970-01-02T01:00:05Z"])
TEST(@"-[isEqual:]",
[d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] &&
![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0
microseconds: 1]])
TEST(@"-[compare:]", [d1 compare: d2] == OF_ORDERED_ASCENDING)
TEST(@"-[seconds]", [d1 second] == 0 && [d2 second] == 5)
TEST(@"-[microsecond]",
[d1 microsecond] == 0 && [d2 microsecond] == 1)
TEST(@"-[minute]", [d1 minute] == 0 && [d2 minute] == 0)
TEST(@"-[hour]", [d1 hour] == 0 && [d2 hour] == 1)
|
|
|
|
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDate *d1, *d2;
TEST(@"+[dateWithTimeIntervalSince1970:]",
(d1 = [OFDate dateWithTimeIntervalSince1970: 0]))
TEST(@"+[dateWithTimeIntervalSince1970:microseconds:]",
(d2 = [d1 dateByAddingTimeInterval: 3600 * 25 + 5
withMicroseconds: 1]))
TEST(@"-[description]",
[[d1 description] isEqual: @"1970-01-01T00:00:00Z"] &&
[[d2 description] isEqual: @"1970-01-02T01:00:05Z"])
TEST(@"-[isEqual:]",
[d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] &&
![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0
microseconds: 1]])
TEST(@"-[compare:]", [d1 compare: d2] == OF_ORDERED_ASCENDING)
TEST(@"-[second]", [d1 second] == 0 && [d2 second] == 5)
TEST(@"-[microsecond]",
[d1 microsecond] == 0 && [d2 microsecond] == 1)
TEST(@"-[minute]", [d1 minute] == 0 && [d2 minute] == 0)
TEST(@"-[hour]", [d1 hour] == 0 && [d2 hour] == 1)
|