summaryrefslogtreecommitdiff
path: root/unittest/test2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/test2.cc')
-rw-r--r--unittest/test2.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/unittest/test2.cc b/unittest/test2.cc
index 00e70e3..31dbce8 100644
--- a/unittest/test2.cc
+++ b/unittest/test2.cc
@@ -1,4 +1,3 @@
-#define CATCH_CONFIG_MAIN // This tells Catch to provide a main()
static const char *const default_admin_pin = "12345678";
static const char *const default_user_pin = "123456";
@@ -20,9 +19,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 +47,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 +123,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 +147,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 +170,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 +207,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 +228,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);