aboutsummaryrefslogtreecommitdiff
path: root/unittest/test.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-01-31 18:53:14 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:41 +0100
commit43bb63424fb7e78c245341c1baf326557ef896e8 (patch)
treee54c0877e144292e644bfdb54fd60283cac5a6b7 /unittest/test.cc
parent9bc6b85e12d73a43b8d85ba109acff8778f4c08a (diff)
downloadlibnitrokey-43bb63424fb7e78c245341c1baf326557ef896e8.tar.gz
libnitrokey-43bb63424fb7e78c245341c1baf326557ef896e8.tar.bz2
C++ tests fixed
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test.cc')
-rw-r--r--unittest/test.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/unittest/test.cc b/unittest/test.cc
index 6744b45..99f96ac 100644
--- a/unittest/test.cc
+++ b/unittest/test.cc
@@ -13,8 +13,9 @@ using namespace nitrokey::proto::stick10;
using namespace nitrokey::log;
using namespace nitrokey::misc;
+using Dev10 = std::shared_ptr<Stick10>;
-std::string getSlotName(Stick10 &stick, int slotNo) {
+std::string getSlotName(Dev10 stick, int slotNo) {
auto slot_req = get_payload<ReadSlot>();
slot_req.slot_number = slotNo;
auto slot = ReadSlot::CommandTransaction::run(stick, slot_req);
@@ -23,8 +24,8 @@ std::string getSlotName(Stick10 &stick, int slotNo) {
}
TEST_CASE("Slot names are correct", "[slotNames]") {
- Stick10 stick;
- bool connected = stick.connect();
+ auto stick = make_shared<Stick10>();
+ bool connected = stick->connect();
REQUIRE(connected == true);
Log::instance().set_loglevel(Loglevel::DEBUG);
@@ -79,5 +80,5 @@ TEST_CASE("Slot names are correct", "[slotNames]") {
REQUIRE(sName == std::string("login1"));
}
- stick.disconnect();
+ stick->disconnect();
}