forked from Quick/Nimble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeLessThanOrEqualToTest.swift
43 lines (38 loc) · 1.43 KB
/
BeLessThanOrEqualToTest.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Foundation
import XCTest
import Nimble
final class BeLessThanOrEqualToTest: XCTestCase {
func testLessThanOrEqualTo() {
expect(10).to(beLessThanOrEqualTo(10))
expect(2).to(beLessThanOrEqualTo(10))
expect(2).toNot(beLessThanOrEqualTo(1))
expect(2 as NSNumber).to(beLessThanOrEqualTo(10))
expect(2 as NSNumber).toNot(beLessThanOrEqualTo(1))
expect(2).to(beLessThanOrEqualTo(10 as NSNumber))
expect(2).toNot(beLessThanOrEqualTo(1 as NSNumber))
failsWithErrorMessage("expected to be less than or equal to <0>, got <2>") {
expect(2).to(beLessThanOrEqualTo(0))
return
}
failsWithErrorMessage("expected to not be less than or equal to <0>, got <0>") {
expect(0).toNot(beLessThanOrEqualTo(0))
return
}
failsWithErrorMessageForNil("expected to be less than or equal to <2>, got <nil>") {
expect(nil as Int?).to(beLessThanOrEqualTo(2))
return
}
failsWithErrorMessageForNil("expected to not be less than or equal to <-2>, got <nil>") {
expect(nil as Int?).toNot(beLessThanOrEqualTo(-2))
return
}
}
func testLessThanOrEqualToOperator() {
expect(0) <= 1
expect(1) <= 1
failsWithErrorMessage("expected to be less than or equal to <1>, got <2>") {
expect(2) <= 1
return
}
}
}