10
10
class TestDateInterval : XCTestCase {
11
11
static var allTests : [ ( String , ( TestDateInterval ) -> ( ) throws -> Void ) ] {
12
12
return [
13
- ( " test_default_constructor " , test_default_constructor ) ,
14
- ( " test_start_end_constructor " , test_start_end_constructor ) ,
15
- ( " test_start_duration_constructor " , test_start_duration_constructor ) ,
16
- ( " test_compare_different_starts " , test_compare_different_starts ) ,
17
- ( " test_compare_different_durations " , test_compare_different_durations ) ,
18
- ( " test_compare_same " , test_compare_same ) ,
19
- ( " test_comparison_operators " , test_comparison_operators ) ,
13
+ ( " test_defaultConstructor " , test_defaultConstructor ) ,
14
+ ( " test_startEndConstructor " , test_startEndConstructor ) ,
15
+ ( " test_startDurationConstructor " , test_startDurationConstructor ) ,
16
+ ( " test_compareDifferentStarts " , test_compareDifferentStarts ) ,
17
+ ( " test_compareDifferentDurations " , test_compareDifferentDurations ) ,
18
+ ( " test_compareSame " , test_compareSame ) ,
19
+ ( " test_comparisonOperators " , test_comparisonOperators ) ,
20
20
( " test_intersects " , test_intersects) ,
21
21
( " test_intersection " , test_intersection) ,
22
- ( " test_intersection_zero_duration " , test_intersection_zero_duration ) ,
23
- ( " test_intersection_nil " , test_intersection_nil ) ,
22
+ ( " test_intersectionZeroDuration " , test_intersectionZeroDuration ) ,
23
+ ( " test_intersectionNil " , test_intersectionNil ) ,
24
24
( " test_contains " , test_contains) ,
25
25
( " test_hashing " , test_hashing) ,
26
26
]
27
27
}
28
28
29
- func test_default_constructor ( ) {
29
+ func test_defaultConstructor ( ) {
30
30
let dateInterval = DateInterval ( )
31
31
XCTAssertEqual ( dateInterval. duration, 0 )
32
32
}
33
33
34
- func test_start_end_constructor ( ) {
34
+ func test_startEndConstructor ( ) {
35
35
let date1 = dateWithString ( " 2019-04-04 17:09:23 -0700 " )
36
36
let date2 = dateWithString ( " 2019-04-04 18:09:23 -0700 " )
37
37
let dateInterval = DateInterval ( start: date1, end: date2)
38
38
XCTAssertEqual ( dateInterval. duration, 60 * 60 )
39
39
}
40
40
41
- func test_start_duration_constructor ( ) {
41
+ func test_startDurationConstructor ( ) {
42
42
let date = dateWithString ( " 2019-04-04 17:09:23 -0700 " )
43
43
let dateInterval = DateInterval ( start: date, duration: 60 )
44
44
XCTAssertEqual ( dateInterval. duration, 60 )
45
45
}
46
46
47
- func test_compare_different_starts ( ) {
47
+ func test_compareDifferentStarts ( ) {
48
48
let date1 = dateWithString ( " 2019-04-04 17:09:23 -0700 " )
49
49
let date2 = dateWithString ( " 2019-04-04 18:09:23 -0700 " )
50
50
let dateInterval1 = DateInterval ( start: date1, duration: 100 )
@@ -53,23 +53,23 @@ class TestDateInterval: XCTestCase {
53
53
XCTAssertEqual ( dateInterval2. compare ( dateInterval1) , . orderedDescending)
54
54
}
55
55
56
- func test_compare_different_durations ( ) {
56
+ func test_compareDifferentDurations ( ) {
57
57
let date = dateWithString ( " 2019-04-04 17:09:23 -0700 " )
58
58
let dateInterval1 = DateInterval ( start: date, duration: 60 )
59
59
let dateInterval2 = DateInterval ( start: date, duration: 90 )
60
60
XCTAssertEqual ( dateInterval1. compare ( dateInterval2) , . orderedAscending)
61
61
XCTAssertEqual ( dateInterval2. compare ( dateInterval1) , . orderedDescending)
62
62
}
63
63
64
- func test_compare_same ( ) {
64
+ func test_compareSame ( ) {
65
65
let date = dateWithString ( " 2019-04-04 17:09:23 -0700 " )
66
66
let dateInterval1 = DateInterval ( start: date, duration: 60 )
67
67
let dateInterval2 = DateInterval ( start: date, duration: 60 )
68
68
XCTAssertEqual ( dateInterval1. compare ( dateInterval2) , . orderedSame)
69
69
XCTAssertEqual ( dateInterval2. compare ( dateInterval1) , . orderedSame)
70
70
}
71
71
72
- func test_comparison_operators ( ) {
72
+ func test_comparisonOperators ( ) {
73
73
let date1 = dateWithString ( " 2019-04-04 17:00:00 -0700 " )
74
74
let date2 = dateWithString ( " 2019-04-04 17:30:00 -0700 " )
75
75
let dateInterval1 = DateInterval ( start: date1, duration: 60 )
@@ -99,7 +99,7 @@ class TestDateInterval: XCTestCase {
99
99
XCTAssertEqual ( intersection!. duration, 60 * 15 )
100
100
}
101
101
102
- func test_intersection_zero_duration ( ) {
102
+ func test_intersectionZeroDuration ( ) {
103
103
let date1 = dateWithString ( " 2019-04-04 17:00:00 -0700 " )
104
104
let date2 = dateWithString ( " 2019-04-04 17:30:00 -0700 " )
105
105
let dateInterval1 = DateInterval ( start: date1, duration: 60 * 30 )
@@ -109,7 +109,7 @@ class TestDateInterval: XCTestCase {
109
109
XCTAssertEqual ( intersection!. duration, 0 )
110
110
}
111
111
112
- func test_intersection_nil ( ) {
112
+ func test_intersectionNil ( ) {
113
113
let date1 = dateWithString ( " 2019-04-04 17:00:00 -0700 " )
114
114
let date2 = dateWithString ( " 2019-04-04 17:30:01 -0700 " )
115
115
let dateInterval1 = DateInterval ( start: date1, duration: 60 * 30 )
0 commit comments