1/*
2 * Copyright 2001-2008 Artima, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.scalatest.matchers
17
18import org.scalatest._
19
20class ShouldPlusOrMinusSpec extends Spec with ShouldMatchers {
21
22  describe("The be (X plusOrMinus Y) syntax") {
23
24    val sevenDotOh = 7.0
25    val minusSevenDotOh = -7.0
26    val sevenDotOhFloat = 7.0f
27    val minusSevenDotOhFloat = -7.0f
28    val sevenLong = 7L
29    val minusSevenLong = -7L
30    val sevenInt = 7
31    val minusSevenInt = -7
32    val sevenShort: Short = 7
33    val minusSevenShort: Short = -7
34    val sevenByte: Byte = 7
35    val minusSevenByte: Byte = -7
36
37    /*
38      I decided that for X plusOrMinus Y, Y can be any numeric type that's implicitly
39      convertible to X. So if X is Double, Y could be Double, Float, Long, Int, Short, Byte.
40      If X is Long, Y could be Long, Int, Short, Byte. If X is Short, Y could be Short or Byte.
41      And if X is Byte, Y must be Byte.
42      minusSevenDotOhFloat should be (-6.8f plusOrMinus 0.2d)
43    */
44    it("should do nothing if the number is within the specified range") {
45
46      // Double plusOrMinus Double
47      sevenDotOh should be (7.1 plusOrMinus 0.2)
48      sevenDotOh should be (6.9 plusOrMinus 0.2)
49      sevenDotOh should be (7.0 plusOrMinus 0.2)
50      sevenDotOh should be (7.2 plusOrMinus 0.2)
51      sevenDotOh should be (6.8 plusOrMinus 0.2)
52      minusSevenDotOh should be (-7.1 plusOrMinus 0.2)
53      minusSevenDotOh should be (-6.9 plusOrMinus 0.2)
54      minusSevenDotOh should be (-7.0 plusOrMinus 0.2)
55      minusSevenDotOh should be (-7.2 plusOrMinus 0.2)
56      minusSevenDotOh should be (-6.8 plusOrMinus 0.2)
57
58      // Double plusOrMinus Float
59      sevenDotOh should be (7.1 plusOrMinus 0.2f)
60      sevenDotOh should be (6.9 plusOrMinus 0.2f)
61      sevenDotOh should be (7.0 plusOrMinus 0.2f)
62      sevenDotOh should be (7.2 plusOrMinus 0.2f)
63      sevenDotOh should be (6.8 plusOrMinus 0.2f)
64      minusSevenDotOh should be (-7.1 plusOrMinus 0.2f)
65      minusSevenDotOh should be (-6.9 plusOrMinus 0.2f)
66      minusSevenDotOh should be (-7.0 plusOrMinus 0.2f)
67      minusSevenDotOh should be (-7.2 plusOrMinus 0.2f)
68      minusSevenDotOh should be (-6.8 plusOrMinus 0.2f)
69
70      // Double plusOrMinus Long
71      sevenDotOh should be (7.1 plusOrMinus 2L)
72      sevenDotOh should be (6.9 plusOrMinus 2L)
73      sevenDotOh should be (7.0 plusOrMinus 2L)
74      sevenDotOh should be (7.2 plusOrMinus 2L)
75      sevenDotOh should be (6.8 plusOrMinus 2L)
76      minusSevenDotOh should be (-7.1 plusOrMinus 2L)
77      minusSevenDotOh should be (-6.9 plusOrMinus 2L)
78      minusSevenDotOh should be (-7.0 plusOrMinus 2L)
79      minusSevenDotOh should be (-7.2 plusOrMinus 2L)
80      minusSevenDotOh should be (-6.8 plusOrMinus 2L)
81
82      // Double plusOrMinus Int
83      sevenDotOh should be (7.1 plusOrMinus 2)
84      sevenDotOh should be (6.9 plusOrMinus 2)
85      sevenDotOh should be (7.0 plusOrMinus 2)
86      sevenDotOh should be (7.2 plusOrMinus 2)
87      sevenDotOh should be (6.8 plusOrMinus 2)
88      minusSevenDotOh should be (-7.1 plusOrMinus 2)
89      minusSevenDotOh should be (-6.9 plusOrMinus 2)
90      minusSevenDotOh should be (-7.0 plusOrMinus 2)
91      minusSevenDotOh should be (-7.2 plusOrMinus 2)
92      minusSevenDotOh should be (-6.8 plusOrMinus 2)
93
94      // Double plusOrMinus Short
95      sevenDotOh should be (7.1 plusOrMinus 2.toShort)
96      sevenDotOh should be (6.9 plusOrMinus 2.toShort)
97      sevenDotOh should be (7.0 plusOrMinus 2.toShort)
98      sevenDotOh should be (7.2 plusOrMinus 2.toShort)
99      sevenDotOh should be (6.8 plusOrMinus 2.toShort)
100      minusSevenDotOh should be (-7.1 plusOrMinus 2.toShort)
101      minusSevenDotOh should be (-6.9 plusOrMinus 2.toShort)
102      minusSevenDotOh should be (-7.0 plusOrMinus 2.toShort)
103      minusSevenDotOh should be (-7.2 plusOrMinus 2.toShort)
104      minusSevenDotOh should be (-6.8 plusOrMinus 2.toShort)
105
106      // Double plusOrMinus Byte
107      sevenDotOh should be (7.1 plusOrMinus 2.toByte)
108      sevenDotOh should be (6.9 plusOrMinus 2.toByte)
109      sevenDotOh should be (7.0 plusOrMinus 2.toByte)
110      sevenDotOh should be (7.2 plusOrMinus 2.toByte)
111      sevenDotOh should be (6.8 plusOrMinus 2.toByte)
112      minusSevenDotOh should be (-7.1 plusOrMinus 2.toByte)
113      minusSevenDotOh should be (-6.9 plusOrMinus 2.toByte)
114      minusSevenDotOh should be (-7.0 plusOrMinus 2.toByte)
115      minusSevenDotOh should be (-7.2 plusOrMinus 2.toByte)
116      minusSevenDotOh should be (-6.8 plusOrMinus 2.toByte)
117
118      // Float plusOrMinus Float
119      sevenDotOhFloat should be (7.1f plusOrMinus 0.2f)
120      sevenDotOhFloat should be (6.9f plusOrMinus 0.2f)
121      sevenDotOhFloat should be (7.0f plusOrMinus 0.2f)
122      sevenDotOhFloat should be (7.2f plusOrMinus 0.2f)
123      sevenDotOhFloat should be (6.8f plusOrMinus 0.2f)
124      minusSevenDotOhFloat should be (-7.1f plusOrMinus 0.2f)
125      minusSevenDotOhFloat should be (-6.9f plusOrMinus 0.2f)
126      minusSevenDotOhFloat should be (-7.0f plusOrMinus 0.2f)
127      minusSevenDotOhFloat should be (-7.2f plusOrMinus 0.2f)
128      minusSevenDotOhFloat should be (-6.8f plusOrMinus 0.2f)
129
130      // Float plusOrMinus Long
131      sevenDotOhFloat should be (7.1f plusOrMinus 2L)
132      sevenDotOhFloat should be (6.9f plusOrMinus 2L)
133      sevenDotOhFloat should be (7.0f plusOrMinus 2L)
134      sevenDotOhFloat should be (7.2f plusOrMinus 2L)
135      sevenDotOhFloat should be (6.8f plusOrMinus 2L)
136      minusSevenDotOhFloat should be (-7.1f plusOrMinus 2L)
137      minusSevenDotOhFloat should be (-6.9f plusOrMinus 2L)
138      minusSevenDotOhFloat should be (-7.0f plusOrMinus 2L)
139      minusSevenDotOhFloat should be (-7.2f plusOrMinus 2L)
140      minusSevenDotOhFloat should be (-6.8f plusOrMinus 2L)
141
142      // Float plusOrMinus Int
143      sevenDotOhFloat should be (7.1f plusOrMinus 2)
144      sevenDotOhFloat should be (6.9f plusOrMinus 2)
145      sevenDotOhFloat should be (7.0f plusOrMinus 2)
146      sevenDotOhFloat should be (7.2f plusOrMinus 2)
147      sevenDotOhFloat should be (6.8f plusOrMinus 2)
148      minusSevenDotOhFloat should be (-7.1f plusOrMinus 2)
149      minusSevenDotOhFloat should be (-6.9f plusOrMinus 2)
150      minusSevenDotOhFloat should be (-7.0f plusOrMinus 2)
151      minusSevenDotOhFloat should be (-7.2f plusOrMinus 2)
152      minusSevenDotOhFloat should be (-6.8f plusOrMinus 2)
153
154      // Float plusOrMinus Short
155      sevenDotOhFloat should be (7.1f plusOrMinus 2.toShort)
156      sevenDotOhFloat should be (6.9f plusOrMinus 2.toShort)
157      sevenDotOhFloat should be (7.0f plusOrMinus 2.toShort)
158      sevenDotOhFloat should be (7.2f plusOrMinus 2.toShort)
159      sevenDotOhFloat should be (6.8f plusOrMinus 2.toShort)
160      minusSevenDotOhFloat should be (-7.1f plusOrMinus 2.toShort)
161      minusSevenDotOhFloat should be (-6.9f plusOrMinus 2.toShort)
162      minusSevenDotOhFloat should be (-7.0f plusOrMinus 2.toShort)
163      minusSevenDotOhFloat should be (-7.2f plusOrMinus 2.toShort)
164      minusSevenDotOhFloat should be (-6.8f plusOrMinus 2.toShort)
165
166      // Float plusOrMinus Byte
167      sevenDotOhFloat should be (7.1f plusOrMinus 2.toByte)
168      sevenDotOhFloat should be (6.9f plusOrMinus 2.toByte)
169      sevenDotOhFloat should be (7.0f plusOrMinus 2.toByte)
170      sevenDotOhFloat should be (7.2f plusOrMinus 2.toByte)
171      sevenDotOhFloat should be (6.8f plusOrMinus 2.toByte)
172      minusSevenDotOhFloat should be (-7.1f plusOrMinus 2.toByte)
173      minusSevenDotOhFloat should be (-6.9f plusOrMinus 2.toByte)
174      minusSevenDotOhFloat should be (-7.0f plusOrMinus 2.toByte)
175      minusSevenDotOhFloat should be (-7.2f plusOrMinus 2.toByte)
176      minusSevenDotOhFloat should be (-6.8f plusOrMinus 2.toByte)
177
178      // Long plusOrMinus Long
179      sevenLong should be (9L plusOrMinus 2L)
180      sevenLong should be (8L plusOrMinus 2L)
181      sevenLong should be (7L plusOrMinus 2L)
182      sevenLong should be (6L plusOrMinus 2L)
183      sevenLong should be (5L plusOrMinus 2L)
184      minusSevenLong should be (-9L plusOrMinus 2L)
185      minusSevenLong should be (-8L plusOrMinus 2L)
186      minusSevenLong should be (-7L plusOrMinus 2L)
187      minusSevenLong should be (-6L plusOrMinus 2L)
188      minusSevenLong should be (-5L plusOrMinus 2L)
189
190      // Long plusOrMinus Int
191      sevenLong should be (9L plusOrMinus 2)
192      sevenLong should be (8L plusOrMinus 2)
193      sevenLong should be (7L plusOrMinus 2)
194      sevenLong should be (6L plusOrMinus 2)
195      sevenLong should be (5L plusOrMinus 2)
196      minusSevenLong should be (-9L plusOrMinus 2)
197      minusSevenLong should be (-8L plusOrMinus 2)
198      minusSevenLong should be (-7L plusOrMinus 2)
199      minusSevenLong should be (-6L plusOrMinus 2)
200      minusSevenLong should be (-5L plusOrMinus 2)
201
202      // Long plusOrMinus Short
203      sevenLong should be (9L plusOrMinus 2.toShort)
204      sevenLong should be (8L plusOrMinus 2.toShort)
205      sevenLong should be (7L plusOrMinus 2.toShort)
206      sevenLong should be (6L plusOrMinus 2.toShort)
207      sevenLong should be (5L plusOrMinus 2.toShort)
208      minusSevenLong should be (-9L plusOrMinus 2.toShort)
209      minusSevenLong should be (-8L plusOrMinus 2.toShort)
210      minusSevenLong should be (-7L plusOrMinus 2.toShort)
211      minusSevenLong should be (-6L plusOrMinus 2.toShort)
212      minusSevenLong should be (-5L plusOrMinus 2.toShort)
213
214      // Long plusOrMinus Byte
215      sevenLong should be (9L plusOrMinus 2.toByte)
216      sevenLong should be (8L plusOrMinus 2.toByte)
217      sevenLong should be (7L plusOrMinus 2.toByte)
218      sevenLong should be (6L plusOrMinus 2.toByte)
219      sevenLong should be (5L plusOrMinus 2.toByte)
220      minusSevenLong should be (-9L plusOrMinus 2.toByte)
221      minusSevenLong should be (-8L plusOrMinus 2.toByte)
222      minusSevenLong should be (-7L plusOrMinus 2.toByte)
223      minusSevenLong should be (-6L plusOrMinus 2.toByte)
224      minusSevenLong should be (-5L plusOrMinus 2.toByte)
225
226      // Int plusOrMinus Int
227      sevenInt should be (9 plusOrMinus 2)
228      sevenInt should be (8 plusOrMinus 2)
229      sevenInt should be (7 plusOrMinus 2)
230      sevenInt should be (6 plusOrMinus 2)
231      sevenInt should be (5 plusOrMinus 2)
232      minusSevenInt should be (-9 plusOrMinus 2)
233      minusSevenInt should be (-8 plusOrMinus 2)
234      minusSevenInt should be (-7 plusOrMinus 2)
235      minusSevenInt should be (-6 plusOrMinus 2)
236      minusSevenInt should be (-5 plusOrMinus 2)
237
238      // Int plusOrMinus Short
239      sevenInt should be (9 plusOrMinus 2.toShort)
240      sevenInt should be (8 plusOrMinus 2.toShort)
241      sevenInt should be (7 plusOrMinus 2.toShort)
242      sevenInt should be (6 plusOrMinus 2.toShort)
243      sevenInt should be (5 plusOrMinus 2.toShort)
244      minusSevenInt should be (-9 plusOrMinus 2.toShort)
245      minusSevenInt should be (-8 plusOrMinus 2.toShort)
246      minusSevenInt should be (-7 plusOrMinus 2.toShort)
247      minusSevenInt should be (-6 plusOrMinus 2.toShort)
248      minusSevenInt should be (-5 plusOrMinus 2.toShort)
249
250      // Int plusOrMinus Byte
251      sevenInt should be (9 plusOrMinus 2.toByte)
252      sevenInt should be (8 plusOrMinus 2.toByte)
253      sevenInt should be (7 plusOrMinus 2.toByte)
254      sevenInt should be (6 plusOrMinus 2.toByte)
255      sevenInt should be (5 plusOrMinus 2.toByte)
256      minusSevenInt should be (-9 plusOrMinus 2.toByte)
257      minusSevenInt should be (-8 plusOrMinus 2.toByte)
258      minusSevenInt should be (-7 plusOrMinus 2.toByte)
259      minusSevenInt should be (-6 plusOrMinus 2.toByte)
260      minusSevenInt should be (-5 plusOrMinus 2.toByte)
261
262      // Short plusOrMinus Short
263      sevenShort should be (9.toShort plusOrMinus 2.toShort)
264      sevenShort should be (8.toShort plusOrMinus 2.toShort)
265      sevenShort should be (7.toShort plusOrMinus 2.toShort)
266      sevenShort should be (6.toShort plusOrMinus 2.toShort)
267      sevenShort should be (5.toShort plusOrMinus 2.toShort)
268      minusSevenShort should be ((-9).toShort plusOrMinus 2.toShort)
269      minusSevenShort should be ((-8).toShort plusOrMinus 2.toShort)
270      minusSevenShort should be ((-7).toShort plusOrMinus 2.toShort)
271      minusSevenShort should be ((-6).toShort plusOrMinus 2.toShort)
272      minusSevenShort should be ((-5).toShort plusOrMinus 2.toShort)
273
274      // Short plusOrMinus Byte
275      sevenShort should be (9.toShort plusOrMinus 2.toByte)
276      sevenShort should be (8.toShort plusOrMinus 2.toByte)
277      sevenShort should be (7.toShort plusOrMinus 2.toByte)
278      sevenShort should be (6.toShort plusOrMinus 2.toByte)
279      sevenShort should be (5.toShort plusOrMinus 2.toByte)
280      minusSevenShort should be ((-9).toShort plusOrMinus 2.toByte)
281      minusSevenShort should be ((-8).toShort plusOrMinus 2.toByte)
282      minusSevenShort should be ((-7).toShort plusOrMinus 2.toByte)
283      minusSevenShort should be ((-6).toShort plusOrMinus 2.toByte)
284      minusSevenShort should be ((-5).toShort plusOrMinus 2.toByte)
285
286      // Byte plusOrMinus Byte
287      sevenByte should be (9.toByte plusOrMinus 2.toByte)
288      sevenByte should be (8.toByte plusOrMinus 2.toByte)
289      sevenByte should be (7.toByte plusOrMinus 2.toByte)
290      sevenByte should be (6.toByte plusOrMinus 2.toByte)
291      sevenByte should be (5.toByte plusOrMinus 2.toByte)
292      minusSevenByte should be ((-9).toByte plusOrMinus 2.toByte)
293      minusSevenByte should be ((-8).toByte plusOrMinus 2.toByte)
294      minusSevenByte should be ((-7).toByte plusOrMinus 2.toByte)
295      minusSevenByte should be ((-6).toByte plusOrMinus 2.toByte)
296      minusSevenByte should be ((-5).toByte plusOrMinus 2.toByte)
297    }
298
299    it("should do nothing if the number is within the specified range, when used with not") {
300
301      // Double plusOrMinus Double
302      sevenDotOh should not { be (7.5 plusOrMinus 0.2) }
303      sevenDotOh should not be (7.5 plusOrMinus 0.2)
304      sevenDotOh should not be (6.5 plusOrMinus 0.2)
305      minusSevenDotOh should not { be (-7.5 plusOrMinus 0.2) }
306      minusSevenDotOh should not be (-7.5 plusOrMinus 0.2)
307      minusSevenDotOh should not be (-6.5 plusOrMinus 0.2)
308
309      // Double plusOrMinus Float
310      sevenDotOh should not { be (7.5 plusOrMinus 0.2f) }
311      sevenDotOh should not be (7.5 plusOrMinus 0.2f)
312      sevenDotOh should not be (6.5 plusOrMinus 0.2f)
313      minusSevenDotOh should not { be (-7.5 plusOrMinus 0.2f) }
314      minusSevenDotOh should not be (-7.5 plusOrMinus 0.2f)
315      minusSevenDotOh should not be (-6.5 plusOrMinus 0.2f)
316
317      // Double plusOrMinus Long
318      sevenDotOh should not { be (10.0 plusOrMinus 2L) }
319      sevenDotOh should not be (4.0 plusOrMinus 2L)
320      sevenDotOh should not be (9.1 plusOrMinus 2L)
321      minusSevenDotOh should not { be (-10.0 plusOrMinus 2L) }
322      minusSevenDotOh should not be (-4.0 plusOrMinus 2L)
323      minusSevenDotOh should not be (-9.1 plusOrMinus 2L)
324
325      // Double plusOrMinus Int
326      sevenDotOh should not { be (10.0 plusOrMinus 2) }
327      sevenDotOh should not be (4.0 plusOrMinus 2)
328      sevenDotOh should not be (9.1 plusOrMinus 2)
329      minusSevenDotOh should not { be (-10.0 plusOrMinus 2) }
330      minusSevenDotOh should not be (-4.0 plusOrMinus 2)
331      minusSevenDotOh should not be (-9.1 plusOrMinus 2)
332
333      // Double plusOrMinus Short
334      sevenDotOh should not { be (10.0 plusOrMinus 2.toShort) }
335      sevenDotOh should not be (4.0 plusOrMinus 2.toShort)
336      sevenDotOh should not be (9.1 plusOrMinus 2.toShort)
337      minusSevenDotOh should not { be (-10.0 plusOrMinus 2.toShort) }
338      minusSevenDotOh should not be (-4.0 plusOrMinus 2.toShort)
339      minusSevenDotOh should not be (-9.1 plusOrMinus 2.toShort)
340
341      // Double plusOrMinus Byte
342      sevenDotOh should not { be (10.0 plusOrMinus 2.toByte) }
343      sevenDotOh should not be (4.0 plusOrMinus 2.toByte)
344      sevenDotOh should not be (9.1 plusOrMinus 2.toByte)
345      minusSevenDotOh should not { be (-10.0 plusOrMinus 2.toByte) }
346      minusSevenDotOh should not be (-4.0 plusOrMinus 2.toByte)
347      minusSevenDotOh should not be (-9.1 plusOrMinus 2.toByte)
348
349      // Float plusOrMinus Float
350      sevenDotOhFloat should not { be (7.5f plusOrMinus 0.2f) }
351      sevenDotOhFloat should not be (7.5f plusOrMinus 0.2f)
352      sevenDotOhFloat should not be (6.5f plusOrMinus 0.2f)
353      minusSevenDotOhFloat should not { be (-7.5f plusOrMinus 0.2f) }
354      minusSevenDotOhFloat should not be (-7.5f plusOrMinus 0.2f)
355      minusSevenDotOhFloat should not be (-6.5f plusOrMinus 0.2f)
356
357      // Float plusOrMinus Long
358      sevenDotOhFloat should not { be (10.0f plusOrMinus 2L) }
359      sevenDotOhFloat should not be (4.0f plusOrMinus 2L)
360      sevenDotOhFloat should not be (9.1f plusOrMinus 2L)
361      minusSevenDotOhFloat should not { be (-10.0f plusOrMinus 2L) }
362      minusSevenDotOhFloat should not be (-4.0f plusOrMinus 2L)
363      minusSevenDotOhFloat should not be (-9.1f plusOrMinus 2L)
364
365      // Float plusOrMinus Int
366      sevenDotOhFloat should not { be (10.0f plusOrMinus 2) }
367      sevenDotOhFloat should not be (4.0f plusOrMinus 2)
368      sevenDotOhFloat should not be (9.1f plusOrMinus 2)
369      minusSevenDotOhFloat should not { be (-10.0f plusOrMinus 2) }
370      minusSevenDotOhFloat should not be (-4.0f plusOrMinus 2)
371      minusSevenDotOhFloat should not be (-9.1f plusOrMinus 2)
372
373      // Float plusOrMinus Short
374      sevenDotOhFloat should not { be (10.0f plusOrMinus 2.toShort) }
375      sevenDotOhFloat should not be (4.0f plusOrMinus 2.toShort)
376      sevenDotOhFloat should not be (9.1f plusOrMinus 2.toShort)
377      minusSevenDotOhFloat should not { be (-10.0f plusOrMinus 2.toShort) }
378      minusSevenDotOhFloat should not be (-4.0f plusOrMinus 2.toShort)
379      minusSevenDotOhFloat should not be (-9.1f plusOrMinus 2.toShort)
380
381      // Float plusOrMinus Byte
382      sevenDotOhFloat should not { be (10.0f plusOrMinus 2.toByte) }
383      sevenDotOhFloat should not be (4.0f plusOrMinus 2.toByte)
384      sevenDotOhFloat should not be (9.1f plusOrMinus 2.toByte)
385      minusSevenDotOhFloat should not { be (-10.0f plusOrMinus 2.toByte) }
386      minusSevenDotOhFloat should not be (-4.0f plusOrMinus 2.toByte)
387      minusSevenDotOhFloat should not be (-9.1f plusOrMinus 2.toByte)
388
389      // Long plusOrMinus Long
390      sevenLong should not { be (10L plusOrMinus 2L) }
391      sevenLong should not be (4L plusOrMinus 2L)
392      sevenLong should not be (10L plusOrMinus 2L)
393      minusSevenLong should not { be (-10L plusOrMinus 2L) }
394      minusSevenLong should not be (-4L plusOrMinus 2L)
395      minusSevenLong should not be (-10L plusOrMinus 2L)
396
397      // Long plusOrMinus Int
398      sevenLong should not { be (10L plusOrMinus 2) }
399      sevenLong should not be (4L plusOrMinus 2)
400      sevenLong should not be (10L plusOrMinus 2)
401      minusSevenLong should not { be (-10L plusOrMinus 2) }
402      minusSevenLong should not be (-4L plusOrMinus 2)
403      minusSevenLong should not be (-10L plusOrMinus 2)
404
405      // Long plusOrMinus Short
406      sevenLong should not { be (10L plusOrMinus 2.toShort) }
407      sevenLong should not be (4L plusOrMinus 2.toShort)
408      sevenLong should not be (10L plusOrMinus 2.toShort)
409      minusSevenLong should not { be (-10L plusOrMinus 2.toShort) }
410      minusSevenLong should not be (-4L plusOrMinus 2.toShort)
411      minusSevenLong should not be (-10L plusOrMinus 2.toShort)
412
413      // Long plusOrMinus Byte
414      sevenLong should not { be (10L plusOrMinus 2.toByte) }
415      sevenLong should not be (4L plusOrMinus 2.toByte)
416      sevenLong should not be (10L plusOrMinus 2.toByte)
417      minusSevenLong should not { be (-10L plusOrMinus 2.toByte) }
418      minusSevenLong should not be (-4L plusOrMinus 2.toByte)
419      minusSevenLong should not be (-10L plusOrMinus 2.toByte)
420
421      // Int plusOrMinus Int
422      sevenInt should not { be (10 plusOrMinus 2) }
423      sevenInt should not be (4 plusOrMinus 2)
424      sevenInt should not be (10 plusOrMinus 2)
425      minusSevenInt should not { be (-10 plusOrMinus 2) }
426      minusSevenInt should not be (-4 plusOrMinus 2)
427      minusSevenInt should not be (-10 plusOrMinus 2)
428
429      // Int plusOrMinus Short
430      sevenInt should not { be (10 plusOrMinus 2.toShort) }
431      sevenInt should not be (4 plusOrMinus 2.toShort)
432      sevenInt should not be (10 plusOrMinus 2.toShort)
433      minusSevenInt should not { be (-10 plusOrMinus 2.toShort) }
434      minusSevenInt should not be (-4 plusOrMinus 2.toShort)
435      minusSevenInt should not be (-10 plusOrMinus 2.toShort)
436
437      // Int plusOrMinus Byte
438      sevenInt should not { be (10 plusOrMinus 2.toByte) }
439      sevenInt should not be (4 plusOrMinus 2.toByte)
440      sevenInt should not be (10 plusOrMinus 2.toByte)
441      minusSevenInt should not { be (-10 plusOrMinus 2.toByte) }
442      minusSevenInt should not be (-4 plusOrMinus 2.toByte)
443      minusSevenInt should not be (-10 plusOrMinus 2.toByte)
444
445      // Short plusOrMinus Short
446      sevenShort should not { be (10.toShort plusOrMinus 2.toShort) }
447      sevenShort should not be (4.toShort plusOrMinus 2.toShort)
448      sevenShort should not be (10.toShort plusOrMinus 2.toShort)
449      minusSevenShort should not { be ((-10).toShort plusOrMinus 2.toShort) }
450      minusSevenShort should not be ((-4).toShort plusOrMinus 2.toShort)
451      minusSevenShort should not be ((-10).toShort plusOrMinus 2.toShort)
452
453      // Short plusOrMinus Byte
454      sevenShort should not { be (10.toShort plusOrMinus 2.toByte) }
455      sevenShort should not be (4.toShort plusOrMinus 2.toByte)
456      sevenShort should not be (10.toShort plusOrMinus 2.toByte)
457      minusSevenShort should not { be ((-10).toShort plusOrMinus 2.toByte) }
458      minusSevenShort should not be ((-4).toShort plusOrMinus 2.toByte)
459      minusSevenShort should not be ((-10).toShort plusOrMinus 2.toByte)
460
461      // Byte plusOrMinus Byte
462      sevenByte should not { be (10.toByte plusOrMinus 2.toByte) }
463      sevenByte should not be (4.toByte plusOrMinus 2.toByte)
464      sevenByte should not be (10.toByte plusOrMinus 2.toByte)
465      minusSevenByte should not { be ((-10).toByte plusOrMinus 2.toByte) }
466      minusSevenByte should not be ((-4).toByte plusOrMinus 2.toByte)
467      minusSevenByte should not be ((-10).toByte plusOrMinus 2.toByte)
468    }
469
470    it("should do nothing if the number is within the specified range, when used in a logical-and expression") {
471
472      // Double plusOrMinus Double
473      sevenDotOh should ((be (7.1 plusOrMinus 0.2)) and (be (7.1 plusOrMinus 0.2)))
474      sevenDotOh should (be (6.9 plusOrMinus 0.2) and (be (7.1 plusOrMinus 0.2)))
475      sevenDotOh should (be (7.0 plusOrMinus 0.2) and be (7.0 plusOrMinus 0.2))
476
477      // Double plusOrMinus Float
478      sevenDotOh should ((be (7.1 plusOrMinus 0.2f)) and (be (7.1 plusOrMinus 0.2f)))
479      sevenDotOh should (be (6.9 plusOrMinus 0.2f) and (be (7.1 plusOrMinus 0.2f)))
480      sevenDotOh should (be (7.0 plusOrMinus 0.2f) and be (7.0 plusOrMinus 0.2f))
481
482      // Double plusOrMinus Long
483      sevenDotOh should ((be (7.1 plusOrMinus 2L)) and (be (7.1 plusOrMinus 2L)))
484      sevenDotOh should (be (6.9 plusOrMinus 2L) and (be (7.1 plusOrMinus 2L)))
485      sevenDotOh should (be (7.0 plusOrMinus 2L) and be (7.0 plusOrMinus 2L))
486
487      // Double plusOrMinus Int
488      sevenDotOh should ((be (7.1 plusOrMinus 2)) and (be (7.1 plusOrMinus 2)))
489      sevenDotOh should (be (6.9 plusOrMinus 2) and (be (7.1 plusOrMinus 2)))
490      sevenDotOh should (be (7.0 plusOrMinus 2) and be (7.0 plusOrMinus 2))
491
492      // Double plusOrMinus Short
493      sevenDotOh should ((be (7.1 plusOrMinus 2.toShort)) and (be (7.1 plusOrMinus 2.toShort)))
494      sevenDotOh should (be (6.9 plusOrMinus 2.toShort) and (be (7.1 plusOrMinus 2.toShort)))
495      sevenDotOh should (be (7.0 plusOrMinus 2.toShort) and be (7.0 plusOrMinus 2.toShort))
496
497      // Double plusOrMinus Byte
498      sevenDotOh should ((be (7.1 plusOrMinus 2.toByte)) and (be (7.1 plusOrMinus 2.toByte)))
499      sevenDotOh should (be (6.9 plusOrMinus 2.toByte) and (be (7.1 plusOrMinus 2.toByte)))
500      sevenDotOh should (be (7.0 plusOrMinus 2.toByte) and be (7.0 plusOrMinus 2.toByte))
501
502      // Float plusOrMinus Float
503      sevenDotOhFloat should ((be (7.1f plusOrMinus 0.2f)) and (be (7.1f plusOrMinus 0.2f)))
504      sevenDotOhFloat should (be (6.9f plusOrMinus 0.2f) and (be (7.1f plusOrMinus 0.2f)))
505      sevenDotOhFloat should (be (7.0f plusOrMinus 0.2f) and be (7.0f plusOrMinus 0.2f))
506
507      // Float plusOrMinus Long
508      sevenDotOhFloat should ((be (7.1f plusOrMinus 2L)) and (be (7.1f plusOrMinus 2L)))
509      sevenDotOhFloat should (be (6.9f plusOrMinus 2L) and (be (7.1f plusOrMinus 2L)))
510      sevenDotOhFloat should (be (7.0f plusOrMinus 2L) and be (7.0f plusOrMinus 2L))
511
512      // Float plusOrMinus Int
513      sevenDotOhFloat should ((be (7.1f plusOrMinus 2)) and (be (7.1f plusOrMinus 2)))
514      sevenDotOhFloat should (be (6.9f plusOrMinus 2) and (be (7.1f plusOrMinus 2)))
515      sevenDotOhFloat should (be (7.0f plusOrMinus 2) and be (7.0f plusOrMinus 2))
516
517      // Float plusOrMinus Short
518      sevenDotOhFloat should ((be (7.1f plusOrMinus 2.toShort)) and (be (7.1f plusOrMinus 2.toShort)))
519      sevenDotOhFloat should (be (6.9f plusOrMinus 2.toShort) and (be (7.1f plusOrMinus 2.toShort)))
520      sevenDotOhFloat should (be (7.0f plusOrMinus 2.toShort) and be (7.0f plusOrMinus 2.toShort))
521
522      // Float plusOrMinus Byte
523      sevenDotOhFloat should ((be (7.1f plusOrMinus 2.toByte)) and (be (7.1f plusOrMinus 2.toByte)))
524      sevenDotOhFloat should (be (6.9f plusOrMinus 2.toByte) and (be (7.1f plusOrMinus 2.toByte)))
525      sevenDotOhFloat should (be (7.0f plusOrMinus 2.toByte) and be (7.0f plusOrMinus 2.toByte))
526
527      // Long plusOrMinus Long
528      sevenLong should ((be (9L plusOrMinus 2L)) and (be (9L plusOrMinus 2L)))
529      sevenLong should (be (8L plusOrMinus 2L) and (be (9L plusOrMinus 2L)))
530      sevenLong should (be (7L plusOrMinus 2L) and be (7L plusOrMinus 2L))
531
532      // Long plusOrMinus Int
533      sevenLong should ((be (9L plusOrMinus 2)) and (be (9L plusOrMinus 2)))
534      sevenLong should (be (8L plusOrMinus 2) and (be (9L plusOrMinus 2)))
535      sevenLong should (be (7L plusOrMinus 2) and be (7L plusOrMinus 2))
536
537      // Long plusOrMinus Short
538      sevenLong should ((be (9L plusOrMinus 2.toShort)) and (be (9L plusOrMinus 2.toShort)))
539      sevenLong should (be (8L plusOrMinus 2.toShort) and (be (9L plusOrMinus 2.toShort)))
540      sevenLong should (be (7L plusOrMinus 2.toShort) and be (7L plusOrMinus 2.toShort))
541
542      // Long plusOrMinus Byte
543      sevenLong should ((be (9L plusOrMinus 2.toByte)) and (be (9L plusOrMinus 2.toByte)))
544      sevenLong should (be (8L plusOrMinus 2.toByte) and (be (9L plusOrMinus 2.toByte)))
545      sevenLong should (be (7L plusOrMinus 2.toByte) and be (7L plusOrMinus 2.toByte))
546
547      // Int plusOrMinus Int
548      sevenInt should ((be (9 plusOrMinus 2)) and (be (9 plusOrMinus 2)))
549      sevenInt should (be (8 plusOrMinus 2) and (be (9 plusOrMinus 2)))
550      sevenInt should (be (7 plusOrMinus 2) and be (7 plusOrMinus 2))
551
552      // Int plusOrMinus Short
553      sevenInt should ((be (9 plusOrMinus 2.toShort)) and (be (9 plusOrMinus 2.toShort)))
554      sevenInt should (be (8 plusOrMinus 2.toShort) and (be (9 plusOrMinus 2.toShort)))
555      sevenInt should (be (7 plusOrMinus 2.toShort) and be (7 plusOrMinus 2.toShort))
556
557      // Int plusOrMinus Byte
558      sevenInt should ((be (9 plusOrMinus 2.toByte)) and (be (9 plusOrMinus 2.toByte)))
559      sevenInt should (be (8 plusOrMinus 2.toByte) and (be (9 plusOrMinus 2.toByte)))
560      sevenInt should (be (7 plusOrMinus 2.toByte) and be (7 plusOrMinus 2.toByte))
561
562      // Short plusOrMinus Short
563      sevenShort should ((be (9.toShort plusOrMinus 2.toShort)) and (be (9.toShort plusOrMinus 2.toShort)))
564      sevenShort should (be (8.toShort plusOrMinus 2.toShort) and (be (9.toShort plusOrMinus 2.toShort)))
565      sevenShort should (be (7.toShort plusOrMinus 2.toShort) and be (7.toShort plusOrMinus 2.toShort))
566
567      // Short plusOrMinus Byte
568      sevenShort should ((be (9.toShort plusOrMinus 2.toByte)) and (be (9.toShort plusOrMinus 2.toByte)))
569      sevenShort should (be (8.toShort plusOrMinus 2.toByte) and (be (9.toShort plusOrMinus 2.toByte)))
570      sevenShort should (be (7.toShort plusOrMinus 2.toByte) and be (7.toShort plusOrMinus 2.toByte))
571
572      // Byte plusOrMinus Byte
573      sevenByte should ((be (9.toByte plusOrMinus 2.toByte)) and (be (9.toByte plusOrMinus 2.toByte)))
574      sevenByte should (be (8.toByte plusOrMinus 2.toByte) and (be (9.toByte plusOrMinus 2.toByte)))
575      sevenByte should (be (7.toByte plusOrMinus 2.toByte) and be (7.toByte plusOrMinus 2.toByte))
576    }
577
578    it("should do nothing if the number is within the specified range, when used in a logical-or expression") {
579
580      // Double plusOrMinus Double
581      sevenDotOh should ((be (7.1 plusOrMinus 0.2)) or (be (7.1 plusOrMinus 0.2)))
582      sevenDotOh should (be (6.9 plusOrMinus 0.2) or (be (7.1 plusOrMinus 0.2)))
583      sevenDotOh should (be (7.0 plusOrMinus 0.2) or be (7.0 plusOrMinus 0.2))
584
585      // Double plusOrMinus Float
586      sevenDotOh should ((be (7.1 plusOrMinus 0.2f)) or (be (7.1 plusOrMinus 0.2f)))
587      sevenDotOh should (be (6.9 plusOrMinus 0.2f) or (be (7.1 plusOrMinus 0.2f)))
588      sevenDotOh should (be (7.0 plusOrMinus 0.2f) or be (7.0 plusOrMinus 0.2f))
589
590      // Double plusOrMinus Long
591      sevenDotOh should ((be (7.1 plusOrMinus 2L)) or (be (7.1 plusOrMinus 2L)))
592      sevenDotOh should (be (6.9 plusOrMinus 2L) or (be (7.1 plusOrMinus 2L)))
593      sevenDotOh should (be (7.0 plusOrMinus 2L) or be (7.0 plusOrMinus 2L))
594
595      // Double plusOrMinus Int
596      sevenDotOh should ((be (7.1 plusOrMinus 2)) or (be (7.1 plusOrMinus 2)))
597      sevenDotOh should (be (6.9 plusOrMinus 2) or (be (7.1 plusOrMinus 2)))
598      sevenDotOh should (be (7.0 plusOrMinus 2) or be (7.0 plusOrMinus 2))
599
600      // Double plusOrMinus Short
601      sevenDotOh should ((be (7.1 plusOrMinus 2.toShort)) or (be (7.1 plusOrMinus 2.toShort)))
602      sevenDotOh should (be (6.9 plusOrMinus 2.toShort) or (be (7.1 plusOrMinus 2.toShort)))
603      sevenDotOh should (be (7.0 plusOrMinus 2.toShort) or be (7.0 plusOrMinus 2.toShort))
604
605      // Double plusOrMinus Byte
606      sevenDotOh should ((be (7.1 plusOrMinus 2.toByte)) or (be (7.1 plusOrMinus 2.toByte)))
607      sevenDotOh should (be (6.9 plusOrMinus 2.toByte) or (be (7.1 plusOrMinus 2.toByte)))
608      sevenDotOh should (be (7.0 plusOrMinus 2.toByte) or be (7.0 plusOrMinus 2.toByte))
609
610      // Float plusOrMinus Float
611      sevenDotOhFloat should ((be (7.1f plusOrMinus 0.2f)) or (be (7.1f plusOrMinus 0.2f)))
612      sevenDotOhFloat should (be (6.9f plusOrMinus 0.2f) or (be (7.1f plusOrMinus 0.2f)))
613      sevenDotOhFloat should (be (7.0f plusOrMinus 0.2f) or be (7.0f plusOrMinus 0.2f))
614
615      // Float plusOrMinus Long
616      sevenDotOhFloat should ((be (7.1f plusOrMinus 2L)) or (be (7.1f plusOrMinus 2L)))
617      sevenDotOhFloat should (be (6.9f plusOrMinus 2L) or (be (7.1f plusOrMinus 2L)))
618      sevenDotOhFloat should (be (7.0f plusOrMinus 2L) or be (7.0f plusOrMinus 2L))
619
620      // Float plusOrMinus Int
621      sevenDotOhFloat should ((be (7.1f plusOrMinus 2)) or (be (7.1f plusOrMinus 2)))
622      sevenDotOhFloat should (be (6.9f plusOrMinus 2) or (be (7.1f plusOrMinus 2)))
623      sevenDotOhFloat should (be (7.0f plusOrMinus 2) or be (7.0f plusOrMinus 2))
624
625      // Float plusOrMinus Short
626      sevenDotOhFloat should ((be (7.1f plusOrMinus 2.toShort)) or (be (7.1f plusOrMinus 2.toShort)))
627      sevenDotOhFloat should (be (6.9f plusOrMinus 2.toShort) or (be (7.1f plusOrMinus 2.toShort)))
628      sevenDotOhFloat should (be (7.0f plusOrMinus 2.toShort) or be (7.0f plusOrMinus 2.toShort))
629
630      // Float plusOrMinus Byte
631      sevenDotOhFloat should ((be (7.1f plusOrMinus 2.toByte)) or (be (7.1f plusOrMinus 2.toByte)))
632      sevenDotOhFloat should (be (6.9f plusOrMinus 2.toByte) or (be (7.1f plusOrMinus 2.toByte)))
633      sevenDotOhFloat should (be (7.0f plusOrMinus 2.toByte) or be (7.0f plusOrMinus 2.toByte))
634
635      // Long plusOrMinus Long
636      sevenLong should ((be (9L plusOrMinus 2L)) or (be (9L plusOrMinus 2L)))
637      sevenLong should (be (8L plusOrMinus 2L) or (be (9L plusOrMinus 2L)))
638      sevenLong should (be (7L plusOrMinus 2L) or be (7L plusOrMinus 2L))
639
640      // Long plusOrMinus Int
641      sevenLong should ((be (9L plusOrMinus 2)) or (be (9L plusOrMinus 2)))
642      sevenLong should (be (8L plusOrMinus 2) or (be (9L plusOrMinus 2)))
643      sevenLong should (be (7L plusOrMinus 2) or be (7L plusOrMinus 2))
644
645      // Long plusOrMinus Short
646      sevenLong should ((be (9L plusOrMinus 2.toShort)) or (be (9L plusOrMinus 2.toShort)))
647      sevenLong should (be (8L plusOrMinus 2.toShort) or (be (9L plusOrMinus 2.toShort)))
648      sevenLong should (be (7L plusOrMinus 2.toShort) or be (7L plusOrMinus 2.toShort))
649
650      // Long plusOrMinus Byte
651      sevenLong should ((be (9L plusOrMinus 2.toByte)) or (be (9L plusOrMinus 2.toByte)))
652      sevenLong should (be (8L plusOrMinus 2.toByte) or (be (9L plusOrMinus 2.toByte)))
653      sevenLong should (be (7L plusOrMinus 2.toByte) or be (7L plusOrMinus 2.toByte))
654
655      // Int plusOrMinus Int
656      sevenInt should ((be (9 plusOrMinus 2)) or (be (9 plusOrMinus 2)))
657      sevenInt should (be (8 plusOrMinus 2) or (be (9 plusOrMinus 2)))
658      sevenInt should (be (7 plusOrMinus 2) or be (7 plusOrMinus 2))
659
660      // Int plusOrMinus Short
661      sevenInt should ((be (9 plusOrMinus 2.toShort)) or (be (9 plusOrMinus 2.toShort)))
662      sevenInt should (be (8 plusOrMinus 2.toShort) or (be (9 plusOrMinus 2.toShort)))
663      sevenInt should (be (7 plusOrMinus 2.toShort) or be (7 plusOrMinus 2.toShort))
664
665      // Int plusOrMinus Byte
666      sevenInt should ((be (9 plusOrMinus 2.toByte)) or (be (9 plusOrMinus 2.toByte)))
667      sevenInt should (be (8 plusOrMinus 2.toByte) or (be (9 plusOrMinus 2.toByte)))
668      sevenInt should (be (7 plusOrMinus 2.toByte) or be (7 plusOrMinus 2.toByte))
669
670      // Short plusOrMinus Short
671      sevenShort should ((be (9.toShort plusOrMinus 2.toShort)) or (be (9.toShort plusOrMinus 2.toShort)))
672      sevenShort should (be (8.toShort plusOrMinus 2.toShort) or (be (9.toShort plusOrMinus 2.toShort)))
673      sevenShort should (be (7.toShort plusOrMinus 2.toShort) or be (7.toShort plusOrMinus 2.toShort))
674
675      // Short plusOrMinus Byte
676      sevenShort should ((be (9.toShort plusOrMinus 2.toByte)) or (be (9.toShort plusOrMinus 2.toByte)))
677      sevenShort should (be (8.toShort plusOrMinus 2.toByte) or (be (9.toShort plusOrMinus 2.toByte)))
678      sevenShort should (be (7.toShort plusOrMinus 2.toByte) or be (7.toShort plusOrMinus 2.toByte))
679
680      // Byte plusOrMinus Byte
681      sevenByte should ((be (9.toByte plusOrMinus 2.toByte)) or (be (9.toByte plusOrMinus 2.toByte)))
682      sevenByte should (be (8.toByte plusOrMinus 2.toByte) or (be (9.toByte plusOrMinus 2.toByte)))
683      sevenByte should (be (7.toByte plusOrMinus 2.toByte) or be (7.toByte plusOrMinus 2.toByte))
684    }
685
686    it("should do nothing if the number is not within the specified range, when used in a logical-and expression with not") {
687
688      // Double plusOrMinus Double
689      sevenDotOh should ((not be (17.1 plusOrMinus 0.2)) and (not be (17.1 plusOrMinus 0.2)))
690      sevenDotOh should (not (be (16.9 plusOrMinus 0.2)) and not (be (17.1 plusOrMinus 0.2)))
691      sevenDotOh should (not be (17.0 plusOrMinus 0.2) and not be (17.0 plusOrMinus 0.2))
692
693      // Double plusOrMinus Float
694      sevenDotOh should ((not be (17.1 plusOrMinus 0.2f)) and (not be (17.1 plusOrMinus 0.2f)))
695      sevenDotOh should (not (be (16.9 plusOrMinus 0.2f)) and not (be (17.1 plusOrMinus 0.2f)))
696      sevenDotOh should (not be (17.0 plusOrMinus 0.2f) and not be (17.0 plusOrMinus 0.2f))
697
698      // Double plusOrMinus Long
699      sevenDotOh should ((not be (17.1 plusOrMinus 2L)) and (not be (17.1 plusOrMinus 2L)))
700      sevenDotOh should (not (be (16.9 plusOrMinus 2L)) and not (be (17.1 plusOrMinus 2L)))
701      sevenDotOh should (not be (17.0 plusOrMinus 2L) and not be (17.0 plusOrMinus 2L))
702
703      // Double plusOrMinus Int
704      sevenDotOh should ((not be (17.1 plusOrMinus 2)) and (not be (17.1 plusOrMinus 2)))
705      sevenDotOh should (not (be (16.9 plusOrMinus 2)) and not (be (17.1 plusOrMinus 2)))
706      sevenDotOh should (not be (17.0 plusOrMinus 2) and not be (17.0 plusOrMinus 2))
707
708      // Double plusOrMinus Short
709      sevenDotOh should ((not be (17.1 plusOrMinus 2.toShort)) and (not be (17.1 plusOrMinus 2.toShort)))
710      sevenDotOh should (not (be (16.9 plusOrMinus 2.toShort)) and not (be (17.1 plusOrMinus 2.toShort)))
711      sevenDotOh should (not be (17.0 plusOrMinus 2.toShort) and not be (17.0 plusOrMinus 2.toShort))
712
713      // Double plusOrMinus Byte
714      sevenDotOh should ((not be (17.1 plusOrMinus 2.toByte)) and (not be (17.1 plusOrMinus 2.toByte)))
715      sevenDotOh should (not (be (16.9 plusOrMinus 2.toByte)) and not (be (17.1 plusOrMinus 2.toByte)))
716      sevenDotOh should (not be (17.0 plusOrMinus 2.toByte) and not be (17.0 plusOrMinus 2.toByte))
717
718      // Float plusOrMinus Float
719      sevenDotOhFloat should ((not be (17.1f plusOrMinus 0.2f)) and (not be (17.1f plusOrMinus 0.2f)))
720      sevenDotOhFloat should (not (be (16.9f plusOrMinus 0.2f)) and not (be (17.1f plusOrMinus 0.2f)))
721      sevenDotOhFloat should (not be (17.0f plusOrMinus 0.2f) and not be (17.0f plusOrMinus 0.2f))
722
723      // Float plusOrMinus Long
724      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2L)) and (not be (17.1f plusOrMinus 2L)))
725      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2L)) and not (be (17.1f plusOrMinus 2L)))
726      sevenDotOhFloat should (not be (17.0f plusOrMinus 2L) and not be (17.0f plusOrMinus 2L))
727
728      // Float plusOrMinus Int
729      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2)) and (not be (17.1f plusOrMinus 2)))
730      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2)) and not (be (17.1f plusOrMinus 2)))
731      sevenDotOhFloat should (not be (17.0f plusOrMinus 2) and not be (17.0f plusOrMinus 2))
732
733      // Float plusOrMinus Short
734      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2.toShort)) and (not be (17.1f plusOrMinus 2.toShort)))
735      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2.toShort)) and not (be (17.1f plusOrMinus 2.toShort)))
736      sevenDotOhFloat should (not be (17.0f plusOrMinus 2.toShort) and not be (17.0f plusOrMinus 2.toShort))
737
738      // Float plusOrMinus Byte
739      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2.toByte)) and (not be (17.1f plusOrMinus 2.toByte)))
740      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2.toByte)) and not (be (17.1f plusOrMinus 2.toByte)))
741      sevenDotOhFloat should (not be (17.0f plusOrMinus 2.toByte) and not be (17.0f plusOrMinus 2.toByte))
742
743      // Long plusOrMinus Long
744      sevenLong should ((not be (19L plusOrMinus 2L)) and (not be (19L plusOrMinus 2L)))
745      sevenLong should (not (be (18L plusOrMinus 2L)) and not (be (19L plusOrMinus 2L)))
746      sevenLong should (not be (17L plusOrMinus 2L) and not be (17L plusOrMinus 2L))
747
748      // Long plusOrMinus Int
749      sevenLong should ((not be (19L plusOrMinus 2)) and (not be (19L plusOrMinus 2)))
750      sevenLong should (not (be (18L plusOrMinus 2)) and not (be (19L plusOrMinus 2)))
751      sevenLong should (not be (17L plusOrMinus 2) and not be (17L plusOrMinus 2))
752
753      // Long plusOrMinus Short
754      sevenLong should ((not be (19L plusOrMinus 2.toShort)) and (not be (19L plusOrMinus 2.toShort)))
755      sevenLong should (not (be (18L plusOrMinus 2.toShort)) and not (be (19L plusOrMinus 2.toShort)))
756      sevenLong should (not be (17L plusOrMinus 2.toShort) and not be (17L plusOrMinus 2.toShort))
757
758      // Long plusOrMinus Byte
759      sevenLong should ((not be (19L plusOrMinus 2.toByte)) and (not be (19L plusOrMinus 2.toByte)))
760      sevenLong should (not (be (18L plusOrMinus 2.toByte)) and not (be (19L plusOrMinus 2.toByte)))
761      sevenLong should (not be (17L plusOrMinus 2.toByte) and not be (17L plusOrMinus 2.toByte))
762
763      // Int plusOrMinus Int
764      sevenInt should ((not be (19 plusOrMinus 2)) and (not be (19 plusOrMinus 2)))
765      sevenInt should (not (be (18 plusOrMinus 2)) and not (be (19 plusOrMinus 2)))
766      sevenInt should (not be (17 plusOrMinus 2) and not be (17 plusOrMinus 2))
767
768      // Int plusOrMinus Short
769      sevenInt should ((not be (19 plusOrMinus 2.toShort)) and (not be (19 plusOrMinus 2.toShort)))
770      sevenInt should (not (be (18 plusOrMinus 2.toShort)) and not (be (19 plusOrMinus 2.toShort)))
771      sevenInt should (not be (17 plusOrMinus 2.toShort) and not be (17 plusOrMinus 2.toShort))
772
773      // Int plusOrMinus Byte
774      sevenInt should ((not be (19 plusOrMinus 2.toByte)) and (not be (19 plusOrMinus 2.toByte)))
775      sevenInt should (not (be (18 plusOrMinus 2.toByte)) and not (be (19 plusOrMinus 2.toByte)))
776      sevenInt should (not be (17 plusOrMinus 2.toByte) and not be (17 plusOrMinus 2.toByte))
777
778      // Short plusOrMinus Short
779      sevenShort should ((not be (19.toShort plusOrMinus 2.toShort)) and (not be (19.toShort plusOrMinus 2.toShort)))
780      sevenShort should (not (be (18.toShort plusOrMinus 2.toShort)) and not (be (19.toShort plusOrMinus 2.toShort)))
781      sevenShort should (not be (17.toShort plusOrMinus 2.toShort) and not be (17.toShort plusOrMinus 2.toShort))
782
783      // Short plusOrMinus Byte
784      sevenShort should ((not be (19.toShort plusOrMinus 2.toByte)) and (not be (19.toShort plusOrMinus 2.toByte)))
785      sevenShort should (not (be (18.toShort plusOrMinus 2.toByte)) and not (be (19.toShort plusOrMinus 2.toByte)))
786      sevenShort should (not be (17.toShort plusOrMinus 2.toByte) and not be (17.toShort plusOrMinus 2.toByte))
787
788      // Byte plusOrMinus Byte
789      sevenByte should ((not be (19.toByte plusOrMinus 2.toByte)) and (not be (19.toByte plusOrMinus 2.toByte)))
790      sevenByte should (not (be (18.toByte plusOrMinus 2.toByte)) and not (be (19.toByte plusOrMinus 2.toByte)))
791      sevenByte should (not be (17.toByte plusOrMinus 2.toByte) and not be (17.toByte plusOrMinus 2.toByte))
792    }
793
794    it("should do nothing if the number is not within the specified range, when used in a logical-or expression with not") {
795
796      // Double plusOrMinus Double
797      sevenDotOh should ((not be (17.1 plusOrMinus 0.2)) or (not be (17.1 plusOrMinus 0.2)))
798      sevenDotOh should (not (be (16.9 plusOrMinus 0.2)) or not (be (17.1 plusOrMinus 0.2)))
799      sevenDotOh should (not be (17.0 plusOrMinus 0.2) or not be (17.0 plusOrMinus 0.2))
800
801      // Double plusOrMinus Float
802      sevenDotOh should ((not be (17.1 plusOrMinus 0.2f)) or (not be (17.1 plusOrMinus 0.2f)))
803      sevenDotOh should (not (be (16.9 plusOrMinus 0.2f)) or not (be (17.1 plusOrMinus 0.2f)))
804      sevenDotOh should (not be (17.0 plusOrMinus 0.2f) or not be (17.0 plusOrMinus 0.2f))
805
806      // Double plusOrMinus Long
807      sevenDotOh should ((not be (17.1 plusOrMinus 2L)) or (not be (17.1 plusOrMinus 2L)))
808      sevenDotOh should (not (be (16.9 plusOrMinus 2L)) or not (be (17.1 plusOrMinus 2L)))
809      sevenDotOh should (not be (17.0 plusOrMinus 2L) or not be (17.0 plusOrMinus 2L))
810
811      // Double plusOrMinus Int
812      sevenDotOh should ((not be (17.1 plusOrMinus 2)) or (not be (17.1 plusOrMinus 2)))
813      sevenDotOh should (not (be (16.9 plusOrMinus 2)) or not (be (17.1 plusOrMinus 2)))
814      sevenDotOh should (not be (17.0 plusOrMinus 2) or not be (17.0 plusOrMinus 2))
815
816      // Double plusOrMinus Short
817      sevenDotOh should ((not be (17.1 plusOrMinus 2.toShort)) or (not be (17.1 plusOrMinus 2.toShort)))
818      sevenDotOh should (not (be (16.9 plusOrMinus 2.toShort)) or not (be (17.1 plusOrMinus 2.toShort)))
819      sevenDotOh should (not be (17.0 plusOrMinus 2.toShort) or not be (17.0 plusOrMinus 2.toShort))
820
821      // Double plusOrMinus Byte
822      sevenDotOh should ((not be (17.1 plusOrMinus 2.toByte)) or (not be (17.1 plusOrMinus 2.toByte)))
823      sevenDotOh should (not (be (16.9 plusOrMinus 2.toByte)) or not (be (17.1 plusOrMinus 2.toByte)))
824      sevenDotOh should (not be (17.0 plusOrMinus 2.toByte) or not be (17.0 plusOrMinus 2.toByte))
825
826      // Float plusOrMinus Float
827      sevenDotOhFloat should ((not be (17.1f plusOrMinus 0.2f)) or (not be (17.1f plusOrMinus 0.2f)))
828      sevenDotOhFloat should (not (be (16.9f plusOrMinus 0.2f)) or not (be (17.1f plusOrMinus 0.2f)))
829      sevenDotOhFloat should (not be (17.0f plusOrMinus 0.2f) or not be (17.0f plusOrMinus 0.2f))
830
831      // Float plusOrMinus Long
832      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2L)) or (not be (17.1f plusOrMinus 2L)))
833      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2L)) or not (be (17.1f plusOrMinus 2L)))
834      sevenDotOhFloat should (not be (17.0f plusOrMinus 2L) or not be (17.0f plusOrMinus 2L))
835
836      // Float plusOrMinus Int
837      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2)) or (not be (17.1f plusOrMinus 2)))
838      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2)) or not (be (17.1f plusOrMinus 2)))
839      sevenDotOhFloat should (not be (17.0f plusOrMinus 2) or not be (17.0f plusOrMinus 2))
840
841      // Float plusOrMinus Short
842      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2.toShort)) or (not be (17.1f plusOrMinus 2.toShort)))
843      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2.toShort)) or not (be (17.1f plusOrMinus 2.toShort)))
844      sevenDotOhFloat should (not be (17.0f plusOrMinus 2.toShort) or not be (17.0f plusOrMinus 2.toShort))
845
846      // Float plusOrMinus Byte
847      sevenDotOhFloat should ((not be (17.1f plusOrMinus 2.toByte)) or (not be (17.1f plusOrMinus 2.toByte)))
848      sevenDotOhFloat should (not (be (16.9f plusOrMinus 2.toByte)) or not (be (17.1f plusOrMinus 2.toByte)))
849      sevenDotOhFloat should (not be (17.0f plusOrMinus 2.toByte) or not be (17.0f plusOrMinus 2.toByte))
850
851      // Long plusOrMinus Long
852      sevenLong should ((not be (19L plusOrMinus 2L)) or (not be (19L plusOrMinus 2L)))
853      sevenLong should (not (be (18L plusOrMinus 2L)) or not (be (19L plusOrMinus 2L)))
854      sevenLong should (not be (17L plusOrMinus 2L) or not be (17L plusOrMinus 2L))
855
856      // Long plusOrMinus Int
857      sevenLong should ((not be (19L plusOrMinus 2)) or (not be (19L plusOrMinus 2)))
858      sevenLong should (not (be (18L plusOrMinus 2)) or not (be (19L plusOrMinus 2)))
859      sevenLong should (not be (17L plusOrMinus 2) or not be (17L plusOrMinus 2))
860
861      // Long plusOrMinus Short
862      sevenLong should ((not be (19L plusOrMinus 2.toShort)) or (not be (19L plusOrMinus 2.toShort)))
863      sevenLong should (not (be (18L plusOrMinus 2.toShort)) or not (be (19L plusOrMinus 2.toShort)))
864      sevenLong should (not be (17L plusOrMinus 2.toShort) or not be (17L plusOrMinus 2.toShort))
865
866      // Long plusOrMinus Byte
867      sevenLong should ((not be (19L plusOrMinus 2.toByte)) or (not be (19L plusOrMinus 2.toByte)))
868      sevenLong should (not (be (18L plusOrMinus 2.toByte)) or not (be (19L plusOrMinus 2.toByte)))
869      sevenLong should (not be (17L plusOrMinus 2.toByte) or not be (17L plusOrMinus 2.toByte))
870
871      // Int plusOrMinus Int
872      sevenInt should ((not be (19 plusOrMinus 2)) or (not be (19 plusOrMinus 2)))
873      sevenInt should (not (be (18 plusOrMinus 2)) or not (be (19 plusOrMinus 2)))
874      sevenInt should (not be (17 plusOrMinus 2) or not be (17 plusOrMinus 2))
875
876      // Int plusOrMinus Short
877      sevenInt should ((not be (19 plusOrMinus 2.toShort)) or (not be (19 plusOrMinus 2.toShort)))
878      sevenInt should (not (be (18 plusOrMinus 2.toShort)) or not (be (19 plusOrMinus 2.toShort)))
879      sevenInt should (not be (17 plusOrMinus 2.toShort) or not be (17 plusOrMinus 2.toShort))
880
881      // Int plusOrMinus Byte
882      sevenInt should ((not be (19 plusOrMinus 2.toByte)) or (not be (19 plusOrMinus 2.toByte)))
883      sevenInt should (not (be (18 plusOrMinus 2.toByte)) or not (be (19 plusOrMinus 2.toByte)))
884      sevenInt should (not be (17 plusOrMinus 2.toByte) or not be (17 plusOrMinus 2.toByte))
885
886      // Short plusOrMinus Short
887      sevenShort should ((not be (19.toShort plusOrMinus 2.toShort)) or (not be (19.toShort plusOrMinus 2.toShort)))
888      sevenShort should (not (be (18.toShort plusOrMinus 2.toShort)) or not (be (19.toShort plusOrMinus 2.toShort)))
889      sevenShort should (not be (17.toShort plusOrMinus 2.toShort) or not be (17.toShort plusOrMinus 2.toShort))
890
891      // Short plusOrMinus Byte
892      sevenShort should ((not be (19.toShort plusOrMinus 2.toByte)) or (not be (19.toShort plusOrMinus 2.toByte)))
893      sevenShort should (not (be (18.toShort plusOrMinus 2.toByte)) or not (be (19.toShort plusOrMinus 2.toByte)))
894      sevenShort should (not be (17.toShort plusOrMinus 2.toByte) or not be (17.toShort plusOrMinus 2.toByte))
895
896      // Byte plusOrMinus Byte
897      sevenByte should ((not be (19.toByte plusOrMinus 2.toByte)) or (not be (19.toByte plusOrMinus 2.toByte)))
898      sevenByte should (not (be (18.toByte plusOrMinus 2.toByte)) or not (be (19.toByte plusOrMinus 2.toByte)))
899      sevenByte should (not be (17.toByte plusOrMinus 2.toByte) or not be (17.toByte plusOrMinus 2.toByte))
900    }
901
902    it("should throw TestFailedException if the number is not within the specified range") {
903
904      // Double plusOrMinus Double
905      val caught1 = intercept[TestFailedException] {
906        sevenDotOh should be (17.1 plusOrMinus 0.2)
907      }
908      assert(caught1.getMessage === "7.0 was not 17.1 plus or minus 0.2")
909
910      // Double plusOrMinus Float
911      val caught2 = intercept[TestFailedException] {
912        sevenDotOh should be (17.1 plusOrMinus 0.2f)
913      }
914      assert(caught2.getMessage === "7.0 was not 17.1 plus or minus 0.20000000298023224")
915
916      // Double plusOrMinus Long
917      val caught3 = intercept[TestFailedException] {
918        sevenDotOh should be (17.1 plusOrMinus 2L)
919      }
920      assert(caught3.getMessage === "7.0 was not 17.1 plus or minus 2.0")
921
922      // Double plusOrMinus Int
923      val caught4 = intercept[TestFailedException] {
924        sevenDotOh should be (17.1 plusOrMinus 2)
925      }
926      assert(caught4.getMessage === "7.0 was not 17.1 plus or minus 2.0")
927
928      // Double plusOrMinus Short
929      val caught5 = intercept[TestFailedException] {
930        sevenDotOh should be (17.1 plusOrMinus 2.toShort)
931      }
932      assert(caught5.getMessage === "7.0 was not 17.1 plus or minus 2.0")
933
934      // Double plusOrMinus Byte
935      val caught6 = intercept[TestFailedException] {
936        sevenDotOh should be (17.1 plusOrMinus 2.toByte)
937      }
938      assert(caught6.getMessage === "7.0 was not 17.1 plus or minus 2.0")
939
940      // Float plusOrMinus Float
941      val caught7 = intercept[TestFailedException] {
942        sevenDotOhFloat should be (17.1f plusOrMinus 0.2f)
943      }
944      assert(caught7.getMessage === "7.0 was not 17.1 plus or minus 0.2")
945
946      // Float plusOrMinus Long
947      val caught8 = intercept[TestFailedException] {
948        sevenDotOhFloat should be (17.1f plusOrMinus 2L)
949      }
950      assert(caught8.getMessage === "7.0 was not 17.1 plus or minus 2.0")
951
952      // Float plusOrMinus Int
953      val caught9 = intercept[TestFailedException] {
954        sevenDotOhFloat should be (17.1f plusOrMinus 2)
955      }
956      assert(caught9.getMessage === "7.0 was not 17.1 plus or minus 2.0")
957
958      // Float plusOrMinus Short
959      val caught10 = intercept[TestFailedException] {
960        sevenDotOhFloat should be (17.1f plusOrMinus 2.toShort)
961      }
962      assert(caught10.getMessage === "7.0 was not 17.1 plus or minus 2.0")
963
964      // Float plusOrMinus Byte
965      val caught11 = intercept[TestFailedException] {
966        sevenDotOhFloat should be (17.1f plusOrMinus 2.toByte)
967      }
968      assert(caught11.getMessage === "7.0 was not 17.1 plus or minus 2.0")
969
970      // Long plusOrMinus Long
971      val caught12 = intercept[TestFailedException] {
972        sevenLong should be (19L plusOrMinus 2L)
973      }
974      assert(caught12.getMessage === "7 was not 19 plus or minus 2")
975
976      // Long plusOrMinus Int
977      val caught13 = intercept[TestFailedException] {
978        sevenLong should be (19L plusOrMinus 2)
979      }
980      assert(caught13.getMessage === "7 was not 19 plus or minus 2")
981
982      // Long plusOrMinus Short
983      val caught14 = intercept[TestFailedException] {
984        sevenLong should be (19L plusOrMinus 2.toShort)
985      }
986      assert(caught14.getMessage === "7 was not 19 plus or minus 2")
987
988      // Long plusOrMinus Byte
989      val caught15 = intercept[TestFailedException] {
990        sevenLong should be (19L plusOrMinus 2.toByte)
991      }
992      assert(caught15.getMessage === "7 was not 19 plus or minus 2")
993
994      // Int plusOrMinus Int
995      val caught16 = intercept[TestFailedException] {
996        sevenInt should be (19 plusOrMinus 2)
997      }
998      assert(caught16.getMessage === "7 was not 19 plus or minus 2")
999
1000      // Int plusOrMinus Short
1001      val caught17 = intercept[TestFailedException] {
1002        sevenInt should be (19 plusOrMinus 2.toShort)
1003      }
1004      assert(caught17.getMessage === "7 was not 19 plus or minus 2")
1005
1006      // Int plusOrMinus Byte
1007      val caught18 = intercept[TestFailedException] {
1008        sevenInt should be (19 plusOrMinus 2.toByte)
1009      }
1010      assert(caught18.getMessage === "7 was not 19 plus or minus 2")
1011
1012      // Short plusOrMinus Short
1013      val caught19 = intercept[TestFailedException] {
1014        sevenShort should be (19.toShort plusOrMinus 2.toShort)
1015      }
1016      assert(caught19.getMessage === "7 was not 19 plus or minus 2")
1017
1018      // Short plusOrMinus Byte
1019      val caught20 = intercept[TestFailedException] {
1020        sevenShort should be (19.toShort plusOrMinus 2.toByte)
1021      }
1022      assert(caught20.getMessage === "7 was not 19 plus or minus 2")
1023
1024      // Byte plusOrMinus Byte
1025      val caught21 = intercept[TestFailedException] {
1026        sevenByte should be (19.toByte plusOrMinus 2.toByte)
1027      }
1028      assert(caught21.getMessage === "7 was not 19 plus or minus 2")
1029    }
1030
1031    it("should throw TestFailedException if the number is within the specified range, when used with not") {
1032
1033      // Double plusOrMinus Double
1034      val caught1 = intercept[TestFailedException] {
1035        sevenDotOh should not be (7.1 plusOrMinus 0.2)
1036      }
1037      assert(caught1.getMessage === "7.0 was 7.1 plus or minus 0.2")
1038
1039      // Double plusOrMinus Float
1040      val caught2 = intercept[TestFailedException] {
1041        sevenDotOh should not be (7.1 plusOrMinus 0.2f)
1042      }
1043      assert(caught2.getMessage === "7.0 was 7.1 plus or minus 0.20000000298023224")
1044
1045      // Double plusOrMinus Long
1046      val caught3 = intercept[TestFailedException] {
1047        sevenDotOh should not be (7.1 plusOrMinus 2L)
1048      }
1049      assert(caught3.getMessage === "7.0 was 7.1 plus or minus 2.0")
1050
1051      // Double plusOrMinus Int
1052      val caught4 = intercept[TestFailedException] {
1053        sevenDotOh should not be (7.1 plusOrMinus 2)
1054      }
1055      assert(caught4.getMessage === "7.0 was 7.1 plus or minus 2.0")
1056
1057      // Double plusOrMinus Short
1058      val caught5 = intercept[TestFailedException] {
1059        sevenDotOh should not be (7.1 plusOrMinus 2.toShort)
1060      }
1061      assert(caught5.getMessage === "7.0 was 7.1 plus or minus 2.0")
1062
1063      // Double plusOrMinus Byte
1064      val caught6 = intercept[TestFailedException] {
1065        sevenDotOh should not be (7.1 plusOrMinus 2.toByte)
1066      }
1067      assert(caught6.getMessage === "7.0 was 7.1 plus or minus 2.0")
1068
1069      // Float plusOrMinus Float
1070      val caught7 = intercept[TestFailedException] {
1071        sevenDotOhFloat should not be (7.1f plusOrMinus 0.2f)
1072      }
1073      assert(caught7.getMessage === "7.0 was 7.1 plus or minus 0.2")
1074
1075      // Float plusOrMinus Long
1076      val caught8 = intercept[TestFailedException] {
1077        sevenDotOhFloat should not be (7.1f plusOrMinus 2L)
1078      }
1079      assert(caught8.getMessage === "7.0 was 7.1 plus or minus 2.0")
1080
1081      // Float plusOrMinus Int
1082      val caught9 = intercept[TestFailedException] {
1083        sevenDotOhFloat should not be (7.1f plusOrMinus 2)
1084      }
1085      assert(caught9.getMessage === "7.0 was 7.1 plus or minus 2.0")
1086
1087      // Float plusOrMinus Short
1088      val caught10 = intercept[TestFailedException] {
1089        sevenDotOhFloat should not be (7.1f plusOrMinus 2.toShort)
1090      }
1091      assert(caught10.getMessage === "7.0 was 7.1 plus or minus 2.0")
1092
1093      // Float plusOrMinus Byte
1094      val caught11 = intercept[TestFailedException] {
1095        sevenDotOhFloat should not be (7.1f plusOrMinus 2.toByte)
1096      }
1097      assert(caught11.getMessage === "7.0 was 7.1 plus or minus 2.0")
1098
1099      // Long plusOrMinus Long
1100      val caught12 = intercept[TestFailedException] {
1101        sevenLong should not be (9L plusOrMinus 2L)
1102      }
1103      assert(caught12.getMessage === "7 was 9 plus or minus 2")
1104
1105      // Long plusOrMinus Int
1106      val caught13 = intercept[TestFailedException] {
1107        sevenLong should not be (9L plusOrMinus 2)
1108      }
1109      assert(caught13.getMessage === "7 was 9 plus or minus 2")
1110
1111      // Long plusOrMinus Short
1112      val caught14 = intercept[TestFailedException] {
1113        sevenLong should not be (9L plusOrMinus 2.toShort)
1114      }
1115      assert(caught14.getMessage === "7 was 9 plus or minus 2")
1116
1117      // Long plusOrMinus Byte
1118      val caught15 = intercept[TestFailedException] {
1119        sevenLong should not be (9L plusOrMinus 2.toByte)
1120      }
1121      assert(caught15.getMessage === "7 was 9 plus or minus 2")
1122
1123      // Int plusOrMinus Int
1124      val caught16 = intercept[TestFailedException] {
1125        sevenInt should not be (9 plusOrMinus 2)
1126      }
1127      assert(caught16.getMessage === "7 was 9 plus or minus 2")
1128
1129      // Int plusOrMinus Short
1130      val caught17 = intercept[TestFailedException] {
1131        sevenInt should not be (9 plusOrMinus 2.toShort)
1132      }
1133      assert(caught17.getMessage === "7 was 9 plus or minus 2")
1134
1135      // Int plusOrMinus Byte
1136      val caught18 = intercept[TestFailedException] {
1137        sevenInt should not be (9 plusOrMinus 2.toByte)
1138      }
1139      assert(caught18.getMessage === "7 was 9 plus or minus 2")
1140
1141      // Short plusOrMinus Short
1142      val caught19 = intercept[TestFailedException] {
1143        sevenShort should not be (9.toShort plusOrMinus 2.toShort)
1144      }
1145      assert(caught19.getMessage === "7 was 9 plus or minus 2")
1146
1147      // Short plusOrMinus Byte
1148      val caught20 = intercept[TestFailedException] {
1149        sevenShort should not be (9.toShort plusOrMinus 2.toByte)
1150      }
1151      assert(caught20.getMessage === "7 was 9 plus or minus 2")
1152
1153      // Byte plusOrMinus Byte
1154      val caught21 = intercept[TestFailedException] {
1155        sevenByte should not be (9.toByte plusOrMinus 2.toByte)
1156      }
1157      assert(caught21.getMessage === "7 was 9 plus or minus 2")
1158    }
1159
1160    it("should throw TestFailedException if the number is not within the specified range, when used in a logical-and expression") {
1161
1162      // Double plusOrMinus Double
1163      val caught1 = intercept[TestFailedException] {
1164        sevenDotOh should ((be (17.1 plusOrMinus 0.2)) and (be (17.1 plusOrMinus 0.2)))
1165      }
1166      assert(caught1.getMessage === "7.0 was not 17.1 plus or minus 0.2")
1167      val caught2 = intercept[TestFailedException] {
1168        sevenDotOh should (be (6.9 plusOrMinus 0.2) and (be (17.1 plusOrMinus 0.2)))
1169      }
1170      assert(caught2.getMessage === "7.0 was 6.9 plus or minus 0.2, but 7.0 was not 17.1 plus or minus 0.2")
1171      val caught3 = intercept[TestFailedException] {
1172        sevenDotOh should (be (17.0 plusOrMinus 0.2) and be (7.0 plusOrMinus 0.2))
1173      }
1174      assert(caught3.getMessage === "7.0 was not 17.0 plus or minus 0.2")
1175
1176      // Double plusOrMinus Float
1177      val caught4 = intercept[TestFailedException] {
1178        sevenDotOh should ((be (17.1 plusOrMinus 0.2f)) and (be (17.1 plusOrMinus 0.2f)))
1179      }
1180      assert(caught4.getMessage === "7.0 was not 17.1 plus or minus 0.20000000298023224")
1181      val caught5 = intercept[TestFailedException] {
1182        sevenDotOh should (be (6.9 plusOrMinus 0.2f) and (be (17.1 plusOrMinus 0.2f)))
1183      }
1184      assert(caught5.getMessage === "7.0 was 6.9 plus or minus 0.20000000298023224, but 7.0 was not 17.1 plus or minus 0.20000000298023224")
1185      val caught6 = intercept[TestFailedException] {
1186        sevenDotOh should (be (17.0 plusOrMinus 0.2f) and be (7.0 plusOrMinus 0.2f))
1187      }
1188      assert(caught6.getMessage === "7.0 was not 17.0 plus or minus 0.20000000298023224")
1189
1190      // Double plusOrMinus Long
1191      val caught7 = intercept[TestFailedException] {
1192        sevenDotOh should ((be (17.1 plusOrMinus 2L)) and (be (17.1 plusOrMinus 2L)))
1193      }
1194      assert(caught7.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1195      val caught8 = intercept[TestFailedException] {
1196        sevenDotOh should (be (6.9 plusOrMinus 2L) and (be (17.1 plusOrMinus 2L)))
1197      }
1198      assert(caught8.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1199      val caught9 = intercept[TestFailedException] {
1200        sevenDotOh should (be (17.0 plusOrMinus 2L) and be (7.0 plusOrMinus 2L))
1201      }
1202      assert(caught9.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1203
1204      // Double plusOrMinus Int
1205      val caught10 = intercept[TestFailedException] {
1206        sevenDotOh should ((be (17.1 plusOrMinus 2)) and (be (17.1 plusOrMinus 2)))
1207      }
1208      assert(caught10.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1209      val caught11 = intercept[TestFailedException] {
1210        sevenDotOh should (be (6.9 plusOrMinus 2) and (be (17.1 plusOrMinus 2)))
1211      }
1212      assert(caught2.getMessage === "7.0 was 6.9 plus or minus 0.2, but 7.0 was not 17.1 plus or minus 0.2")
1213      val caught12 = intercept[TestFailedException] {
1214        sevenDotOh should (be (7.0 plusOrMinus 2) and be (17.0 plusOrMinus 2))
1215      }
1216      assert(caught12.getMessage === "7.0 was 7.0 plus or minus 2.0, but 7.0 was not 17.0 plus or minus 2.0")
1217
1218      // Double plusOrMinus Short
1219      val caught13 = intercept[TestFailedException] {
1220        sevenDotOh should ((be (17.1 plusOrMinus 2.toShort)) and (be (17.1 plusOrMinus 2.toShort)))
1221      }
1222      assert(caught13.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1223      val caught14 = intercept[TestFailedException] {
1224        sevenDotOh should (be (6.9 plusOrMinus 2.toShort) and (be (17.1 plusOrMinus 2.toShort)))
1225      }
1226      assert(caught14.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1227      val caught15 = intercept[TestFailedException] {
1228        sevenDotOh should (be (17.0 plusOrMinus 2.toShort) and be (7.0 plusOrMinus 2.toShort))
1229      }
1230      assert(caught15.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1231
1232      // Double plusOrMinus Byte
1233      val caught16 = intercept[TestFailedException] {
1234        sevenDotOh should ((be (17.1 plusOrMinus 2.toByte)) and (be (17.1 plusOrMinus 2.toByte)))
1235      }
1236      assert(caught16.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1237      val caught17 = intercept[TestFailedException] {
1238        sevenDotOh should (be (6.9 plusOrMinus 2.toByte) and (be (17.1 plusOrMinus 2.toByte)))
1239      }
1240      assert(caught17.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1241      val caught18 = intercept[TestFailedException] {
1242        sevenDotOh should (be (17.0 plusOrMinus 2.toByte) and be (7.0 plusOrMinus 2.toByte))
1243      }
1244      assert(caught18.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1245
1246      // Float plusOrMinus Float
1247      val caught19 = intercept[TestFailedException] {
1248        sevenDotOhFloat should ((be (17.1f plusOrMinus 0.2f)) and (be (17.1f plusOrMinus 0.2f)))
1249      }
1250      assert(caught19.getMessage === "7.0 was not 17.1 plus or minus 0.2")
1251      val caught20 = intercept[TestFailedException] {
1252        sevenDotOhFloat should (be (6.9f plusOrMinus 0.2f) and (be (17.1f plusOrMinus 0.2f)))
1253      }
1254      assert(caught20.getMessage === "7.0 was 6.9 plus or minus 0.2, but 7.0 was not 17.1 plus or minus 0.2")
1255      val caught21 = intercept[TestFailedException] {
1256        sevenDotOhFloat should (be (17.0f plusOrMinus 0.2f) and be (7.0f plusOrMinus 0.2f))
1257      }
1258      assert(caught21.getMessage === "7.0 was not 17.0 plus or minus 0.2")
1259
1260      // Float plusOrMinus Long
1261      val caught22 = intercept[TestFailedException] {
1262        sevenDotOhFloat should ((be (17.1f plusOrMinus 2L)) and (be (17.1f plusOrMinus 2L)))
1263      }
1264      assert(caught22.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1265      val caught23 = intercept[TestFailedException] {
1266        sevenDotOhFloat should (be (6.9f plusOrMinus 2L) and (be (17.1f plusOrMinus 2L)))
1267      }
1268      assert(caught23.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1269      val caught24 = intercept[TestFailedException] {
1270        sevenDotOhFloat should (be (17.0f plusOrMinus 2L) and be (7.0f plusOrMinus 2L))
1271      }
1272      assert(caught24.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1273
1274      // Float plusOrMinus Int
1275      val caught25 = intercept[TestFailedException] {
1276        sevenDotOhFloat should ((be (17.1f plusOrMinus 2)) and (be (17.1f plusOrMinus 2)))
1277      }
1278      assert(caught25.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1279      val caught26 = intercept[TestFailedException] {
1280        sevenDotOhFloat should (be (6.9f plusOrMinus 2) and (be (17.1f plusOrMinus 2)))
1281      }
1282      assert(caught26.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1283      val caught27 = intercept[TestFailedException] {
1284        sevenDotOhFloat should (be (17.0f plusOrMinus 2) and be (7.0f plusOrMinus 2))
1285      }
1286      assert(caught27.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1287
1288      // Float plusOrMinus Short
1289      val caught28 = intercept[TestFailedException] {
1290        sevenDotOhFloat should ((be (17.1f plusOrMinus 2.toShort)) and (be (17.1f plusOrMinus 2.toShort)))
1291      }
1292      assert(caught28.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1293      val caught29 = intercept[TestFailedException] {
1294        sevenDotOhFloat should (be (6.9f plusOrMinus 2.toShort) and (be (17.1f plusOrMinus 2.toShort)))
1295      }
1296      assert(caught29.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1297      val caught30 = intercept[TestFailedException] {
1298        sevenDotOhFloat should (be (17.0f plusOrMinus 2.toShort) and be (7.0f plusOrMinus 2.toShort))
1299      }
1300      assert(caught30.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1301
1302      // Float plusOrMinus Byte
1303      val caught31 = intercept[TestFailedException] {
1304        sevenDotOhFloat should ((be (17.1f plusOrMinus 2.toByte)) and (be (17.1f plusOrMinus 2.toByte)))
1305      }
1306      assert(caught31.getMessage === "7.0 was not 17.1 plus or minus 2.0")
1307      val caught32 = intercept[TestFailedException] {
1308        sevenDotOhFloat should (be (6.9f plusOrMinus 2.toByte) and (be (17.1f plusOrMinus 2.toByte)))
1309      }
1310      assert(caught32.getMessage === "7.0 was 6.9 plus or minus 2.0, but 7.0 was not 17.1 plus or minus 2.0")
1311      val caught33 = intercept[TestFailedException] {
1312        sevenDotOhFloat should (be (17.0f plusOrMinus 2.toByte) and be (7.0f plusOrMinus 2.toByte))
1313      }
1314      assert(caught33.getMessage === "7.0 was not 17.0 plus or minus 2.0")
1315
1316      // Long plusOrMinus Long
1317      val caught34 = intercept[TestFailedException] {
1318        sevenLong should ((be (19L plusOrMinus 2L)) and (be (9L plusOrMinus 2L)))
1319      }
1320      assert(caught34.getMessage === "7 was not 19 plus or minus 2")
1321      val caught35 = intercept[TestFailedException] {
1322        sevenLong should (be (18L plusOrMinus 2L) and (be (19L plusOrMinus 2L)))
1323      }
1324      assert(caught35.getMessage === "7 was not 18 plus or minus 2")
1325      val caught36 = intercept[TestFailedException] {
1326        sevenLong should (be (17L plusOrMinus 2L) and be (7L plusOrMinus 2L))
1327      }
1328      assert(caught36.getMessage === "7 was not 17 plus or minus 2")
1329
1330      // Long plusOrMinus Int
1331      val caught37 = intercept[TestFailedException] {
1332        sevenLong should ((be (19L plusOrMinus 2)) and (be (9L plusOrMinus 2)))
1333      }
1334      assert(caught37.getMessage === "7 was not 19 plus or minus 2")
1335      val caught38 = intercept[TestFailedException] {
1336        sevenLong should (be (8L plusOrMinus 2) and (be (19L plusOrMinus 2)))
1337      }
1338      assert(caught38.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1339      val caught39 = intercept[TestFailedException] {
1340        sevenLong should (be (17L plusOrMinus 2) and be (7L plusOrMinus 2))
1341      }
1342      assert(caught39.getMessage === "7 was not 17 plus or minus 2")
1343
1344      // Long plusOrMinus Short
1345      val caught40 = intercept[TestFailedException] {
1346        sevenLong should ((be (19L plusOrMinus 2.toShort)) and (be (9L plusOrMinus 2.toShort)))
1347      }
1348      assert(caught40.getMessage === "7 was not 19 plus or minus 2")
1349      val caught41 = intercept[TestFailedException] {
1350        sevenLong should (be (8L plusOrMinus 2.toShort) and (be (19L plusOrMinus 2.toShort)))
1351      }
1352      assert(caught41.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1353      val caught42 = intercept[TestFailedException] {
1354        sevenLong should (be (17L plusOrMinus 2.toShort) and be (7L plusOrMinus 2.toShort))
1355      }
1356      assert(caught42.getMessage === "7 was not 17 plus or minus 2")
1357
1358      // Long plusOrMinus Byte
1359      val caught43 = intercept[TestFailedException] {
1360        sevenLong should ((be (19L plusOrMinus 2.toByte)) and (be (9L plusOrMinus 2.toByte)))
1361      }
1362      assert(caught43.getMessage === "7 was not 19 plus or minus 2")
1363      val caught44 = intercept[TestFailedException] {
1364        sevenLong should (be (8L plusOrMinus 2.toByte) and (be (19L plusOrMinus 2.toByte)))
1365      }
1366      assert(caught44.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1367      val caught45 = intercept[TestFailedException] {
1368        sevenLong should (be (17L plusOrMinus 2.toByte) and be (7L plusOrMinus 2.toByte))
1369      }
1370      assert(caught45.getMessage === "7 was not 17 plus or minus 2")
1371
1372      // Int plusOrMinus Int
1373      val caught46 = intercept[TestFailedException] {
1374        sevenInt should ((be (19 plusOrMinus 2)) and (be (9 plusOrMinus 2)))
1375      }
1376      assert(caught46.getMessage === "7 was not 19 plus or minus 2")
1377      val caught47 = intercept[TestFailedException] {
1378        sevenInt should (be (8 plusOrMinus 2) and (be (19 plusOrMinus 2)))
1379      }
1380      assert(caught47.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1381      val caught48 = intercept[TestFailedException] {
1382        sevenInt should (be (17 plusOrMinus 2) and be (7 plusOrMinus 2))
1383      }
1384      assert(caught48.getMessage === "7 was not 17 plus or minus 2")
1385
1386      // Int plusOrMinus Short
1387      val caught49 = intercept[TestFailedException] {
1388        sevenInt should ((be (9 plusOrMinus 2.toShort)) and (be (19 plusOrMinus 2.toShort)))
1389      }
1390      assert(caught49.getMessage === "7 was 9 plus or minus 2, but 7 was not 19 plus or minus 2")
1391      val caught50 = intercept[TestFailedException] {
1392        sevenInt should (be (8 plusOrMinus 2.toShort) and (be (19 plusOrMinus 2.toShort)))
1393      }
1394      assert(caught50.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1395      val caught51 = intercept[TestFailedException] {
1396        sevenInt should (be (17 plusOrMinus 2.toShort) and be (7 plusOrMinus 2.toShort))
1397      }
1398      assert(caught51.getMessage === "7 was not 17 plus or minus 2")
1399
1400      // Int plusOrMinus Byte
1401      val caught52 = intercept[TestFailedException] {
1402        sevenInt should ((be (19 plusOrMinus 2.toByte)) and (be (9 plusOrMinus 2.toByte)))
1403      }
1404      assert(caught52.getMessage === "7 was not 19 plus or minus 2")
1405      val caught53 = intercept[TestFailedException] {
1406        sevenInt should (be (8 plusOrMinus 2.toByte) and (be (19 plusOrMinus 2.toByte)))
1407      }
1408      assert(caught53.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1409      val caught54 = intercept[TestFailedException] {
1410        sevenInt should (be (17 plusOrMinus 2.toByte) and be (7 plusOrMinus 2.toByte))
1411      }
1412      assert(caught54.getMessage === "7 was not 17 plus or minus 2")
1413
1414      // Short plusOrMinus Short
1415      val caught55 = intercept[TestFailedException] {
1416        sevenShort should ((be (19.toShort plusOrMinus 2.toShort)) and (be (9.toShort plusOrMinus 2.toShort)))
1417      }
1418      assert(caught55.getMessage === "7 was not 19 plus or minus 2")
1419      val caught56 = intercept[TestFailedException] {
1420        sevenShort should (be (8.toShort plusOrMinus 2.toShort) and (be (19.toShort plusOrMinus 2.toShort)))
1421      }
1422      assert(caught56.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1423      val caught57 = intercept[TestFailedException] {
1424        sevenShort should (be (17.toShort plusOrMinus 2.toShort) and be (7.toShort plusOrMinus 2.toShort))
1425      }
1426      assert(caught57.getMessage === "7 was not 17 plus or minus 2")
1427
1428      // Short plusOrMinus Byte
1429      val caught58 = intercept[TestFailedException] {
1430        sevenShort should ((be (19.toShort plusOrMinus 2.toByte)) and (be (9.toShort plusOrMinus 2.toByte)))
1431      }
1432      assert(caught58.getMessage === "7 was not 19 plus or minus 2")
1433      val caught59 = intercept[TestFailedException] {
1434        sevenShort should (be (8.toShort plusOrMinus 2.toByte) and (be (19.toShort plusOrMinus 2.toByte)))
1435      }
1436      assert(caught59.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1437      val caught60 = intercept[TestFailedException] {
1438        sevenShort should (be (17.toShort plusOrMinus 2.toByte) and be (7.toShort plusOrMinus 2.toByte))
1439      }
1440      assert(caught60.getMessage === "7 was not 17 plus or minus 2")
1441
1442      // Byte plusOrMinus Byte
1443      val caught61 = intercept[TestFailedException] {
1444        sevenByte should ((be (19.toByte plusOrMinus 2.toByte)) and (be (9.toByte plusOrMinus 2.toByte)))
1445      }
1446      assert(caught61.getMessage === "7 was not 19 plus or minus 2")
1447      val caught62 = intercept[TestFailedException] {
1448        sevenByte should (be (8.toByte plusOrMinus 2.toByte) and (be (19.toByte plusOrMinus 2.toByte)))
1449      }
1450      assert(caught62.getMessage === "7 was 8 plus or minus 2, but 7 was not 19 plus or minus 2")
1451      val caught63 = intercept[TestFailedException] {
1452        sevenByte should (be (17.toByte plusOrMinus 2.toByte) and be (7.toByte plusOrMinus 2.toByte))
1453      }
1454      assert(caught63.getMessage === "7 was not 17 plus or minus 2")
1455    }
1456
1457    it("should throw TestFailedException if the number is not within the specified range, when used in a logical-or expression") {
1458
1459      // Double plusOrMinus Double
1460      val caught1 = intercept[TestFailedException] {
1461        sevenDotOh should ((be (17.1 plusOrMinus 0.2)) or (be (17.1 plusOrMinus 0.2)))
1462      }
1463      assert(caught1.getMessage === "7.0 was not 17.1 plus or minus 0.2, and 7.0 was not 17.1 plus or minus 0.2")
1464      val caught2 = intercept[TestFailedException] {
1465        sevenDotOh should (be (16.9 plusOrMinus 0.2) or (be (17.1 plusOrMinus 0.2)))
1466      }
1467      assert(caught2.getMessage === "7.0 was not 16.9 plus or minus 0.2, and 7.0 was not 17.1 plus or minus 0.2")
1468      val caught3 = intercept[TestFailedException] {
1469        sevenDotOh should (be (17.0 plusOrMinus 0.2) or be (97.0 plusOrMinus 0.2))
1470      }
1471      assert(caught3.getMessage === "7.0 was not 17.0 plus or minus 0.2, and 7.0 was not 97.0 plus or minus 0.2")
1472    }
1473
1474    it("should throw TestFailedException if the number is within the specified range, when used in a logical-and expression with not") {
1475
1476      // Double plusOrMinus Double
1477      val caught1 = intercept[TestFailedException] {
1478        sevenDotOh should (not (be (17.1 plusOrMinus 0.2)) and not (be (7.1 plusOrMinus 0.2)))
1479      }
1480      assert(caught1.getMessage === "7.0 was not 17.1 plus or minus 0.2, but 7.0 was 7.1 plus or minus 0.2")
1481      val caught2 = intercept[TestFailedException] {
1482        sevenDotOh should (not be (16.9 plusOrMinus 0.2) and (not be (7.1 plusOrMinus 0.2)))
1483      }
1484      assert(caught2.getMessage === "7.0 was not 16.9 plus or minus 0.2, but 7.0 was 7.1 plus or minus 0.2")
1485      val caught3 = intercept[TestFailedException] {
1486        sevenDotOh should (not be (17.0 plusOrMinus 0.2) and not be (7.0 plusOrMinus 0.2))
1487      }
1488      assert(caught3.getMessage === "7.0 was not 17.0 plus or minus 0.2, but 7.0 was 7.0 plus or minus 0.2")
1489
1490      // Check that the error message "short circuits"
1491      val caught4 = intercept[TestFailedException] {
1492        sevenDotOh should (not (be (7.1 plusOrMinus 0.2)) and not (be (7.1 plusOrMinus 0.2)))
1493      }
1494      assert(caught4.getMessage === "7.0 was 7.1 plus or minus 0.2")
1495    }
1496
1497    it("should throw TestFailedException if the number is within the specified range, when used in a logical-or expression with not") {
1498
1499      // Double plusOrMinus Double
1500      val caught1 = intercept[TestFailedException] {
1501        sevenDotOh should (not (be (7.1 plusOrMinus 0.2)) or not (be (7.1 plusOrMinus 0.2)))
1502      }
1503      assert(caught1.getMessage === "7.0 was 7.1 plus or minus 0.2, and 7.0 was 7.1 plus or minus 0.2")
1504      val caught2 = intercept[TestFailedException] {
1505        sevenDotOh should ((not be (6.9 plusOrMinus 0.2)) or (not be (7.1 plusOrMinus 0.2)))
1506      }
1507      assert(caught2.getMessage === "7.0 was 6.9 plus or minus 0.2, and 7.0 was 7.1 plus or minus 0.2")
1508      val caught3 = intercept[TestFailedException] {
1509        sevenDotOh should (not be (7.0 plusOrMinus 0.2) or not be (7.0 plusOrMinus 0.2))
1510      }
1511      assert(caught3.getMessage === "7.0 was 7.0 plus or minus 0.2, and 7.0 was 7.0 plus or minus 0.2")
1512    }
1513
1514    it("should throw TestFailedException if the number passed as the range is 0 or negative") {
1515
1516      // Double plusOrMinus Double
1517      val caught1 = intercept[TestFailedException] {
1518        sevenDotOh should be (7.1 plusOrMinus -0.2)
1519      }
1520      assert(caught1.getMessage === "Range (-0.2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1521
1522      // Double plusOrMinus Float
1523      val caught2 = intercept[TestFailedException] {
1524        sevenDotOh should be (7.1 plusOrMinus -0.2f)
1525      }
1526      assert(caught2.getMessage === "Range (-0.20000000298023224) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1527
1528      // Double plusOrMinus Long
1529      val caught3 = intercept[TestFailedException] {
1530        sevenDotOh should be (7.1 plusOrMinus -2L)
1531      }
1532      assert(caught3.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1533
1534      // Double plusOrMinus Int
1535      val caught4 = intercept[TestFailedException] {
1536        sevenDotOh should be (7.1 plusOrMinus -2)
1537      }
1538      assert(caught4.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1539
1540      // Double plusOrMinus Short
1541      val caught5 = intercept[TestFailedException] {
1542        sevenDotOh should be (7.1 plusOrMinus (-2).toShort)
1543      }
1544      assert(caught5.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1545
1546      // Double plusOrMinus Byte
1547      val caught6 = intercept[TestFailedException] {
1548        sevenDotOh should be (7.1 plusOrMinus (-2).toByte)
1549      }
1550      assert(caught6.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1551
1552      // Float plusOrMinus Float
1553      val caught7 = intercept[TestFailedException] {
1554        sevenDotOhFloat should be (7.1f plusOrMinus -0.2f)
1555      }
1556      assert(caught7.getMessage === "Range (-0.2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1557
1558      // Float plusOrMinus Long
1559      val caught8 = intercept[TestFailedException] {
1560        sevenDotOhFloat should be (7.1f plusOrMinus -2L)
1561      }
1562      assert(caught8.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1563
1564      // Float plusOrMinus Int
1565      val caught9 = intercept[TestFailedException] {
1566        sevenDotOhFloat should be (7.1f plusOrMinus -2)
1567      }
1568      assert(caught9.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1569
1570      // Float plusOrMinus Short
1571      val caught10 = intercept[TestFailedException] {
1572        sevenDotOhFloat should be (7.1f plusOrMinus (-2).toShort)
1573      }
1574      assert(caught10.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1575
1576      // Float plusOrMinus Byte
1577      val caught11 = intercept[TestFailedException] {
1578        sevenDotOhFloat should be (7.1f plusOrMinus (-2).toByte)
1579      }
1580      assert(caught11.getMessage === "Range (-2.0) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1581
1582      // Long plusOrMinus Long
1583      val caught12 = intercept[TestFailedException] {
1584        sevenLong should be (9L plusOrMinus -2L)
1585      }
1586      assert(caught12.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1587
1588      // Long plusOrMinus Int
1589      val caught13 = intercept[TestFailedException] {
1590        sevenLong should be (9L plusOrMinus -2)
1591      }
1592      assert(caught13.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1593
1594      // Long plusOrMinus Short
1595      val caught14 = intercept[TestFailedException] {
1596        sevenLong should be (9L plusOrMinus (-2).toShort)
1597      }
1598      assert(caught14.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1599
1600      // Long plusOrMinus Byte
1601      val caught15 = intercept[TestFailedException] {
1602        sevenLong should be (9L plusOrMinus (-2).toByte)
1603      }
1604      assert(caught15.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1605
1606      // Int plusOrMinus Int
1607      val caught16 = intercept[TestFailedException] {
1608        sevenInt should be (9 plusOrMinus -2)
1609      }
1610      assert(caught16.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1611
1612      // Int plusOrMinus Short
1613      val caught17 = intercept[TestFailedException] {
1614        sevenInt should be (9 plusOrMinus (-2).toShort)
1615      }
1616      assert(caught17.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1617
1618      // Int plusOrMinus Byte
1619      val caught18 = intercept[TestFailedException] {
1620        sevenInt should be (9 plusOrMinus (-2).toByte)
1621      }
1622      assert(caught18.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1623
1624      // Short plusOrMinus Short
1625      val caught19 = intercept[TestFailedException] {
1626        sevenShort should be (9.toShort plusOrMinus (-2).toShort)
1627      }
1628      assert(caught19.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1629
1630      // Short plusOrMinus Byte
1631      val caught20 = intercept[TestFailedException] {
1632        sevenShort should be (9.toShort plusOrMinus (-2).toByte)
1633      }
1634      assert(caught20.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1635
1636      // Byte plusOrMinus Byte
1637      val caught21 = intercept[TestFailedException] {
1638        sevenByte should be (9.toByte plusOrMinus (-2).toByte)
1639      }
1640      assert(caught21.getMessage === "Range (-2) passed to plusOrMinus was zero or negative. Must be a positive non-zero number.")
1641    }
1642  }
1643}
1644