[A] Added basic operators

This commit is contained in:
seleznevae
2018-11-02 20:06:04 +03:00
parent c0536323d0
commit 927f33f1b8
2 changed files with 76 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ bool set_test_options_for_table(fort::Table *table)
void test_cpp_table_basic(void)
{
WHEN("All columns are equal and not empty") {
WHEN("All columns are equal and not empty.") {
fort::Table table;
assert_true(set_test_options_for_table(&table));
@@ -61,6 +61,37 @@ void test_cpp_table_basic(void)
assert_string_equal(table_str, table_str_etalon);
}
WHEN("Checking basic constructors and assignmets.") {
fort::Table table;
assert_true(set_test_options_for_table(&table));
table << fort::header
<< "3" << "c" << "234" << "3.140000" << fort::endr
<< "3" << "c" << "234" << "3.140000" << fort::endr
<< "3" << "c" << "234" << "3.140000" << fort::endr;
fort::Table table2(std::move(table));
fort::Table table3;
table3 = std::move(table2);
std::string table_str = table3.to_string();
std::string table_str_etalon =
"+---+---+-----+----------+\n"
"| | | | |\n"
"| 3 | c | 234 | 3.140000 |\n"
"| | | | |\n"
"+---+---+-----+----------+\n"
"| | | | |\n"
"| 3 | c | 234 | 3.140000 |\n"
"| | | | |\n"
"+---+---+-----+----------+\n"
"| | | | |\n"
"| 3 | c | 234 | 3.140000 |\n"
"| | | | |\n"
"+---+---+-----+----------+\n";
assert_string_equal(table_str, table_str_etalon);
}
WHEN("All columns are not equal and not empty") {
fort::Table table;
assert_true(set_test_options_for_table(&table));