mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
cover worksheet_iterator.hpp
This commit is contained in:
parent
a2814d3465
commit
874ea7abeb
|
@ -210,5 +210,46 @@ public:
|
|||
TS_ASSERT_EQUALS(test_sheet.get_cell("A1").get_value<long double>(), float_value);
|
||||
}
|
||||
|
||||
void test_post_increment_iterator()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
|
||||
wb.create_sheet("Sheet1");
|
||||
wb.create_sheet("Sheet2");
|
||||
|
||||
auto iter = wb.begin();
|
||||
|
||||
TS_ASSERT_EQUALS((*(iter++)).get_title(), "Sheet");
|
||||
TS_ASSERT_EQUALS((*(iter++)).get_title(), "Sheet1");
|
||||
TS_ASSERT_EQUALS((*(iter++)).get_title(), "Sheet2");
|
||||
TS_ASSERT_EQUALS(iter, wb.end());
|
||||
}
|
||||
|
||||
void test_copy_iterator()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
|
||||
wb.create_sheet("Sheet1");
|
||||
wb.create_sheet("Sheet2");
|
||||
|
||||
auto iter = wb.begin();
|
||||
|
||||
iter++;
|
||||
TS_ASSERT_EQUALS((*iter).get_title(), "Sheet1");
|
||||
|
||||
auto copy = wb.begin();
|
||||
copy = iter;
|
||||
TS_ASSERT_EQUALS((*iter).get_title(), "Sheet1");
|
||||
TS_ASSERT_EQUALS(iter, copy);
|
||||
|
||||
iter++;
|
||||
TS_ASSERT_EQUALS((*iter).get_title(), "Sheet2");
|
||||
TS_ASSERT_DIFFERS(iter, copy);
|
||||
|
||||
copy++;
|
||||
TS_ASSERT_EQUALS((*iter).get_title(), "Sheet2");
|
||||
TS_ASSERT_EQUALS(iter, copy);
|
||||
}
|
||||
|
||||
// void test_add_invalid_worksheet_class_instance() {} not needed in c++
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user