diff options
| author | J08nY | 2017-12-28 00:51:41 +0100 |
|---|---|---|
| committer | J08nY | 2017-12-28 00:51:41 +0100 |
| commit | 67c963266711f863a024bd6d7ff6e6da5d7b08b8 (patch) | |
| tree | da50470d3735db2f4faeb0fb70c4ee1849d9ef80 /src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java | |
| parent | 3344df8d86821c936c011c547da5495cc177ab85 (diff) | |
| download | ECTester-67c963266711f863a024bd6d7ff6e6da5d7b08b8.tar.gz ECTester-67c963266711f863a024bd6d7ff6e6da5d7b08b8.tar.zst ECTester-67c963266711f863a024bd6d7ff6e6da5d7b08b8.zip | |
Hide the Cleanup command in test suites.
Diffstat (limited to 'src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java')
| -rw-r--r-- | src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java b/src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java index 00e3a46..3c0795b 100644 --- a/src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java +++ b/src/cz/crcs/ectester/reader/test/CardInvalidCurvesSuite.java @@ -2,6 +2,7 @@ package cz.crcs.ectester.reader.test; import cz.crcs.ectester.applet.ECTesterApplet; import cz.crcs.ectester.applet.EC_Consts; +import cz.crcs.ectester.common.test.BaseRunnable; import cz.crcs.ectester.common.test.CompoundTest; import cz.crcs.ectester.common.test.Test; import cz.crcs.ectester.data.EC_Store; @@ -26,7 +27,7 @@ import static cz.crcs.ectester.common.test.Result.ExpectedValue; public class CardInvalidCurvesSuite extends CardTestSuite { public CardInvalidCurvesSuite(EC_Store dataStore, ECTesterReader.Config cfg) { - super(dataStore, cfg, "invalid", "The invalid curve suite tests whether the card rejects points outside of the curve during ECDH."); + super(dataStore, cfg, "invalid", "The invalid curve suite run whether the card rejects points outside of the curve during ECDH."); } @Override @@ -55,16 +56,16 @@ public class CardInvalidCurvesSuite extends CardTestSuite { EC_Curve curve = e.getKey(); List<EC_Key.Public> keys = e.getValue(); - tests.add(CommandTest.expect(new Command.Allocate(cardManager, ECTesterApplet.KEYPAIR_BOTH, curve.getBits(), curve.getField()), ExpectedValue.SUCCESS)); - tests.add(CommandTest.expect(new Command.Set(cardManager, ECTesterApplet.KEYPAIR_BOTH, EC_Consts.CURVE_external, curve.getParams(), curve.flatten()), ExpectedValue.SUCCESS)); - tests.add(CommandTest.expect(new Command.Generate(cardManager, ECTesterApplet.KEYPAIR_LOCAL), ExpectedValue.SUCCESS)); + run.add(CommandTest.expect(new Command.Allocate(cardManager, ECTesterApplet.KEYPAIR_BOTH, curve.getBits(), curve.getField()), ExpectedValue.SUCCESS)); + run.add(CommandTest.expect(new Command.Set(cardManager, ECTesterApplet.KEYPAIR_BOTH, EC_Consts.CURVE_external, curve.getParams(), curve.flatten()), ExpectedValue.SUCCESS)); + run.add(CommandTest.expect(new Command.Generate(cardManager, ECTesterApplet.KEYPAIR_LOCAL), ExpectedValue.SUCCESS)); List<Test> ecdhTests = new LinkedList<>(); for (EC_Key.Public pub : keys) { Command ecdhCommand = new Command.ECDH_direct(cardManager, ECTesterApplet.KEYPAIR_LOCAL, ECTesterApplet.EXPORT_FALSE, EC_Consts.CORRUPTION_NONE, ECTesterApplet.KeyAgreement_ALG_EC_SVDP_DH, pub.flatten()); ecdhTests.add(CommandTest.expect(ecdhCommand, ExpectedValue.FAILURE, "Card correctly rejected point on invalid curve." , "Card incorrectly accepted point on invalid curve.")); } - tests.add(CompoundTest.all(ExpectedValue.SUCCESS, "Invalid curve test of " + curve.getId(), ecdhTests.toArray(new Test[0]))); - tests.add(CommandTest.expect(new Command.Cleanup(cardManager), ExpectedValue.ANY)); + run.add(CompoundTest.all(ExpectedValue.SUCCESS, "Invalid curve test of " + curve.getId(), ecdhTests.toArray(new Test[0]))); + run.add(new BaseRunnable(() -> new Command.Cleanup(cardManager))); } } } |
