aboutsummaryrefslogtreecommitdiff
path: root/unittest/test_offline.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-06-20 10:17:30 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2018-06-20 10:17:30 +0200
commitee6c9c61b93fae7e041abb19e42134d3a831a846 (patch)
treee411acfde373704febf61e4a2662b7ae77f8e2fd /unittest/test_offline.cc
parente1ef8d79809190c5ac5d540bd4aa376dcfda7e93 (diff)
parenta71507ba0ca4643201c4ceb3d4dfc0f6dd5ae770 (diff)
downloadlibnitrokey-ee6c9c61b93fae7e041abb19e42134d3a831a846.tar.gz
libnitrokey-ee6c9c61b93fae7e041abb19e42134d3a831a846.tar.bz2
Merge branch 'pr_115'
Fix connect() return value in offline mode Fixes #115
Diffstat (limited to 'unittest/test_offline.cc')
-rw-r--r--unittest/test_offline.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/unittest/test_offline.cc b/unittest/test_offline.cc
index aad875f..9d2f195 100644
--- a/unittest/test_offline.cc
+++ b/unittest/test_offline.cc
@@ -171,3 +171,28 @@ TEST_CASE("Test version getter", "[fast]") {
REQUIRE(s.length() >= 8);
REQUIRE(s.find("g") != std::string::npos);
}
+
+TEST_CASE("Connect should not return true after the second attempt", "[fast]") {
+ int result = 0;
+
+ result = NK_login("S");
+ REQUIRE(result == 0);
+
+ result = NK_login_auto();
+ REQUIRE(result == 0);
+
+ result = NK_logout();
+ REQUIRE(result == 0);
+
+ result = NK_logout();
+ REQUIRE(result == 0);
+
+ result = NK_login("P");
+ REQUIRE(result == 0);
+
+ result = NK_login_auto();
+ REQUIRE(result == 0);
+
+ result = NK_logout();
+ REQUIRE(result == 0);
+}