Updated the tests and declared new tests for the new functions.

This commit is contained in:
2023-09-15 17:07:31 +02:00
parent 8c44b96913
commit 7505b22d18
8 changed files with 412 additions and 457 deletions

View File

@@ -3,7 +3,7 @@
int main(void)
{
tensor_test_run_all();
tensoriter_test_run_all();
tensorfunc_test_run_all();
return 0;
}
@@ -21,6 +21,29 @@ void tensor_test_run_all(void)
&tensor_test_init_zero,
&tensor_test_init_rand,
&tensor_test_cpy,
};
printf("\n### Running tests for tensor.c ... ###\n\n");
for(i = 0; i < NUM_TENSOR_TEST_FUNC; i++) {
test_func[i]();
}
printf("\n### %i functions tested. ###\n\n", NUM_TENSOR_TEST_FUNC);
}
void tensorfunc_test_run_all(void)
{
int i;
void (*test_func[NUM_TENSORFUNC_TEST_FUNC])(void) = {
&tensor_test_fill,
&tensor_test_inspect,
&tensor_test_map,
&tensor_test_map_inplace,
&tensor_test_combine,
&tensor_test_combine_inplace,
&tensor_test_add_scalar,
&tensor_test_sub_scalar,
&tensor_test_mul_scalar,
&tensor_test_div_scalar,
&tensor_test_add_inplace,
&tensor_test_sub_inplace,
&tensor_test_mul_inplace,
@@ -31,30 +54,9 @@ void tensor_test_run_all(void)
&tensor_test_div,
};
printf("\n### Running tests for tensor.c ... ###\n\n");
for(i = 0; i < NUM_TENSOR_TEST_FUNC; i++) {
printf("\n### Running tests for tensorfunc.c ... ###\n\n");
for(i = 0; i < NUM_TENSORFUNC_TEST_FUNC; i++) {
test_func[i]();
}
printf("\n### %i functions tested. ###\n\n", NUM_TENSOR_TEST_FUNC);
}
void tensoriter_test_run_all(void)
{
int i;
void (*test_func[NUM_TENSORITER_TEST_FUNC])(void) = {
&tensoriter_test_scalar_next,
&tensoriter_test_scalar_get,
&tensoriter_test_scalar_set,
&tensoriter_test_scalar_map,
&tensoriter_test_scalar_map_add,
&tensoriter_test_scalar_map_sub,
&tensoriter_test_scalar_map_mul,
&tensoriter_test_scalar_map_div,
};
printf("\n### Running tests for tensoriter.c ... ###\n\n");
for(i = 0; i < NUM_TENSORITER_TEST_FUNC; i++) {
test_func[i]();
}
printf("\n### %i functions tested. ###\n\n", NUM_TENSORITER_TEST_FUNC);
printf("\n### %i functions tested. ###\n\n", NUM_TENSORFUNC_TEST_FUNC);
}