From 20028b40e61e79856c15181ed0b5061ab6d4fa29 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 21 Mar 2016 08:40:15 +0100 Subject: implementing hotp test --- unittest/test_HOTP.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'unittest/test_HOTP.cc') diff --git a/unittest/test_HOTP.cc b/unittest/test_HOTP.cc index c1147d3..a61bc28 100644 --- a/unittest/test_HOTP.cc +++ b/unittest/test_HOTP.cc @@ -23,6 +23,7 @@ std::string getSlotName(Stick10 &stick, int slotNo) { void setSecret (uint8_t slot_secret[], const char* secretHex){ assert(strlen(secretHex)%2==0); + //assert(strlen(secretHex)==(sizeof slot_secret)*2); char buf[2]; for(int i=0; i(slot_secret) ) == 0 ); } @@ -58,7 +59,7 @@ TEST_CASE("Slot names are correct", "[slotNames]") { { WriteToHOTPSlot::CommandTransaction::CommandPayload hwrite; - hwrite.slot_number = 0; + hwrite.slot_number = 0xF; strcpy(reinterpret_cast(hwrite.slot_name), "rfc_test"); //strcpy(reinterpret_cast(hwrite.slot_secret), ""); const char* secretHex = "3132333435363738393031323334353637383930"; @@ -66,6 +67,12 @@ TEST_CASE("Slot names are correct", "[slotNames]") { //hwrite.slot_config; strcpy(reinterpret_cast(hwrite.slot_token_id), ""); strcpy(reinterpret_cast(hwrite.slot_counter), ""); + WriteToHOTPSlot::CommandTransaction::run(stick, hwrite); + + GetHOTP::CommandTransaction::CommandPayload gh; + gh.slot_number = 0xF; + GetHOTP::CommandTransaction::run(stick, gh); + } -- cgit v1.2.1