diff options
| author | J08nY | 2024-03-28 17:37:06 +0100 |
|---|---|---|
| committer | J08nY | 2024-03-28 17:37:06 +0100 |
| commit | 59bcf047d2e141a2175aeaeb5bee3e9ce3e4d6ee (patch) | |
| tree | a462bd5303dd399c5c1504d218c9c3b9bf78e365 /standalone/src/test | |
| parent | 6cadd538804714c0e12c18a4fc483452b978aaad (diff) | |
| download | ECTester-59bcf047d2e141a2175aeaeb5bee3e9ce3e4d6ee.tar.gz ECTester-59bcf047d2e141a2175aeaeb5bee3e9ce3e4d6ee.tar.zst ECTester-59bcf047d2e141a2175aeaeb5bee3e9ce3e4d6ee.zip | |
Add test-vector suite to tests.
Diffstat (limited to 'standalone/src/test')
| -rw-r--r-- | standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java | 19 | ||||
| -rw-r--r-- | standalone/src/test/java/cz/crcs/ectester/standalone/OutputTests.java | 21 |
2 files changed, 40 insertions, 0 deletions
diff --git a/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java b/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java index 7105906..6e3dfed 100644 --- a/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java +++ b/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java @@ -72,6 +72,25 @@ public class AppTests { } } + @SuppressWarnings("JUnitMalformedDeclaration") + @ParameterizedTest + @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) + @StdIo() + public void testVectorSuite(String libName, StdOut out) { + // TODO: Fix libgcrypt and IPPCP in handling binary field curves (reject them). + assumeFalse(libName.equals("libgcrypt") || libName.equals("2021")); + + String[] args = new String[]{"test", "test-vectors", libName}; + if (libName.equals("Botan") || libName.equals("Crypto++")) { + args = new String[]{"test", "--kpg-type", "ECDH", "test-vectors", libName}; + } + ECTesterStandalone.main(args); + String sout = out.capturedString(); + if (sout.contains("Exception")) { + System.err.printf("%s: Test vector suite has exceptions.%n", libName); + } + } + @ParameterizedTest @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) public void performanceSuite(String libName) { diff --git a/standalone/src/test/java/cz/crcs/ectester/standalone/OutputTests.java b/standalone/src/test/java/cz/crcs/ectester/standalone/OutputTests.java new file mode 100644 index 0000000..7218094 --- /dev/null +++ b/standalone/src/test/java/cz/crcs/ectester/standalone/OutputTests.java @@ -0,0 +1,21 @@ +package cz.crcs.ectester.standalone; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.junitpioneer.jupiter.StdIo; +import org.junitpioneer.jupiter.StdOut; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +public class OutputTests { + + @SuppressWarnings("JUnitMalformedDeclaration") + @ParameterizedTest + @ValueSource(strings = {"text", "xml", "yml"}) + @StdIo() + public void formats(String format, StdOut out) { + ECTesterStandalone.main(new String[]{"test", "-f", format, "default", "Sun"}); + String s = out.capturedString(); + assertFalse(s.isEmpty()); + } +} |
