128 |
|
} |
129 |
|
|
130 |
|
/** |
131 |
< |
* nextInt(negative) throws IllegalArgumentException |
131 |
> |
* nextInt(non-positive) throws IllegalArgumentException |
132 |
|
*/ |
133 |
< |
public void testNextIntBoundedNeg() { |
133 |
> |
public void testNextIntNonPositive() { |
134 |
|
SplittableRandom sr = new SplittableRandom(); |
135 |
< |
try { |
136 |
< |
int f = sr.nextInt(-17); |
137 |
< |
shouldThrow(); |
138 |
< |
} catch (IllegalArgumentException success) {} |
135 |
> |
Runnable[] throwingActions = { |
136 |
> |
() -> sr.nextInt(-17), |
137 |
> |
() -> sr.nextInt(0), |
138 |
> |
() -> sr.nextInt(Integer.MIN_VALUE), |
139 |
> |
}; |
140 |
> |
assertThrows(IllegalArgumentException.class, throwingActions); |
141 |
|
} |
142 |
|
|
143 |
|
/** |
195 |
|
} |
196 |
|
|
197 |
|
/** |
198 |
< |
* nextLong(negative) throws IllegalArgumentException |
198 |
> |
* nextLong(non-positive) throws IllegalArgumentException |
199 |
|
*/ |
200 |
< |
public void testNextLongBoundedNeg() { |
200 |
> |
public void testNextLongNonPositive() { |
201 |
|
SplittableRandom sr = new SplittableRandom(); |
202 |
< |
try { |
203 |
< |
long f = sr.nextLong(-17); |
204 |
< |
shouldThrow(); |
205 |
< |
} catch (IllegalArgumentException success) {} |
202 |
> |
Runnable[] throwingActions = { |
203 |
> |
() -> sr.nextLong(-17L), |
204 |
> |
() -> sr.nextLong(0L), |
205 |
> |
() -> sr.nextLong(Long.MIN_VALUE), |
206 |
> |
}; |
207 |
> |
assertThrows(IllegalArgumentException.class, throwingActions); |
208 |
|
} |
209 |
|
|
210 |
|
/** |
261 |
|
} |
262 |
|
|
263 |
|
/** |
264 |
+ |
* nextDouble(non-positive) throws IllegalArgumentException |
265 |
+ |
*/ |
266 |
+ |
public void testNextDoubleNonPositive() { |
267 |
+ |
SplittableRandom sr = new SplittableRandom(); |
268 |
+ |
Runnable[] throwingActions = { |
269 |
+ |
() -> sr.nextDouble(-17.0d), |
270 |
+ |
() -> sr.nextDouble(0.0d), |
271 |
+ |
() -> sr.nextDouble(-Double.MIN_VALUE), |
272 |
+ |
() -> sr.nextDouble(Double.NEGATIVE_INFINITY), |
273 |
+ |
() -> sr.nextDouble(Double.NaN), |
274 |
+ |
}; |
275 |
+ |
assertThrows(IllegalArgumentException.class, throwingActions); |
276 |
+ |
} |
277 |
+ |
|
278 |
+ |
/** |
279 |
|
* nextDouble(least, bound) returns least <= value < bound; |
280 |
|
* repeated calls produce at least two distinct results |
281 |
|
*/ |