unit-tests: Actually verify registered algorithms against test vectors

Previously, the {ns}.crypto_test.on_add option had to be enabled to
actually test the algorithms, which we can't enforce for the tests in
the test_runner as the option is already read when the crypto factory
is initialized.  Even so, we wouldn't want to do this for every unit
test, which would be the result of enabling that option.
This commit is contained in:
Tobias Brunner
2014-03-20 15:49:05 +01:00
parent 316aa4b43b
commit 636076d45d
2 changed files with 47 additions and 5 deletions
@@ -1,4 +1,7 @@
/*
* Copyright (C) 2014 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
@@ -15,13 +18,15 @@
#include "test_suite.h"
/*******************************************************************************
* Check if test vectors have been successful during transform registration
*/
#include <utils/test.h>
IMPORT_FUNCTION_FOR_TESTS(crypto, verify_registered_algorithms, u_int,
crypto_factory_t *factory);
START_TEST(test_vectors)
{
u_int failed = lib->crypto->get_test_vector_failures(lib->crypto);
u_int failed = TEST_FUNCTION(crypto, verify_registered_algorithms,
lib->crypto);
fail_if(failed > 0, "%u test vectors failed", failed);
}
END_TEST