2018-01-01 09:26:34 +01:00
|
|
|
#ifndef TESTS_H
|
|
|
|
#define TESTS_H
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <setjmp.h>
|
2018-03-19 21:07:18 +01:00
|
|
|
#include "fort_impl.h"
|
|
|
|
#include <assert.h>
|
2018-03-23 19:16:06 +01:00
|
|
|
#include "wchar.h"
|
|
|
|
#include "locale.h"
|
2018-01-01 09:26:34 +01:00
|
|
|
|
|
|
|
#define WHEN(...)
|
|
|
|
#define THEN(...)
|
2018-03-20 18:57:50 +01:00
|
|
|
#define SCENARIO(...)
|
2018-01-01 09:26:34 +01:00
|
|
|
|
2018-03-19 21:07:18 +01:00
|
|
|
/* Test cases */
|
|
|
|
void test_vector_basic(void);
|
2018-04-22 20:42:22 +02:00
|
|
|
void test_vector_stress(void);
|
2018-03-19 21:07:18 +01:00
|
|
|
void test_string_buffer(void);
|
|
|
|
void test_table_sizes(void);
|
|
|
|
void test_table_geometry(void);
|
|
|
|
void test_table_basic(void);
|
2018-04-16 20:01:45 +02:00
|
|
|
#ifdef FT_HAVE_WCHAR
|
2018-03-23 19:16:06 +01:00
|
|
|
void test_wcs_table_boundaries(void);
|
2018-04-16 20:01:45 +02:00
|
|
|
#endif
|
2018-03-20 18:57:50 +01:00
|
|
|
void test_table_write(void);
|
2018-03-19 21:07:18 +01:00
|
|
|
void test_table_border_style(void);
|
2018-03-25 10:11:08 +02:00
|
|
|
void test_table_cell_options(void);
|
|
|
|
void test_table_tbl_options(void);
|
2018-04-04 21:13:37 +02:00
|
|
|
void test_memory_errors(void);
|
2018-01-01 09:26:34 +01:00
|
|
|
|
2018-03-17 19:53:38 +01:00
|
|
|
struct test_case
|
|
|
|
{
|
|
|
|
char name [128];
|
2018-03-19 21:07:18 +01:00
|
|
|
void (*test)(void);
|
2018-03-17 19:53:38 +01:00
|
|
|
};
|
|
|
|
|
2018-03-19 21:07:18 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Test utility funcitons
|
|
|
|
*/
|
|
|
|
|
2018-03-17 19:53:38 +01:00
|
|
|
#define assert_true(args) assert(args)
|
2018-01-01 09:26:34 +01:00
|
|
|
|
2018-03-23 19:16:06 +01:00
|
|
|
#define assert_str_equal(str1, str2) \
|
|
|
|
if (strcmp(str1, str2) != 0) \
|
|
|
|
{ \
|
|
|
|
fprintf(stderr, "%s:%d(%s):Abort! Not equals strings:\n",__FILE__,__LINE__, __FUNCTION__); \
|
|
|
|
fprintf(stderr, "Left string:\n%s\n", str1); \
|
|
|
|
fprintf(stderr, "Right string:\n%s\n", str2); \
|
|
|
|
exit(EXIT_FAILURE); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define assert_wcs_equal(str1, str2) \
|
|
|
|
if (wcscmp(str1, str2) != 0) \
|
|
|
|
{ \
|
2018-03-31 12:33:37 +02:00
|
|
|
fprintf(stderr, "%s:%d(%s):Abort! Not equals strings:\n",__FILE__,__LINE__, __FUNCTION__); \
|
2018-03-23 19:16:06 +01:00
|
|
|
setlocale(LC_CTYPE, ""); \
|
|
|
|
fwprintf(stdout, L"Left string:\n%ls\n", str1); \
|
|
|
|
fwprintf(stdout, L"Right string:\n%ls\n", str2); \
|
2018-03-31 12:33:37 +02:00
|
|
|
fflush(stdout); \
|
2018-03-23 19:16:06 +01:00
|
|
|
exit(EXIT_FAILURE); \
|
2018-03-24 15:01:29 +01:00
|
|
|
}
|
|
|
|
|
2018-05-05 21:34:45 +02:00
|
|
|
int set_test_options_for_table(ft_table_t *table);
|
2018-04-16 20:01:45 +02:00
|
|
|
int set_test_options_as_default(void);
|
2018-05-05 21:34:45 +02:00
|
|
|
ft_table_t *create_test_int_table(int set_test_opts);
|
|
|
|
ft_table_t *create_test_int_wtable(int set_test_opts);
|
2018-03-25 10:32:10 +02:00
|
|
|
|
2018-03-24 15:01:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-23 19:16:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-01 09:26:34 +01:00
|
|
|
#endif // TESTS_H
|