[A] Added c++ tests
This commit is contained in:
@@ -2,20 +2,6 @@
|
||||
#include <stdio.h>
|
||||
#include "fort.h"
|
||||
|
||||
void run_test_suit(const char *test_suit_name, int n_tests, struct test_case test_suit[])
|
||||
{
|
||||
fprintf(stderr, " == RUNNING %s ==\n", test_suit_name);
|
||||
fprintf(stderr, "[==========] Running %d test(s).\n", n_tests);
|
||||
int i;
|
||||
for (i = 0; i < n_tests; ++i) {
|
||||
fprintf(stderr, "[ RUN ] %s\n", test_suit[i].name);
|
||||
test_suit[i].test();
|
||||
fprintf(stderr, "[ OK ] %s\n", test_suit[i].name);
|
||||
}
|
||||
fprintf(stderr, "[==========] %d test(s) run.\n", n_tests);
|
||||
fprintf(stderr, "[ PASSED ] %d test(s).\n", n_tests);
|
||||
}
|
||||
|
||||
#ifdef FORT_WB_TESTING_ENABLED
|
||||
struct test_case wb_test_suit [] = {
|
||||
{"test_vector_basic", test_vector_basic},
|
||||
|
27
tests/main_test_cpp.cpp
Normal file
27
tests/main_test_cpp.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "tests.h"
|
||||
#include <stdio.h>
|
||||
#include "fort.h"
|
||||
|
||||
void test_cpp_table_basic(void);
|
||||
|
||||
|
||||
struct test_case bb_test_suit [] = {
|
||||
{"test_cpp_table_basic", test_cpp_table_basic},
|
||||
};
|
||||
|
||||
|
||||
int run_bb_test_suit(void)
|
||||
{
|
||||
int bb_n_tests = sizeof(bb_test_suit) / sizeof(bb_test_suit[0]);
|
||||
run_test_suit("BLACK BOX TEST SUITE", bb_n_tests, bb_test_suit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
status |= run_bb_test_suit();
|
||||
|
||||
return status;
|
||||
}
|
@@ -132,10 +132,19 @@ struct ft_table *create_test_int_wtable(int set_test_opts)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void run_test_suit(const char *test_suit_name, int n_tests, struct test_case test_suit[])
|
||||
{
|
||||
fprintf(stderr, " == RUNNING %s ==\n", test_suit_name);
|
||||
fprintf(stderr, "[==========] Running %d test(s).\n", n_tests);
|
||||
int i;
|
||||
for (i = 0; i < n_tests; ++i) {
|
||||
fprintf(stderr, "[ RUN ] %s\n", test_suit[i].name);
|
||||
test_suit[i].test();
|
||||
fprintf(stderr, "[ OK ] %s\n", test_suit[i].name);
|
||||
}
|
||||
fprintf(stderr, "[==========] %d test(s) run.\n", n_tests);
|
||||
fprintf(stderr, "[ PASSED ] %d test(s).\n", n_tests);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -67,11 +67,19 @@ struct test_case {
|
||||
}
|
||||
|
||||
struct ft_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int set_test_options_for_table(struct ft_table *table);
|
||||
int set_test_options_as_default(void);
|
||||
struct ft_table *create_test_int_table(int set_test_opts);
|
||||
struct ft_table *create_test_int_wtable(int set_test_opts);
|
||||
void run_test_suit(const char *test_suit_name, int n_tests, struct test_case test_suit[]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TESTS_H
|
||||
|
Reference in New Issue
Block a user