File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -118,14 +118,20 @@ class TestDateInterval: XCTestCase {
118
118
}
119
119
120
120
func test_contains( ) {
121
+ let date0 = dateWithString ( " 1964-10-01 06:00:00 +0900 " )
121
122
let date1 = dateWithString ( " 2019-04-04 17:00:00 -0700 " )
122
123
let date2 = dateWithString ( " 2019-04-04 17:30:00 -0700 " )
123
124
let date3 = dateWithString ( " 2019-04-04 17:45:00 -0700 " )
124
125
let date4 = dateWithString ( " 2019-04-04 17:50:00 -0700 " )
125
- let dateInterval = DateInterval ( start: date1, duration: 60 * 45 )
126
- XCTAssertTrue ( dateInterval. contains ( date2) )
127
- XCTAssertTrue ( dateInterval. contains ( date3) )
128
- XCTAssertFalse ( dateInterval. contains ( date4) )
126
+
127
+ XCTAssertTrue ( DateInterval ( start: . distantPast, end: . distantFuture) . contains ( date0) )
128
+ XCTAssertTrue ( DateInterval ( start: . distantPast, end: date1) . contains ( date0) )
129
+ XCTAssertFalse ( DateInterval ( start: . distantPast, end: date1) . contains ( date2) )
130
+ XCTAssertTrue ( DateInterval ( start: date0, end: date4) . contains ( date2) )
131
+ XCTAssertTrue ( DateInterval ( start: date1, duration: 60 * 45 ) . contains ( date3) )
132
+ XCTAssertFalse ( DateInterval ( start: date1, duration: 60 * 45 ) . contains ( date4) )
133
+ XCTAssertTrue ( DateInterval ( start: date2, end: . distantFuture) . contains ( date2) )
134
+ XCTAssertFalse ( DateInterval ( start: date2, end: . distantFuture) . contains ( date0) )
129
135
}
130
136
131
137
func test_hashing( ) {
You can’t perform that action at this time.
0 commit comments