aboutsummaryrefslogtreecommitdiff
path: root/unittest/test_multiple_devices.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-12-04 19:21:09 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-02-28 19:23:05 +0100
commit388cf5fcb33f24bc04f79cd1fbea980214518d54 (patch)
tree1b57874287d02a1fe339f035ba84a54d3bf1f408 /unittest/test_multiple_devices.cc
parent2faa8f6782a2e6294ed8849048a281d12d60da1c (diff)
downloadlibnitrokey-388cf5fcb33f24bc04f79cd1fbea980214518d54.tar.gz
libnitrokey-388cf5fcb33f24bc04f79cd1fbea980214518d54.tar.bz2
List devices by unique SC:SD id
Add C API and tests Add mutexes Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_multiple_devices.cc')
-rw-r--r--unittest/test_multiple_devices.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/unittest/test_multiple_devices.cc b/unittest/test_multiple_devices.cc
index f5b4d6e..235a24d 100644
--- a/unittest/test_multiple_devices.cc
+++ b/unittest/test_multiple_devices.cc
@@ -78,15 +78,35 @@ TEST_CASE("Use API", "[BASIC]") {
<< " " << status_storage.ActiveSD_CardID_u32
<< std::endl;
- nm->fill_SD_card_with_random_data("12345678");
+// nm->fill_SD_card_with_random_data("12345678");
}
catch (const LongOperationInProgressException &e){
std::cout << "long operation in progress on " << a
<< " " << std::to_string(e.progress_bar_value) << std::endl;
- this_thread::sleep_for(1000ms);
+// this_thread::sleep_for(1000ms);
}
}
std::cout <<"Iteration: " << i << std::endl;
}
+}
+
+
+TEST_CASE("Use API ID", "[BASIC]") {
+ auto nm = NitrokeyManager::instance();
+ nm->set_loglevel(2);
+
+ auto v = nm->list_devices_by_cpuID();
+ REQUIRE(v.size() > 0);
+
+ for(int i=0; i<1000; i++) {
+ auto v = nm->list_devices_by_cpuID();
+ REQUIRE(v.size() > 0);
+ for (auto i : v) {
+ nm->connect_with_ID(i);
+ auto retry_count = nm->get_admin_retry_count();
+ std::cout << i << " " << to_string(retry_count) << std::endl;
+ }
+ }
+ std::cout << "finished" << std::endl;
} \ No newline at end of file