From 9772055e79da77c6ec9ea6992cc77891efc1265a Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 28 Oct 2016 11:31:16 +0200 Subject: Test multiple hidden volumes with different passwords and locations Signed-off-by: Szczepan Zalega --- unittest/test2.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/unittest/test2.cc b/unittest/test2.cc index d79042a..21122ef 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -146,6 +146,38 @@ TEST_CASE("setup hidden volume test", "[hidden]") { execute_password_command(stick, hidden_volume_password); } +TEST_CASE("setup multiple hidden volumes", "[hidden2]") { + Stick20 stick; + bool connected = stick.connect(); + REQUIRE(connected == true); + Log::instance().set_loglevel(Loglevel::DEBUG_L2); + + auto user_pin = "123456"; + stick10::LockDevice::CommandTransaction::run(stick); + this_thread::sleep_for(2000ms); + execute_password_command(stick, user_pin); + + constexpr int volume_count = 4; + for (int i = 0; i < volume_count; ++i) { + auto p = get_payload(); + p.SlotNr_u8 = i; + p.StartBlockPercent_u8 = 20 + 10*i; + p.EndBlockPercent_u8 = p.StartBlockPercent_u8+i+1; + auto hidden_volume_password = std::string("123123123")+std::to_string(i); + strcpyT(p.HiddenVolumePassword_au8, hidden_volume_password.c_str()); + stick20::SetupHiddenVolume::CommandTransaction::run(stick, p); + this_thread::sleep_for(2000ms); + } + + + for (int i = 0; i < volume_count; ++i) { + execute_password_command(stick, user_pin); + auto hidden_volume_password = std::string("123123123")+std::to_string(i); + execute_password_command(stick, hidden_volume_password.c_str()); + this_thread::sleep_for(2000ms); + } +} + TEST_CASE("general test", "[test]") { Stick20 stick; bool connected = stick.connect(); -- cgit v1.2.3