Factorize common test function

This commit is contained in:
Patrick Pelissier committed 2024-04-13 08:19:05 +02:00
1 parent 9d33c85e13
commit d466e76702
3 files changed
+18 -35

No files matched your search

+1 -18
View File
@@ -81,25 +81,8 @@ static void test1(unsigned n)
fclose(f);
}
static void do_test1(void)
{
// Run once to get the number of exceptions point existing in the test service
test_obj_except__trigger_exception = 0;
test1(10);
test_obj_except__final_check();
int count = -test_obj_except__trigger_exception;
assert(count > 0);
// Run once again the test service, and for each registered exception point, throw an exception
for(int i = 1; i <= count; i++) {
test_obj_except__trigger_exception = i;
test1(10);
// Check there is no memory leak
test_obj_except__final_check();
}
}
int main(void)
{
do_test1();
do_test1(test1);
exit(0);
}