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;
}
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;
}
int main(void)
{
- int rv;
-
char const* comma_locales[] =
{
"da_DK.UTF-8",
/* 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;
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;
}
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;
}
/***
int main(void)
{
- int ret;
testFunc const tests[] =
{
test_single_filename_torrent,
};
session = libttest_session_init(NULL);
- ret = runTests(tests, NUM_TESTS(tests));
+
+ int ret = runTests(tests, NUM_TESTS(tests));
+
libttest_session_close(session);
return ret;