Continue running other test-cases even if one fails (libtest)
This commit is contained in:
parent
c071f824ec
commit
341b778099
|
@ -223,26 +223,22 @@ static int test_bitfield_has_all_none(void)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
testFunc const tests[] =
|
||||
{
|
||||
test_bitfields,
|
||||
test_bitfield_has_all_none
|
||||
};
|
||||
|
||||
if ((ret = runTests(tests, NUM_TESTS(tests))) != 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
int ret = runTests(tests, NUM_TESTS(tests));
|
||||
|
||||
/* bitfield count range */
|
||||
for (int l = 0; l < 10000; ++l)
|
||||
{
|
||||
if ((ret = test_bitfield_count_range()) != 0)
|
||||
if (test_bitfield_count_range() != 0)
|
||||
{
|
||||
return ret;
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1568,17 +1568,13 @@ int main(void)
|
|||
test_dir_create,
|
||||
test_dir_read
|
||||
};
|
||||
int ret;
|
||||
|
||||
/* init the session */
|
||||
session = libttest_session_init(NULL);
|
||||
|
||||
ret = runTests(tests, NUM_TESTS(tests));
|
||||
int ret = runTests(tests, NUM_TESTS(tests));
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
libttest_session_close(session);
|
||||
}
|
||||
libttest_session_close(session);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -241,8 +241,6 @@ static int test_unescape(void)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
char const* comma_locales[] =
|
||||
{
|
||||
"da_DK.UTF-8",
|
||||
|
@ -263,10 +261,7 @@ int main(void)
|
|||
/* run the tests in a locale with a decimal point of '.' */
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
if ((rv = runTests(tests, NUM_TESTS(tests))) != 0)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
int ret = runTests(tests, NUM_TESTS(tests));
|
||||
|
||||
/* run the tests in a locale with a decimal point of ',' */
|
||||
bool is_locale_set = false;
|
||||
|
@ -281,11 +276,10 @@ int main(void)
|
|||
fprintf(stderr, "WARNING: unable to run locale-specific json tests. add a locale like %s or %s\n", comma_locales[0],
|
||||
comma_locales[1]);
|
||||
}
|
||||
else if ((rv = runTests(tests, NUM_TESTS(tests))) != 0)
|
||||
else
|
||||
{
|
||||
return rv;
|
||||
ret += runTests(tests, NUM_TESTS(tests));
|
||||
}
|
||||
|
||||
/* success */
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -141,19 +141,19 @@ bool check_ptr_eq_impl(char const* file, int line, void const* expected, void co
|
|||
|
||||
int runTests(testFunc const* const tests, int numTests)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
(void)current_test; /* Use test even if we don't have any tests to run */
|
||||
|
||||
for (int i = 0; i < numTests; i++)
|
||||
{
|
||||
if ((ret = (*tests[i])()) != 0)
|
||||
if ((*tests[i])() != 0)
|
||||
{
|
||||
return ret;
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; /* All tests passed */
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
@ -572,7 +572,6 @@ static int test_partial_file(void)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
testFunc const tests[] =
|
||||
{
|
||||
test_single_filename_torrent,
|
||||
|
@ -581,7 +580,9 @@ int main(void)
|
|||
};
|
||||
|
||||
session = libttest_session_init(NULL);
|
||||
ret = runTests(tests, NUM_TESTS(tests));
|
||||
|
||||
int ret = runTests(tests, NUM_TESTS(tests));
|
||||
|
||||
libttest_session_close(session);
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue