aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_ffi.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-12-19 19:38:47 -0500
committerJack Lloyd <[email protected]>2015-12-19 19:38:47 -0500
commit156486feb393a2bb4ec8c2a1f1c0b86ecae472ef (patch)
tree55c24e5c3ddc47c827cb6a137a39982d7542f316 /src/tests/test_ffi.cpp
parent18239a4f552049a5a74818d60c9d09881ab8ae35 (diff)
Prevent FFI tests from failing if bcrypt is disabled. GH #369
Diffstat (limited to 'src/tests/test_ffi.cpp')
-rw-r--r--src/tests/test_ffi.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp
index c848729a6..dd0293949 100644
--- a/src/tests/test_ffi.cpp
+++ b/src/tests/test_ffi.cpp
@@ -193,11 +193,17 @@ class FFI_Unit_Tests : public Test
size_t out_len = 64;
outstr.resize(out_len);
- TEST_FFI_OK(botan_bcrypt_generate, (reinterpret_cast<uint8_t*>(&outstr[0]), &out_len, passphrase.c_str(), rng, 3, 0));
- result.test_eq("bcrypt output size", out_len, 61);
- TEST_FFI_OK(botan_bcrypt_is_valid, (passphrase.c_str(), outstr.data()));
- TEST_FFI_FAIL("bad password", botan_bcrypt_is_valid, ("nope", outstr.data()));
+ int rc = botan_bcrypt_generate(reinterpret_cast<uint8_t*>(&outstr[0]),
+ &out_len, passphrase.c_str(), rng, 3, 0);
+
+ if(rc == 0)
+ {
+ result.test_eq("bcrypt output size", out_len, 61);
+
+ TEST_FFI_OK(botan_bcrypt_is_valid, (passphrase.c_str(), outstr.data()));
+ TEST_FFI_FAIL("bad password", botan_bcrypt_is_valid, ("nope", outstr.data()));
+ }
std::vector<Test::Result> results;
results.push_back(ffi_test_rsa(rng));