summaryrefslogtreecommitdiff
path: root/unittest/test_multiple_devices.cc
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/test_multiple_devices.cc')
-rw-r--r--unittest/test_multiple_devices.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/unittest/test_multiple_devices.cc b/unittest/test_multiple_devices.cc
index bc1b60b..4b1e2c1 100644
--- a/unittest/test_multiple_devices.cc
+++ b/unittest/test_multiple_devices.cc
@@ -29,6 +29,7 @@ const char * RFC_SECRET = "12345678901234567890";
#include <iostream>
#include <NitrokeyManager.h>
#include <stick20_commands.h>
+#include "../NK_C_API.h"
using namespace nitrokey;
@@ -108,6 +109,24 @@ TEST_CASE("Regenerate AES keys", "[BASIC]") {
}
+TEST_CASE("Use C API", "[BASIC]") {
+ auto ptr = NK_list_devices();
+ auto first_ptr = ptr;
+ REQUIRE(ptr != nullptr);
+
+ while (ptr) {
+ std::cout << "Connect with: " << ptr->model << " " << ptr->path << " "
+ << ptr->serial_number << " | " << NK_connect_with_path(ptr->path) << " | ";
+ auto status = NK_status();
+ std::cout << status << std::endl;
+ free(status);
+ ptr = ptr->next;
+ }
+
+ NK_free_device_info(first_ptr);
+}
+
+
TEST_CASE("Use API", "[BASIC]") {
auto nm = NitrokeyManager::instance();
nm->set_loglevel(2);