make slowCheck available on TC, but don't run apply-and-revert tests yet

This commit is contained in:
peter
2017-06-13 15:36:57 +02:00
parent 7d9164f0c3
commit e16deafc89
9 changed files with 92 additions and 17 deletions
+1
View File
@@ -125,5 +125,6 @@
<orderEntry type="module" module-name="platform-build-scripts" scope="TEST" />
<orderEntry type="module" module-name="android-plugin" />
<orderEntry type="module" module-name="stats-collector" />
<orderEntry type="module" module-name="slowCheck" scope="TEST" />
</component>
</module>
+1
View File
@@ -56,5 +56,6 @@
<orderEntry type="library" scope="TEST" name="memoryfilesystem" level="project" />
<orderEntry type="module" module-name="testExtensions" scope="TEST" />
<orderEntry type="module" module-name="configuration-store-impl" scope="TEST" />
<orderEntry type="module" module-name="slowCheck" scope="TEST" />
</component>
</module>
@@ -1,4 +1,19 @@
package slowCheck;
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.propertyBased;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.ide.impl.ProjectUtil;
@@ -32,9 +47,11 @@ import com.intellij.psi.stubs.StubTree;
import com.intellij.testFramework.CompilerTester;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.TestDataProvider;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import slowCheck.Generator;
import java.io.File;
import java.util.ArrayList;
@@ -72,6 +89,14 @@ public abstract class AbstractApplyAndRevertTestCase extends PlatformTestCase {
}
@Override
protected boolean shouldRunTest() {
if (UsefulTestCase.IS_UNDER_TEAMCITY) {
return false;
}
return super.shouldRunTest();
}
protected abstract String getTestDataPath();
public void setUp() throws Exception {
@@ -1,4 +1,19 @@
package slowCheck;
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.propertyBased;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.RangeMarker;
@@ -1,4 +1,19 @@
package slowCheck;
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.propertyBased;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.openapi.command.WriteCommandAction;
@@ -13,6 +28,9 @@ import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nullable;
import slowCheck.Checker;
import slowCheck.CheckerSettings;
import slowCheck.Generator;
import java.util.List;
import java.util.Objects;
@@ -1,4 +1,19 @@
package slowCheck;
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.propertyBased;
import com.intellij.codeInsight.completion.CodeCompletionHandlerBase;
import com.intellij.codeInsight.completion.CompletionType;
@@ -17,6 +32,10 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import slowCheck.Checker;
import slowCheck.CheckerSettings;
import slowCheck.Generator;
import slowCheck.IntDistribution;
import java.util.List;
+1 -4
View File
@@ -9,10 +9,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
<orderEntry type="module" module-name="core-api" scope="TEST" />
<orderEntry type="module" module-name="indexing-impl" scope="TEST" />
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
<orderEntry type="module" module-name="compiler-openapi" scope="TEST" />
<orderEntry type="module" module-name="annotations" />
<orderEntry type="module" module-name="util" scope="TEST" />
</component>
</module>
+1 -1
View File
@@ -7,7 +7,7 @@ import java.util.function.Predicate;
/**
* @author peter
*/
interface DataStructure {
public interface DataStructure {
default int drawInt() {
return drawInt(BoundedIntDistribution.ALL_INTS);
+7 -8
View File
@@ -1,6 +1,5 @@
package slowCheck;
import com.intellij.util.containers.ContainerUtil;
import junit.framework.TestCase;
import java.util.List;
@@ -8,8 +7,6 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import static slowCheck.Generator.*;
import static slowCheck.Generator.doubles;
import static slowCheck.Generator.listOf;
/**
* @author peter
@@ -54,12 +51,14 @@ public class GeneratorTest extends TestCase {
}
public void testSuccess() {
Checker.forAll(ourTestSettings, listOf(integers(-1, 1)), l ->
l.stream().allMatch(i -> Math.abs(i) <= 1));
Checker.forAll(listOf(integers(-1, 1)),
l -> l.stream().allMatch(i -> Math.abs(i) <= 1));
}
public void testSortedDoublesNonDescending() {
checkFalsified(listOf(doubles()), l -> isSorted(ContainerUtil.sorted(l)), 329);
checkFalsified(listOf(doubles()),
l -> isSorted(l.stream().sorted().collect(Collectors.toList())),
329);
}
private static boolean isSorted(List<Double> list) {
@@ -78,12 +77,12 @@ public class GeneratorTest extends TestCase {
}
public void testSuchThat() {
Checker.forAll(ourTestSettings, integers(-1, 1).suchThat(i -> i == 0), i -> i == 0);
Checker.forAll(integers(-1, 1).suchThat(i -> i == 0), i -> i == 0);
}
public void testUnsatisfiableSuchThat() {
try {
Checker.forAll(ourTestSettings, integers(-1, 1).suchThat(i -> i >2), i -> i == 0);
Checker.forAll(integers(-1, 1).suchThat(i -> i >2), i -> i == 0);
fail();
}
catch (CannotSatisfyCondition ignored) {