unit-tests: Depend on SHA1/SHA256 features for mgf1 test cases
authorMartin Willi <martin@revosec.ch>
Mon, 23 Mar 2015 08:53:34 +0000 (09:53 +0100)
committerMartin Willi <martin@revosec.ch>
Mon, 23 Mar 2015 08:53:34 +0000 (09:53 +0100)
src/libstrongswan/tests/suites/test_mgf1.c
src/libstrongswan/tests/tests.h

index 0fb548a..9388b95 100644 (file)
@@ -239,20 +239,30 @@ START_TEST(mgf1_test_bitspender)
 END_TEST
 
 
-Suite *mgf1_suite_create()
+Suite *mgf1_suite_create(char *name, int n)
 {
        Suite *s;
        TCase *tc;
 
-       s = suite_create("mgf1");
+       s = suite_create(name);
 
        tc = tcase_create("mgf1");
-       tcase_add_loop_test(tc, mgf1_test_mgf1, 0, countof(mgf1_tests));
+       tcase_add_loop_test(tc, mgf1_test_mgf1, n, n + 1);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("bitspender");
-       tcase_add_loop_test(tc, mgf1_test_bitspender, 0, countof(mgf1_tests));
+       tcase_add_loop_test(tc, mgf1_test_bitspender, n, n + 1);
        suite_add_tcase(s, tc);
 
        return s;
 }
+
+Suite *mgf1_sha1_suite_create()
+{
+       return mgf1_suite_create("mgf1-sha1", 0);
+}
+
+Suite *mgf1_sha256_suite_create()
+{
+       return mgf1_suite_create("mgf1-sha256", 1);
+}
index d011586..e1d8ca4 100644 (file)
@@ -44,6 +44,7 @@ TEST_SUITE(pen_suite_create)
 TEST_SUITE(asn1_suite_create)
 TEST_SUITE(asn1_parser_suite_create)
 TEST_SUITE(test_rng_suite_create)
-TEST_SUITE(mgf1_suite_create)
+TEST_SUITE_DEPEND(mgf1_sha1_suite_create, HASHER, HASH_SHA1)
+TEST_SUITE_DEPEND(mgf1_sha256_suite_create, HASHER, HASH_SHA256)
 TEST_SUITE_DEPEND(ntru_suite_create, DH, NTRU_112_BIT)
 TEST_SUITE_DEPEND(fetch_http_suite_create, FETCHER, "http://")