2023-09-03 13:52:45 +02:00
|
|
|
#include "main.h"
|
2023-03-15 16:13:37 +01:00
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
2023-09-03 13:52:45 +02:00
|
|
|
tensor_test_run_all();
|
2023-09-15 17:07:31 +02:00
|
|
|
tensorfunc_test_run_all();
|
2023-03-15 16:13:37 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-03 13:52:45 +02:00
|
|
|
void tensor_test_run_all(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2023-09-04 16:41:07 +02:00
|
|
|
void (*test_func[NUM_TENSOR_TEST_FUNC])(void) = {
|
2023-09-03 13:52:45 +02:00
|
|
|
&tensor_test_is_empty,
|
|
|
|
|
&tensor_test_is_equal,
|
|
|
|
|
&tensor_test_check_size,
|
|
|
|
|
&tensor_test_set_size,
|
|
|
|
|
&tensor_test_set,
|
|
|
|
|
&tensor_test_get,
|
|
|
|
|
&tensor_test_init_one,
|
|
|
|
|
&tensor_test_init_zero,
|
|
|
|
|
&tensor_test_init_rand,
|
|
|
|
|
&tensor_test_cpy,
|
|
|
|
|
};
|
|
|
|
|
|
2023-09-04 16:41:07 +02:00
|
|
|
printf("\n### Running tests for tensor.c ... ###\n\n");
|
|
|
|
|
for(i = 0; i < NUM_TENSOR_TEST_FUNC; i++) {
|
2023-09-03 13:52:45 +02:00
|
|
|
test_func[i]();
|
|
|
|
|
}
|
2023-09-04 16:41:07 +02:00
|
|
|
printf("\n### %i functions tested. ###\n\n", NUM_TENSOR_TEST_FUNC);
|
2023-09-03 13:52:45 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-15 17:07:31 +02:00
|
|
|
void tensorfunc_test_run_all(void)
|
2023-09-04 16:41:07 +02:00
|
|
|
{
|
|
|
|
|
int i;
|
2023-09-15 17:07:31 +02:00
|
|
|
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,
|
|
|
|
|
&tensor_test_div_inplace,
|
|
|
|
|
&tensor_test_add,
|
|
|
|
|
&tensor_test_sub,
|
|
|
|
|
&tensor_test_mul,
|
|
|
|
|
&tensor_test_div,
|
2023-09-04 16:41:07 +02:00
|
|
|
};
|
|
|
|
|
|
2023-09-15 17:07:31 +02:00
|
|
|
printf("\n### Running tests for tensorfunc.c ... ###\n\n");
|
|
|
|
|
for(i = 0; i < NUM_TENSORFUNC_TEST_FUNC; i++) {
|
2023-09-04 16:41:07 +02:00
|
|
|
test_func[i]();
|
|
|
|
|
}
|
2023-09-15 17:07:31 +02:00
|
|
|
printf("\n### %i functions tested. ###\n\n", NUM_TENSORFUNC_TEST_FUNC);
|
2023-09-04 16:41:07 +02:00
|
|
|
}
|