aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/test/CommandTest.java
diff options
context:
space:
mode:
authorJ08nY2018-08-11 21:52:48 +0200
committerJ08nY2018-08-11 22:03:39 +0200
commitb6d6766fef9b73db70bda8b6b398128ba5a41ab2 (patch)
treea470e36aa69cb9e778070b175e9223432244f210 /src/cz/crcs/ectester/reader/test/CommandTest.java
parent1284516b6630250a3fc4a2bf8d23e15fede5a77b (diff)
downloadECTester-b6d6766fef9b73db70bda8b6b398128ba5a41ab2.tar.gz
ECTester-b6d6766fef9b73db70bda8b6b398128ba5a41ab2.tar.zst
ECTester-b6d6766fef9b73db70bda8b6b398128ba5a41ab2.zip
Add various ECDSA tests.
Diffstat (limited to '')
-rw-r--r--src/cz/crcs/ectester/reader/test/CommandTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/reader/test/CommandTest.java b/src/cz/crcs/ectester/reader/test/CommandTest.java
index d57dc17..cdd1cbf 100644
--- a/src/cz/crcs/ectester/reader/test/CommandTest.java
+++ b/src/cz/crcs/ectester/reader/test/CommandTest.java
@@ -6,6 +6,8 @@ import cz.crcs.ectester.common.test.TestCallback;
import cz.crcs.ectester.reader.command.Command;
import cz.crcs.ectester.reader.response.Response;
+import java.util.Arrays;
+
/**
* A simple test that runs one Command to get and evaluate one Response
* to get a Result and compare it with the expected one.
@@ -47,6 +49,23 @@ public class CommandTest extends SimpleTest<CommandTestable> {
return expect(command, expectedValue, null, null);
}
+ public static CommandTest expectSW(CommandTestable command, short... expectedSWS) {
+ return new CommandTest(command, new TestCallback<CommandTestable>() {
+ @Override
+ public Result apply(CommandTestable commandTestable) {
+ if (Arrays.equals(commandTestable.getResponse().getSWs(), expectedSWS)) {
+ return new Result(Result.Value.SUCCESS);
+ } else {
+ return new Result(Result.Value.FAILURE);
+ }
+ }
+ });
+ }
+
+ public static CommandTest expectSW(Command command, short... expectedSWS) {
+ return expectSW(new CommandTestable(command), expectedSWS);
+ }
+
public Command getCommand() {
return testable.getCommand();
}