diff options
| author | J08nY | 2018-02-04 18:03:54 +0100 |
|---|---|---|
| committer | J08nY | 2018-02-04 18:03:54 +0100 |
| commit | 18bfe2cdac09ff9faed5c92971a7e63d56570ac2 (patch) | |
| tree | f356373dafd95a04c72de9e222280db2796b7ab1 /src/cz/crcs/ectester/common | |
| parent | d940ed695fc36d2782d27c50e398fc185cf6fed3 (diff) | |
| download | ECTester-18bfe2cdac09ff9faed5c92971a7e63d56570ac2.tar.gz ECTester-18bfe2cdac09ff9faed5c92971a7e63d56570ac2.tar.zst ECTester-18bfe2cdac09ff9faed5c92971a7e63d56570ac2.zip | |
Add more tests to the Wrong test suite.
- Now tests also for:
- Fp:
- p = 0
- p = 1
- p = q^2; q prime
- p = q * s; q and s primes
- F2m:
- e1 = e2 = e3 = 0
- m < e1 < e2 < e3
Diffstat (limited to 'src/cz/crcs/ectester/common')
| -rw-r--r-- | src/cz/crcs/ectester/common/test/CompoundTest.java | 2 | ||||
| -rw-r--r-- | src/cz/crcs/ectester/common/test/TestSuite.java | 12 | ||||
| -rw-r--r-- | src/cz/crcs/ectester/common/util/ByteUtil.java | 17 |
3 files changed, 30 insertions, 1 deletions
diff --git a/src/cz/crcs/ectester/common/test/CompoundTest.java b/src/cz/crcs/ectester/common/test/CompoundTest.java index 10ecf9c..69122b0 100644 --- a/src/cz/crcs/ectester/common/test/CompoundTest.java +++ b/src/cz/crcs/ectester/common/test/CompoundTest.java @@ -12,7 +12,7 @@ import java.util.function.Function; public class CompoundTest extends Test { private Function<Test[], Result> callback; private Test[] tests; - private String description; + private String description = ""; private CompoundTest(Function<Test[], Result> callback, Test... tests) { this.callback = callback; diff --git a/src/cz/crcs/ectester/common/test/TestSuite.java b/src/cz/crcs/ectester/common/test/TestSuite.java index f4f30ee..5bcee85 100644 --- a/src/cz/crcs/ectester/common/test/TestSuite.java +++ b/src/cz/crcs/ectester/common/test/TestSuite.java @@ -32,11 +32,23 @@ public abstract class TestSuite { writer.end(); } + /** + * Run the given test and return it back. + * @param t The test to run. + * @return The test that was run. + * @throws TestException + */ protected Test runTest(Test t) throws TestException { t.run(); return t; } + /** + * Run the given test, output it and return it back. + * @param t The test to run. + * @return The test that was run. + * @throws TestException + */ protected Test doTest(Test t) throws TestException { t.run(); writer.outputTest(t); diff --git a/src/cz/crcs/ectester/common/util/ByteUtil.java b/src/cz/crcs/ectester/common/util/ByteUtil.java index 90c6eaa..ad9f1bf 100644 --- a/src/cz/crcs/ectester/common/util/ByteUtil.java +++ b/src/cz/crcs/ectester/common/util/ByteUtil.java @@ -39,6 +39,23 @@ public class ByteUtil { return true; } + public static byte[] shortToBytes(short value) { + byte[] result = new byte[2]; + setShort(result, 0, value); + return result; + } + + public static byte[] shortToBytes(short[] shorts) { + if (shorts == null) { + return null; + } + byte[] result = new byte[shorts.length * 2]; + for (int i = 0; i < shorts.length; ++i) { + setShort(result, 2 * i, shorts[i]); + } + return result; + } + public static byte[] hexToBytes(String hex) { return hexToBytes(hex, true); } |
