diff options
| author | J08nY | 2018-06-27 22:00:59 +0200 |
|---|---|---|
| committer | J08nY | 2018-06-27 22:00:59 +0200 |
| commit | 662cc82a470a833a11e19a2dc8c1ce0e79c35935 (patch) | |
| tree | 774d36ba7ceeead7897136900c9be485e4c4ae2e /src/cz/crcs/ectester/common/test | |
| parent | 46f3b1218d55ea856986cd7afb4804152c230c4f (diff) | |
| download | ECTester-662cc82a470a833a11e19a2dc8c1ce0e79c35935.tar.gz ECTester-662cc82a470a833a11e19a2dc8c1ce0e79c35935.tar.zst ECTester-662cc82a470a833a11e19a2dc8c1ce0e79c35935.zip | |
Implement more tests for wrong parameters. Implement cloning for Tests.
- Test G = infinity.
- Test wrong r, where [r]G != infinity,
- prime
- composite
Diffstat (limited to 'src/cz/crcs/ectester/common/test')
| -rw-r--r-- | src/cz/crcs/ectester/common/test/BaseTestable.java | 7 | ||||
| -rw-r--r-- | src/cz/crcs/ectester/common/test/CompoundTest.java | 7 | ||||
| -rw-r--r-- | src/cz/crcs/ectester/common/test/SimpleTest.java | 15 | ||||
| -rw-r--r-- | src/cz/crcs/ectester/common/test/Test.java | 7 |
4 files changed, 32 insertions, 4 deletions
diff --git a/src/cz/crcs/ectester/common/test/BaseTestable.java b/src/cz/crcs/ectester/common/test/BaseTestable.java index 4863abc..3c304d9 100644 --- a/src/cz/crcs/ectester/common/test/BaseTestable.java +++ b/src/cz/crcs/ectester/common/test/BaseTestable.java @@ -3,7 +3,7 @@ package cz.crcs.ectester.common.test; /** * @author Jan Jancar johny@neuromancer.sk */ -public abstract class BaseTestable implements Testable { +public abstract class BaseTestable implements Testable, Cloneable { protected boolean hasRun; protected boolean ok; protected boolean error; @@ -36,4 +36,9 @@ public abstract class BaseTestable implements Testable { error = false; errorCause = null; } + + @Override + protected BaseTestable clone() throws CloneNotSupportedException { + return (BaseTestable) super.clone(); + } } diff --git a/src/cz/crcs/ectester/common/test/CompoundTest.java b/src/cz/crcs/ectester/common/test/CompoundTest.java index 607dadb..ba4ad4f 100644 --- a/src/cz/crcs/ectester/common/test/CompoundTest.java +++ b/src/cz/crcs/ectester/common/test/CompoundTest.java @@ -10,7 +10,7 @@ import java.util.function.Function; * * @author Jan Jancar johny@neuromancer.sk */ -public class CompoundTest extends Test { +public class CompoundTest extends Test implements Cloneable { private Function<Test[], Result> resultCallback; private Consumer<Test[]> runCallback; private Test[] tests; @@ -206,4 +206,9 @@ public class CompoundTest extends Test { public String getDescription() { return description; } + + @Override + public CompoundTest clone() throws CloneNotSupportedException { + return (CompoundTest) super.clone(); + } } diff --git a/src/cz/crcs/ectester/common/test/SimpleTest.java b/src/cz/crcs/ectester/common/test/SimpleTest.java index 85f1072..d2b3e94 100644 --- a/src/cz/crcs/ectester/common/test/SimpleTest.java +++ b/src/cz/crcs/ectester/common/test/SimpleTest.java @@ -4,11 +4,17 @@ package cz.crcs.ectester.common.test; * @param <T> * @author Jan Jancar johny@neuromancer.sk */ -public abstract class SimpleTest<T extends BaseTestable> extends Test { +public abstract class SimpleTest<T extends BaseTestable> extends Test implements Testable { protected T testable; protected TestCallback<T> callback; public SimpleTest(T testable, TestCallback<T> callback) { + if (testable == null) { + throw new IllegalArgumentException("testable is null."); + } + if (callback == null) { + throw new IllegalArgumentException("callback is null."); + } this.testable = testable; this.callback = callback; } @@ -22,4 +28,11 @@ public abstract class SimpleTest<T extends BaseTestable> extends Test { testable.run(); result = callback.apply(testable); } + + @Override + public SimpleTest clone() throws CloneNotSupportedException { + SimpleTest clone = (SimpleTest) super.clone(); + clone.testable = testable.clone(); + return clone; + } } diff --git a/src/cz/crcs/ectester/common/test/Test.java b/src/cz/crcs/ectester/common/test/Test.java index 055ec1c..8bf9502 100644 --- a/src/cz/crcs/ectester/common/test/Test.java +++ b/src/cz/crcs/ectester/common/test/Test.java @@ -7,7 +7,7 @@ import static cz.crcs.ectester.common.test.Result.Value; * * @author Jan Jancar johny@neuromancer.sk */ -public abstract class Test implements Testable { +public abstract class Test implements Testable, Cloneable { protected boolean hasRun; protected boolean hasStarted; protected Result result; @@ -58,6 +58,11 @@ public abstract class Test implements Testable { public abstract String getDescription(); @Override + public Test clone() throws CloneNotSupportedException { + return (Test) super.clone(); + } + + @Override public void run() { if (hasRun) return; |
