mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
jetCheck: extract ShrinkTest
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user