diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-01-31 18:53:14 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:41 +0100 |
commit | 43bb63424fb7e78c245341c1baf326557ef896e8 (patch) | |
tree | e54c0877e144292e644bfdb54fd60283cac5a6b7 /unittest/test2.cc | |
parent | 9bc6b85e12d73a43b8d85ba109acff8778f4c08a (diff) | |
download | libnitrokey-43bb63424fb7e78c245341c1baf326557ef896e8.tar.gz libnitrokey-43bb63424fb7e78c245341c1baf326557ef896e8.tar.bz2 |
C++ tests fixed
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test2.cc')
-rw-r--r-- | unittest/test2.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/unittest/test2.cc b/unittest/test2.cc index 00e70e3..4b61a3c 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -20,9 +20,10 @@ using namespace nitrokey::proto::stick20; using namespace nitrokey::log; using namespace nitrokey::misc; +#include <memory> template<typename CMDTYPE> -void execute_password_command(Device &stick, const char *password, const char kind = 'P') { +void execute_password_command(std::shared_ptr<Device> stick, const char *password, const char kind = 'P') { auto p = get_payload<CMDTYPE>(); if (kind == 'P'){ p.set_kind_user(); @@ -47,8 +48,8 @@ void SKIP_TEST() { TEST_CASE("long operation test", "[test_long]") { SKIP_TEST(); - Stick20 stick; - bool connected = stick.connect(); + auto stick = make_shared<Stick20>(); + bool connected = stick->connect(); REQUIRE(connected == true); Log::instance().set_loglevel(Loglevel::DEBUG); try{ @@ -123,8 +124,8 @@ TEST_CASE("test device commands ids", "[fast]") { } TEST_CASE("test device internal status with various commands", "[fast]") { - Stick20 stick; - bool connected = stick.connect(); + auto stick = make_shared<Stick20>(); + bool connected = stick->connect(); REQUIRE(connected == true); Log::instance().set_loglevel(Loglevel::DEBUG); @@ -147,8 +148,8 @@ TEST_CASE("test device internal status with various commands", "[fast]") { } TEST_CASE("setup hidden volume test", "[hidden]") { - Stick20 stick; - bool connected = stick.connect(); + auto stick = make_shared<Stick20>(); + bool connected = stick->connect(); REQUIRE(connected == true); Log::instance().set_loglevel(Loglevel::DEBUG); stick10::LockDevice::CommandTransaction::run(stick); @@ -170,8 +171,8 @@ TEST_CASE("setup hidden volume test", "[hidden]") { } TEST_CASE("setup multiple hidden volumes", "[hidden]") { - Stick20 stick; - bool connected = stick.connect(); + auto stick = make_shared<Stick20>(); + bool connected = stick->connect(); REQUIRE(connected == true); Log::instance().set_loglevel(Loglevel::DEBUG); @@ -207,8 +208,8 @@ TEST_CASE("setup multiple hidden volumes", "[hidden]") { TEST_CASE("update password change", "[dangerous]") { SKIP_TEST(); - Stick20 stick; - bool connected = stick.connect(); + auto stick = make_shared<Stick20>(); + bool connected = stick->connect(); REQUIRE(connected == true); Log::instance().set_loglevel(Loglevel::DEBUG); @@ -228,8 +229,8 @@ TEST_CASE("update password change", "[dangerous]") { } TEST_CASE("general test", "[test]") { - Stick20 stick; - bool connected = stick.connect(); + auto stick = make_shared<Stick20>(); + bool connected = stick->connect(); REQUIRE(connected == true); Log::instance().set_loglevel(Loglevel::DEBUG); |