libfort/tests/main_test.c

107 lines
2.9 KiB
C
Raw Permalink Normal View History

2018-05-06 15:21:45 +02:00
#include "tests.h"
#include <stdio.h>
#include "fort.h"
2018-11-24 21:14:26 +01:00
/* Test cases */
2018-11-25 15:25:48 +01:00
void test_bug_fixes(void);
2018-11-24 21:14:26 +01:00
void test_vector_basic(void);
void test_vector_stress(void);
void test_string_buffer(void);
void test_table_sizes(void);
void test_table_counts(void);
2018-11-24 21:14:26 +01:00
void test_table_geometry(void);
void test_table_basic(void);
void test_table_copy(void);
2018-12-01 09:25:38 +01:00
void test_table_changing_cell(void);
void test_table_erase(void);
2018-11-24 21:14:26 +01:00
#ifdef FT_HAVE_WCHAR
void test_wcs_table_boundaries(void);
#endif
void test_table_write(void);
void test_table_insert_strategy(void);
2018-11-24 21:14:26 +01:00
void test_table_border_style(void);
void test_table_builtin_border_styles(void);
void test_table_cell_properties(void);
void test_table_text_styles(void);
void test_table_tbl_properties(void);
void test_memory_errors(void);
2020-02-08 10:15:35 +01:00
void test_error_codes(void);
2019-08-14 21:01:57 +02:00
#ifdef FT_HAVE_UTF8
void test_utf8_table(void);
#endif
2018-11-24 21:14:26 +01:00
2018-05-06 15:28:18 +02:00
#ifdef FORT_WB_TESTING_ENABLED
2018-12-29 16:32:40 +01:00
struct test_case wb_test_suite [] = {
2018-05-06 15:28:18 +02:00
{"test_vector_basic", test_vector_basic},
{"test_vector_stress", test_vector_stress},
{"test_string_buffer", test_string_buffer},
{"test_table_sizes", test_table_sizes},
{"test_table_counts", test_table_counts},
2018-05-06 15:28:18 +02:00
{"test_table_geometry", test_table_geometry},
{"test_table_copy", test_table_copy},
2018-05-06 15:28:18 +02:00
};
#endif
2018-12-29 16:32:40 +01:00
struct test_case bb_test_suite [] = {
2018-11-25 15:25:48 +01:00
{"test_bug_fixes", test_bug_fixes},
2018-05-06 15:28:18 +02:00
{"test_table_basic", test_table_basic},
#ifdef FT_HAVE_WCHAR
{"test_wcs_table_boundaries", test_wcs_table_boundaries},
2019-08-14 21:01:57 +02:00
#endif
#ifdef FT_HAVE_UTF8
{"test_utf8_table", test_utf8_table},
2018-05-06 15:28:18 +02:00
#endif
{"test_table_write", test_table_write},
{"test_table_insert_strategy", test_table_insert_strategy},
2018-12-01 09:25:38 +01:00
{"test_table_changing_cell", test_table_changing_cell},
{"test_table_erase", test_table_erase},
2018-05-06 15:28:18 +02:00
{"test_table_border_style", test_table_border_style},
2018-05-06 17:25:53 +02:00
{"test_table_builtin_border_styles", test_table_builtin_border_styles},
2018-11-03 21:50:30 +01:00
{"test_table_cell_properties", test_table_cell_properties},
{"test_table_tbl_properties", test_table_tbl_properties},
2018-11-10 07:58:21 +01:00
{"test_table_text_styles", test_table_text_styles},
2018-05-06 15:28:18 +02:00
{"test_memory_errors", test_memory_errors},
2020-02-08 10:15:35 +01:00
{"test_error_codes", test_error_codes},
2018-05-06 15:28:18 +02:00
};
#ifdef FORT_WB_TESTING_ENABLED
2018-12-29 16:32:40 +01:00
int run_wb_test_suite(void)
2018-05-06 15:28:18 +02:00
{
2018-12-29 16:32:40 +01:00
int wb_n_tests = sizeof(wb_test_suite) / sizeof(wb_test_suite[0]);
run_test_suite("WHITE BOX TEST SUITE", wb_n_tests, wb_test_suite);
2018-05-06 15:28:18 +02:00
return 0;
}
#endif
2018-12-29 16:32:40 +01:00
int run_bb_test_suite(void)
2018-05-06 15:28:18 +02:00
{
2018-12-29 16:32:40 +01:00
int bb_n_tests = sizeof(bb_test_suite) / sizeof(bb_test_suite[0]);
run_test_suite("BLACK BOX TEST SUITE", bb_n_tests, bb_test_suite);
2018-05-06 15:28:18 +02:00
return 0;
}
2018-05-06 15:21:45 +02:00
int main(void)
{
int status = 0;
2018-05-09 12:29:29 +02:00
/*
* Essential for OSX, because swprintf can fail in case of real unicode
* chars.
*/
2018-11-14 20:50:36 +01:00
#if defined(FT_HAVE_WCHAR)
2018-05-09 12:29:29 +02:00
setlocale(LC_CTYPE, "");
2018-11-14 20:50:36 +01:00
#endif
2018-05-09 12:29:29 +02:00
2018-11-14 20:50:36 +01:00
#ifdef FORT_WB_TESTING_ENABLED
2018-12-29 16:32:40 +01:00
status |= run_wb_test_suite();
2018-11-14 20:50:36 +01:00
fprintf(stderr, "\n");
#endif
2018-12-29 16:32:40 +01:00
status |= run_bb_test_suite();
2018-11-10 07:58:21 +01:00
2018-05-06 15:21:45 +02:00
return status;
}