|
1 | 1 | package com.tegonal.variist.generators |
2 | 2 |
|
| 3 | +import ch.tutteli.atrium.api.fluent.en_GB.messageToContain |
3 | 4 | import ch.tutteli.atrium.api.fluent.en_GB.toEqual |
| 5 | +import ch.tutteli.atrium.api.fluent.en_GB.toThrow |
4 | 6 | import ch.tutteli.atrium.api.verbs.expect |
5 | 7 | import ch.tutteli.kbox.Tuple |
6 | 8 | import com.tegonal.variist.providers.ArgsRange |
7 | 9 | import com.tegonal.variist.providers.ArgsSource |
| 10 | +import com.tegonal.variist.providers.ArgsSourceOptions |
8 | 11 | import com.tegonal.variist.utils.repeatForever |
| 12 | +import org.junit.jupiter.api.Test |
9 | 13 | import org.junit.jupiter.params.ParameterizedTest |
10 | 14 |
|
11 | 15 | class OrderedFromProgressionTest : AbstractOrderedArgsGeneratorTest<Any>() { |
@@ -34,7 +38,38 @@ class OrderedFromProgressionTest : AbstractOrderedArgsGeneratorTest<Any>() { |
34 | 38 | ) |
35 | 39 | } |
36 | 40 |
|
37 | | - //TODO 2.0.0 write test for intProgression and longProgression, especially for cases where the range size overflows Int/Long Domain |
| 41 | + @ParameterizedTest |
| 42 | + @ArgsSource("arbIntNegative") |
| 43 | + @ArgsSourceOptions(maxArgs = 1) |
| 44 | + fun intProgression_numberOfSteps_overflow_Int__throws(from: Int) { |
| 45 | + expect { |
| 46 | + ordered.fromProgression(from..Int.MAX_VALUE step 1) |
| 47 | + }.toThrow<IllegalStateException> { |
| 48 | + messageToContain("OrderedArgsGenerator.size only supports Int") |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + @ParameterizedTest |
| 53 | + @ArgsSource("arbIntNegative") |
| 54 | + @ArgsSourceOptions(maxArgs = 1) |
| 55 | + fun longProgression_numberOfSteps_overflow_Int__throws(from: Int) { |
| 56 | + expect { |
| 57 | + ordered.fromProgression(from.toLong()..Int.MAX_VALUE.toLong() step 1) |
| 58 | + }.toThrow<IllegalStateException> { |
| 59 | + messageToContain("OrderedArgsGenerator.size only supports Int") |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + @ParameterizedTest |
| 64 | + @ArgsSource("arbLongNegative") |
| 65 | + @ArgsSourceOptions(maxArgs = 1) |
| 66 | + fun longProgression_numberOfSteps_overflow_Long__throws(from: Long) { |
| 67 | + expect { |
| 68 | + ordered.fromProgression(from..Long.MAX_VALUE step 1) |
| 69 | + }.toThrow<IllegalStateException> { |
| 70 | + messageToContain("OrderedArgsGenerator.size only supports Int") |
| 71 | + } |
| 72 | + } |
38 | 73 |
|
39 | 74 | companion object { |
40 | 75 | @JvmStatic |
|
0 commit comments