@@ -10,7 +10,7 @@ class `Double assert test` {
10
10
lateinit var mockAssertion: AbstractDoubleAssert <* >
11
11
@Suppress(" UNCHECKED_CAST" )
12
12
val _expect = object : AssertionHook {
13
- override fun that (subjectUnderTest : Double? ): DoubleAssert {
13
+ override fun that (subjectUnderTest : Double? ): DoubleAssert {
14
14
val spy: AbstractDoubleAssert <* > = spy(Assertions .assertThat(subjectUnderTest))
15
15
mockAssertion = spy
16
16
return DoubleAssert (subjectUnderTest, mockAssertion)
@@ -28,100 +28,142 @@ class `Double assert test` {
28
28
private val one = 1.0
29
29
private val negativeOne = - one
30
30
31
+ @Test
32
+ fun isEqualTo () {
33
+ three isEqualTo three andCanBe chained
34
+ }
35
+
36
+ @Test
37
+ fun isNotEqualTo () {
38
+ three isNotEqualTo four andCanBe chained
39
+ }
40
+
41
+ @Test
42
+ fun isInstance () {
43
+ three isInstance of<Double >() andCanBe chained
44
+ }
45
+
46
+ @Test
47
+ fun is_ () {
48
+ three is_ notNull andCanBe chained
49
+ three is_ notNegative andCanBe chained
50
+ }
51
+
52
+ @Test
53
+ fun describedAs () {
54
+ three describedAs " foo" andCanBe chained
55
+ }
56
+
31
57
@Test
32
58
fun isLessThan () {
33
59
_expect that three isLessThan four andCanBe chained
60
+ three isLessThan four andCanBe chained
34
61
verify.isLessThan(four)
35
62
}
36
63
37
64
@Test
38
65
fun isLessThanOrEqualTo () {
39
66
_expect that four isLessThanOrEqualTo four andCanBe chained
67
+ four isLessThanOrEqualTo four andCanBe chained
40
68
verify.isLessThanOrEqualTo(four)
41
69
}
42
70
43
71
@Test
44
72
fun isGreaterThan () {
45
73
_expect that five isGreaterThan four andCanBe chained
74
+ five isGreaterThan four andCanBe chained
46
75
verify.isGreaterThan(four)
47
76
}
48
77
49
78
@Test
50
79
fun isGreaterThanOrEqualTo () {
51
80
_expect that four isGreaterThanOrEqualTo four andCanBe chained
81
+ four isGreaterThanOrEqualTo four andCanBe chained
52
82
verify.isGreaterThanOrEqualTo(four)
53
83
}
54
84
55
85
@Test
56
86
fun isBetween () {
57
87
_expect that four isBetween (three.. five) andCanBe chained
88
+ four isBetween (three.. five) andCanBe chained
58
89
verify.isBetween(three, five)
59
90
}
60
91
61
92
@Test
62
93
fun isStrictlyBetween () {
63
94
_expect that four isStrictlyBetween (three.. five) andCanBe chained
95
+ four isStrictlyBetween (three.. five) andCanBe chained
64
96
verify.isStrictlyBetween(three, five)
65
97
}
66
98
67
99
@Test
68
100
fun `isCloseTo within` () {
69
101
_expect that four isCloseTo three withinOffset one andCanBe chained
102
+ four isCloseTo three withinOffset one andCanBe chained
70
103
verify.isCloseTo(three, Assertions .within(one))
71
104
}
72
105
73
106
@Test
74
107
fun `isCloseTo percentage int` () {
75
108
_expect that three isCloseTo four withinPercentage 25 andCanBe chained
109
+ three isCloseTo four withinPercentage 25 andCanBe chained
76
110
verify.isCloseTo(four, Assertions .withinPercentage(25 ))
77
111
}
78
112
79
113
@Test
80
114
fun `isCloseTo percentage double` () {
81
115
_expect that three isCloseTo four withinPercentage 25.3 andCanBe chained
116
+ three isCloseTo four withinPercentage 25.3 andCanBe chained
82
117
verify.isCloseTo(four, Assertions .withinPercentage(25.3 ))
83
118
}
84
119
85
120
@Test
86
121
fun `isCloseTo percentage float` () {
87
122
_expect that three isCloseTo four withinPercentage 25f andCanBe chained
123
+ three isCloseTo four withinPercentage 25f andCanBe chained
88
124
verify.isCloseTo(four, Assertions .withinPercentage(25 ))
89
125
}
90
126
91
127
@Test
92
128
fun isZero () {
93
129
_expect that 0.0 _is zero andCanBe chained
130
+ 0.0 _is zero andCanBe chained
94
131
verify.isZero()
95
132
}
96
133
97
134
@Test
98
135
fun isNotZero () {
99
136
_expect that one _is notZero andCanBe chained
137
+ one _is notZero andCanBe chained
100
138
verify.isNotZero()
101
139
}
102
140
103
141
@Test
104
142
fun isPositive () {
105
143
_expect that one _is positive andCanBe chained
144
+ one _is positive andCanBe chained
106
145
verify.isPositive()
107
146
}
108
147
109
148
110
149
@Test
111
150
fun isNotPositive () {
112
151
_expect that negativeOne _is notPositive andCanBe chained
152
+ negativeOne _is notPositive andCanBe chained
113
153
verify.isNotPositive()
114
154
}
115
155
116
156
@Test
117
157
fun isNegative () {
118
158
_expect that negativeOne _is negative andCanBe chained
159
+ negativeOne _is negative andCanBe chained
119
160
verify.isNegative()
120
161
}
121
162
122
163
@Test
123
164
fun isNotNegative () {
124
165
_expect that one _is notNegative andCanBe chained
166
+ one _is notNegative andCanBe chained
125
167
verify.isNotNegative()
126
168
}
127
169
0 commit comments