diff options
| author | J08nY | 2018-05-28 20:06:18 +0200 |
|---|---|---|
| committer | J08nY | 2018-05-28 20:06:18 +0200 |
| commit | a4e52b21b1dad5f96df409c44e5b4d611bba01b9 (patch) | |
| tree | 36f9d21894fc702a4f544bd0145b403ba3930074 /src/cz/crcs/ectester/standalone/test/KeyAgreementTest.java | |
| parent | ff6be88e469608a67945a274ec2180aee3f3ccd2 (diff) | |
| download | ECTester-a4e52b21b1dad5f96df409c44e5b4d611bba01b9.tar.gz ECTester-a4e52b21b1dad5f96df409c44e5b4d611bba01b9.tar.zst ECTester-a4e52b21b1dad5f96df409c44e5b4d611bba01b9.zip | |
Implement tracking of stage of execution of standalone testables.
- Output this stage in all the formats.
Diffstat (limited to 'src/cz/crcs/ectester/standalone/test/KeyAgreementTest.java')
| -rw-r--r-- | src/cz/crcs/ectester/standalone/test/KeyAgreementTest.java | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/cz/crcs/ectester/standalone/test/KeyAgreementTest.java b/src/cz/crcs/ectester/standalone/test/KeyAgreementTest.java deleted file mode 100644 index 33c7385..0000000 --- a/src/cz/crcs/ectester/standalone/test/KeyAgreementTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package cz.crcs.ectester.standalone.test; - -import cz.crcs.ectester.common.test.Result; -import cz.crcs.ectester.common.test.SimpleTest; -import cz.crcs.ectester.common.test.TestCallback; - -import java.util.Arrays; - -/** - * @author Jan Jancar johny@neuromancer.sk - */ -public class KeyAgreementTest extends SimpleTest<KeyAgreementTestable> { - private KeyAgreementTest(KeyAgreementTestable ka, TestCallback<KeyAgreementTestable> callback) { - super(ka, callback); - } - - public static KeyAgreementTest match(KeyAgreementTestable ka, byte[] expectedSecret) { - return new KeyAgreementTest(ka, new TestCallback<KeyAgreementTestable>() { - @Override - public Result apply(KeyAgreementTestable ka) { - if (Arrays.equals(ka.getSecret(), expectedSecret)) { - return new Result(Result.Value.SUCCESS, "The KeyAgreement result matched the expected derived secret."); - } else { - return new Result(Result.Value.FAILURE, "The KeyAgreement result did not match the expected derived secret."); - } - } - }); - } - - public static KeyAgreementTest expect(KeyAgreementTestable ka, Result.ExpectedValue expected) { - return new KeyAgreementTest(ka, new TestCallback<KeyAgreementTestable>() { - @Override - public Result apply(KeyAgreementTestable keyAgreementTestable) { - Result.Value value = Result.Value.fromExpected(expected, keyAgreementTestable.ok(), keyAgreementTestable.error()); - return new Result(value, value.description()); - } - }); - } - - public static KeyAgreementTest function(KeyAgreementTestable ka, TestCallback<KeyAgreementTestable> callback) { - return new KeyAgreementTest(ka, callback); - } - - @Override - public String getDescription() { - return "KeyAgreement " + testable.getKa().getAlgorithm(); - } -} |
