jetCheck: extract ShrinkTest

This commit is contained in:
peter
2018-01-02 10:28:11 +01:00
parent 7d430b159e
commit 86f275aed2
2 changed files with 30 additions and 16 deletions
-16
View File
@@ -119,13 +119,6 @@ public class GeneratorTest extends PropertyCheckerTestCase {
assertEquals(2, list.size());
}
public void testShrinkingNonEmptyList() {
List<Integer> list = checkGeneratesExample(nonEmptyLists(integers(0, 100)),
l -> l.contains(42),
12);
assertEquals(1, list.size());
}
public void testRecheckWithGivenSeeds() {
Generator<List<Integer>> gen = nonEmptyLists(integers(0, 100));
Predicate<List<Integer>> property = l -> !l.contains(42);
@@ -142,15 +135,6 @@ public class GeneratorTest extends PropertyCheckerTestCase {
assertEquals(failure.getIterationNumber(), e.getFailure().getIterationNumber());
}
public void testShrinkingComplexString() {
checkFalsified(listsOf(stringsOf(asciiPrintableChars())),
l -> {
String s = l.toString();
return !"abcdefghijklmnopqrstuvwxyz()[]#!".chars().allMatch(c -> s.indexOf((char)c) >= 0);
},
225);
}
public void testSameFrequency() {
checkFalsified(listsOf(frequency(1, constant(1), 1, constant(2))),
l -> !l.contains(1) || !l.contains(2),
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package jetCheck;
import java.util.List;
import static jetCheck.Generator.*;
/**
* @author peter
*/
public class ShrinkTest extends PropertyCheckerTestCase {
public void testShrinkingComplexString() {
checkFalsified(listsOf(stringsOf(asciiPrintableChars())),
l -> {
String s = l.toString();
return !"abcdefghijklmnopqrstuvwxyz()[]#!".chars().allMatch(c -> s.indexOf((char)c) >= 0);
},
225);
}
public void testShrinkingNonEmptyList() {
List<Integer> list = checkGeneratesExample(nonEmptyLists(integers(0, 100)),
l -> l.contains(42),
12);
assertEquals(1, list.size());
}
}