Skip to content

Commit

Permalink
Another set of tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchallen committed Oct 3, 2022
1 parent 77aab8e commit 531b51b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
20 changes: 3 additions & 17 deletions src/main/kotlin/Solution.kt
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class Solution(val solution: Class<*>) {
receiverGenerators.sumOf { generator ->
generatorFactory.get(Random, Cloner.shared())[generator]!!.fixed.filter {
it.type == Parameters.Type.SIMPLE || it.type == Parameters.Type.FIXED_FIELD
}.size * 2
}
}.size
} * 2
}
private val defaultMethodCount = (
(allExecutables - receiverGenerators).sumOf { generator ->
Expand Down Expand Up @@ -221,7 +221,7 @@ class Solution(val solution: Class<*>) {
check(settings.shrink != null) {
"shrink setting must be specified"
}
var testCount = if (settings.testCount != -1) {
val testCount = if (settings.testCount != -1) {
check(settings.minTestCount == -1 && settings.maxTestCount == -1) {
"Can't set testCount and minTestCount or maxTestCount"
}
Expand Down Expand Up @@ -256,20 +256,6 @@ class Solution(val solution: Class<*>) {
} else {
-1
}
if (receiverCount != -1) {
if (settings.testCount != -1) {
check(testCount >= receiverCount * 2) {
"Not enough tests to test all receivers: ${settings.testCount}"
}
} else {
testCount = testCount.coerceAtLeast(receiverCount * 2)
if (settings.maxTestCount != -1) {
check(testCount <= settings.maxTestCount) {
"Can't test all receivers without exceeding maxTestCount: $testCount ${settings.maxTestCount}"
}
}
}
}
return settings.copy(testCount = testCount, methodCount = methodCount, receiverCount = receiverCount)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ suspend fun Solution.fullTest(

if (!isCorrect) {
first.indexOfFirst { it.failed } shouldBe first.size - 1
failingTestCount = original.size.coerceAtLeast(first.settings.receiverCount * 2)
failingTestCount = first.size
}

first.size shouldBe second.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public Correct(String setString, double setFirst, double setSecond) {
second = setSecond;
}

@SimpleType private static final double[] SIMPLE_DOUBLES = new double[] {8.8};
@SimpleType private static final String[] SIMPLE_STRINGS = new String[] {"test", "me"};

@SimpleType
private static final double[] SIMPLE_DOUBLES = new double[] {-90.0, -89.9, 89.9, 90.0};

@EdgeType
private static final double[] EDGE_DOUBLES =
new double[] {
-180.1, -180.0, -179.9, -90.1, -90.0, -89.9, 89.9, 90.0, 90.1, 179.9, 180.0, 180.1
};
new double[] {-180.1, -180.0, -179.9, -90.1, 90.1, 179.9, 180.0, 180.1};

@RandomType
private static double randomPosition(Random random) {
Expand Down

0 comments on commit 531b51b

Please sign in to comment.