summaryrefslogtreecommitdiff
path: root/unittest/test_HOTP.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan.zalega@gmail.com>2016-03-29 14:15:49 +0200
committerSzczepan Zalega <szczepan.zalega@gmail.com>2016-03-29 14:15:49 +0200
commitf19e5bdc349f0a98234745f66ef72324f47c656b (patch)
tree1b204ee33b9983da93751fd9d8ebf0b273321e30 /unittest/test_HOTP.cc
parent955fb912ab9563a5246f9d3bfda9ccfab187949f (diff)
downloadlibnitrokey-f19e5bdc349f0a98234745f66ef72324f47c656b.tar.gz
libnitrokey-f19e5bdc349f0a98234745f66ef72324f47c656b.tar.bz2
working hotp tests on nitrokey pro (stick10)
Signed-off-by: Szczepan Zalega <szczepan.zalega@gmail.com>
Diffstat (limited to 'unittest/test_HOTP.cc')
-rw-r--r--unittest/test_HOTP.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/unittest/test_HOTP.cc b/unittest/test_HOTP.cc
index bc3650a..c4af104 100644
--- a/unittest/test_HOTP.cc
+++ b/unittest/test_HOTP.cc
@@ -81,11 +81,25 @@ TEST_CASE("Slot names are correct", "[slotNames]") {
//run hotp command
WriteToHOTPSlot::CommandTransaction::run(stick, hwrite);
- GetHOTP::CommandTransaction::CommandPayload gh;
- gh.slot_number = 0x10;
- auto resp = GetHOTP::CommandTransaction::run(stick, gh);
- REQUIRE( string(reinterpret_cast<char *>(resp.code)) == "755224");
+ uint32_t codes[] = {
+ 755224,
+ 287082,
+ 359152,
+ 969429,
+ 338314,
+ 254676,
+ 287922,
+ 162583,
+ 399871,
+ 520489
+ };
+ for( auto code: codes){
+ GetHOTP::CommandTransaction::CommandPayload gh;
+ gh.slot_number = 0x10;
+ auto resp = GetHOTP::CommandTransaction::run(stick, gh);
+ REQUIRE( resp.code == code);
+ }
}