begin creating number_format tests

This commit is contained in:
Thomas Fussell 2016-06-18 09:32:09 +01:00
parent 6010912582
commit 0cd96b0494
3 changed files with 16 additions and 1 deletions

View File

@ -673,6 +673,10 @@ std::string format_section(long double number, const section &format, xlnt::cale
result.append(std::to_string(d.day));
}
else if (part == "yy")
{
result.append(std::to_string(d.year % 1000));
}
else if (part == "yyyy")
{
result.append(std::to_string(d.year));

View File

@ -8,4 +8,15 @@
class test_number_style : public CxxTest::TestSuite
{
public:
void test_simple_date()
{
auto date = xlnt::date(2016, 6, 18);
auto date_number = date.to_number(xlnt::calendar::windows_1900);
xlnt::number_format ns = xlnt::number_format::date_ddmmyyyy();
auto formatted = ns.format(date_number, xlnt::calendar::windows_1900);
TS_ASSERT_EQUALS(formatted, "18/06/16");
}
};

View File

@ -9,7 +9,7 @@
#include <helpers/helper.hpp>
#include <helpers/path_helper.hpp>
class test_number_style : public CxxTest::TestSuite
class test_stylesheet : public CxxTest::TestSuite
{
public:
void test_ctor()