-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
empty test produces number out of range error #50
Comments
Thanks for the catch. I’ll have a look at it.
… Am 19.03.2019 um 11:12 schrieb Michael Mosmann ***@***.***>:
Version testet: 1.1.1
Java: Oracle Java 8
Kotlin: 1.3.11
Testing Problem
following kotlin test code ...
@Property
fun ***@***.*** @DoubleRange(min = 0.001, max = 0.2) grow: Double) {
}
produces following error:
Number <0.00> is outside allowed range 0.00010..0.2
net.jqwik.api.JqwikException: Number <0.00> is outside allowed range 0.00010..0.2
at net.jqwik.engine.properties.shrinking.ShrinkableBigDecimal.determineTarget(ShrinkableBigDecimal.java:49)
at net.jqwik.engine.properties.shrinking.ShrinkableBigDecimal.<init>(ShrinkableBigDecimal.java:21)
at net.jqwik.engine.properties.arbitraries.randomized.RandomDecimalGenerators.lambda$createBaseGenerator$2(RandomDecimalGenerators.java:58)
at net.jqwik.engine.properties.arbitraries.randomized.RandomGenerators.lambda$withEdgeCases$10(RandomGenerators.java:220)
at net.jqwik.api.RandomGenerator.lambda$map$0(RandomGenerator.java:43)
at net.jqwik.engine.properties.RandomizedShrinkablesGenerator$RandomizedParameterGenerator.next(RandomizedShrinkablesGenerator.java:74)
at net.jqwik.engine.properties.RandomizedShrinkablesGenerator$RandomizedParameterGenerator.access$100(RandomizedShrinkablesGenerator.java:61)
at net.jqwik.engine.properties.RandomizedShrinkablesGenerator.lambda$next$1(RandomizedShrinkablesGenerator.java:57)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at net.jqwik.engine.properties.RandomizedShrinkablesGenerator.next(RandomizedShrinkablesGenerator.java:58)
at net.jqwik.engine.properties.RandomizedShrinkablesGenerator.next(RandomizedShrinkablesGenerator.java:11)
at net.jqwik.engine.properties.GenericProperty.checkWithoutReporting(GenericProperty.java:68)
at net.jqwik.engine.properties.GenericProperty.check(GenericProperty.java:39)
at net.jqwik.engine.execution.CheckedProperty.check(CheckedProperty.java:39)
at net.jqwik.engine.execution.PropertyMethodExecutor.executeProperty(PropertyMethodExecutor.java:121)
at net.jqwik.engine.execution.PropertyMethodExecutor.executeMethod(PropertyMethodExecutor.java:109)
at net.jqwik.engine.execution.PropertyMethodExecutor.lambda$executePropertyMethod$0(PropertyMethodExecutor.java:89)
at net.jqwik.api.lifecycle.AroundPropertyHook.lambda$static$0(AroundPropertyHook.java:17)
at net.jqwik.api.lifecycle.AroundPropertyHook.lambda$null$1(AroundPropertyHook.java:32)
at net.jqwik.engine.execution.lifecycle.AutoCloseableHook.aroundProperty(AutoCloseableHook.java:14)
at net.jqwik.api.lifecycle.AroundPropertyHook.lambda$around$2(AroundPropertyHook.java:37)
at net.jqwik.engine.execution.PropertyMethodExecutor.executePropertyMethod(PropertyMethodExecutor.java:87)
at net.jqwik.engine.execution.PropertyMethodExecutor.execute(PropertyMethodExecutor.java:46)
at net.jqwik.engine.execution.PropertyTaskCreator.executeTestMethod(PropertyTaskCreator.java:73)
at net.jqwik.engine.execution.PropertyTaskCreator.lambda$createTask$1(PropertyTaskCreator.java:38)
at net.jqwik.engine.execution.pipeline.ExecutionTask$1.execute(ExecutionTask.java:24)
at net.jqwik.engine.execution.pipeline.ExecutionPipeline.runToTermination(ExecutionPipeline.java:81)
at net.jqwik.engine.execution.JqwikExecutor.execute(JqwikExecutor.java:46)
at net.jqwik.engine.JqwikTestEngine.executeTests(JqwikTestEngine.java:93)
at net.jqwik.engine.JqwikTestEngine.execute(JqwikTestEngine.java:82)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:102)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:82)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:78)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
following code
@Property
fun ***@***.*** @DoubleRange(min = 0.01, max = 0.2) grow: Double) {
}
works fine:)
Suggested Solution
should not fail
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The generation bug should be fixed in f6dc8c4 and is available in 1.1.2-SNAPSHOT. However, what you probably want to do in your property is set the scale (number of interesting decimal places) to 3, so that values between 0.001 and 0.200 will be generated:
|
thanks:) but we wanted something like @DoubleRange(minExcluding=0.0 ...) so we tried (because we were lazy) min=0.0000001 and then the test failed.. :) |
Are you certaing you're using version 1.1.2-SNAPSHOT? I tried to replicate and did not get a failure. BTW, you can exclude the borders by using
|
we can not test with 1.1.2-SNAPSHOT.. but i am sure that the bug is gone:) and 'Assume.that(grow != 0.0);' is valid kotlin code (you dont need the ';' but it is ok) and worked as expected.. thanks:) |
Version testet: 1.1.1
Java: Oracle Java 8
Kotlin: 1.3.11
Testing Problem
following kotlin test code ...
produces following error:
following code
works fine:)
Suggested Solution
should not fail
The text was updated successfully, but these errors were encountered: