diff options
-rw-r--r-- | src/tests/test_pkcs11_high_level.cpp | 14 | ||||
-rw-r--r-- | src/tests/tests.cpp | 12 | ||||
-rw-r--r-- | src/tests/tests.h | 2 |
3 files changed, 23 insertions, 5 deletions
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp index 82610adc6..8e894ef28 100644 --- a/src/tests/test_pkcs11_high_level.cpp +++ b/src/tests/test_pkcs11_high_level.cpp @@ -415,6 +415,7 @@ Test::Result test_attribute_container() return result; } +#if defined(BOTAN_HAS_ASN1) Test::Result test_create_destroy_data_object() { Test::Result result("Object create/delete data object"); @@ -565,6 +566,7 @@ Test::Result test_object_copy() copied_obj.destroy(); return result; } +#endif class Object_Tests : public PKCS11_Test { @@ -573,11 +575,13 @@ class Object_Tests : public PKCS11_Test { std::vector<std::function<Test::Result()>> fns = { - test_attribute_container, - test_create_destroy_data_object, - test_get_set_attribute_values, - test_object_finder, - test_object_copy + test_attribute_container +#if defined(BOTAN_HAS_ASN1) + ,test_create_destroy_data_object + ,test_get_set_attribute_values + ,test_object_finder + ,test_object_copy +#endif }; return run_pkcs11_tests("Object", fns); diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index 578418ffb..d3467460e 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -234,6 +234,18 @@ bool Test::Result::test_gte(const std::string& what, size_t produced, size_t exp return test_success(); } +bool Test::Result::test_ne(const std::string& what, size_t produced, size_t expected) + { + if(produced != expected) + { + return test_success(); + } + + std::ostringstream err; + err << who() << " " << what << " produced " << produced << " prohibited value"; + return test_failure(err.str()); + } + #if defined(BOTAN_HAS_BIGINT) bool Test::Result::test_eq(const std::string& what, const BigInt& produced, const BigInt& expected) { diff --git a/src/tests/tests.h b/src/tests/tests.h index b33b2837f..39aaf67cd 100644 --- a/src/tests/tests.h +++ b/src/tests/tests.h @@ -225,6 +225,8 @@ class Test bool test_rc(const std::string& func, int expected, int rc); + bool test_ne(const std::string& what, size_t produced, size_t expected); + #if defined(BOTAN_HAS_BIGINT) bool test_eq(const std::string& what, const BigInt& produced, const BigInt& expected); bool test_ne(const std::string& what, const BigInt& produced, const BigInt& expected); |