[A] Added cpp tests

This commit is contained in:
seleznevae 2019-08-09 21:29:05 +03:00
parent d1c8f59de1
commit 4b995844fd
4 changed files with 31 additions and 8 deletions

View File

@ -3,12 +3,11 @@
#include <wchar.h>
#include "fort.h"
#ifdef FT_HAVE_WCHAR
void test_bug_fixes(void)
{
#ifdef FT_HAVE_WCHAR
SCENARIO("Bug 1") {
ft_table_t *table = ft_create_table();
ft_table_t *table_tmp_1 = ft_create_table();
// ft_set_border_style(table_tmp_1, FT_EMPTY_STYLE);
@ -23,6 +22,8 @@ void test_bug_fixes(void)
ft_destroy_table(table_tmp_1);
ft_destroy_table(table);
}
#endif
SCENARIO("Bug 2") {
ft_table_t *table = ft_create_table();
@ -127,7 +128,6 @@ void test_bug_fixes(void)
}
#endif
}
#endif
void test_table_basic(void)
{

View File

@ -2,6 +2,32 @@
#include "fort.hpp"
#include "test_utils.hpp"
void test_cpp_bug_fixes(void)
{
SCENARIO("Issue 11 - https://github.com/seleznevae/libfort/issues/11") {
fort::table table;
table << fort::header
<< "1" << "2" << fort::endr
<< "3" << "4" << fort::endr;
table.set_border_style(FT_PLAIN_STYLE);
table.set_cell_bottom_padding(0);
table.set_cell_top_padding(0);
table.set_cell_left_padding(1);
table.set_cell_right_padding(1);
table.set_cell_empty_str_height(0);
std::string table_str = table.to_string();
std::string table_str_etalon =
" ------- \n"
" 1 2 \n"
" ------- \n"
" 3 4 \n"
" \n";
assert_string_equal(table_str, table_str_etalon);
}
}
void test_cpp_table_basic(void)
{
WHEN("All columns are equal and not empty.") {

View File

@ -3,9 +3,7 @@
#include "fort.h"
/* Test cases */
#ifdef FT_HAVE_WCHAR
void test_bug_fixes(void);
#endif
void test_vector_basic(void);
void test_vector_stress(void);
void test_string_buffer(void);
@ -39,9 +37,7 @@ struct test_case wb_test_suite [] = {
struct test_case bb_test_suite [] = {
#ifdef FT_HAVE_WCHAR
{"test_bug_fixes", test_bug_fixes},
#endif
{"test_table_basic", test_table_basic},
#ifdef FT_HAVE_WCHAR
{"test_wcs_table_boundaries", test_wcs_table_boundaries},

View File

@ -8,7 +8,7 @@ void test_cpp_table_write(void);
void test_cpp_table_tbl_properties(void);
void test_cpp_table_cell_properties(void);
void test_cpp_table_text_styles(void);
void test_cpp_bug_fixes(void);
struct test_case bb_test_suite [] = {
@ -17,6 +17,7 @@ struct test_case bb_test_suite [] = {
{"test_cpp_table_tbl_properties", test_cpp_table_tbl_properties},
{"test_cpp_table_cell_properties", test_cpp_table_cell_properties},
{"test_cpp_table_text_styles", test_cpp_table_text_styles},
{"test_cpp_bug_fixes", test_cpp_bug_fixes},
};