mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
begin creating number_format tests
This commit is contained in:
parent
6010912582
commit
0cd96b0494
|
@ -673,6 +673,10 @@ std::string format_section(long double number, const section &format, xlnt::cale
|
||||||
|
|
||||||
result.append(std::to_string(d.day));
|
result.append(std::to_string(d.day));
|
||||||
}
|
}
|
||||||
|
else if (part == "yy")
|
||||||
|
{
|
||||||
|
result.append(std::to_string(d.year % 1000));
|
||||||
|
}
|
||||||
else if (part == "yyyy")
|
else if (part == "yyyy")
|
||||||
{
|
{
|
||||||
result.append(std::to_string(d.year));
|
result.append(std::to_string(d.year));
|
||||||
|
|
|
@ -8,4 +8,15 @@
|
||||||
|
|
||||||
class test_number_style : public CxxTest::TestSuite
|
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");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <helpers/helper.hpp>
|
#include <helpers/helper.hpp>
|
||||||
#include <helpers/path_helper.hpp>
|
#include <helpers/path_helper.hpp>
|
||||||
|
|
||||||
class test_number_style : public CxxTest::TestSuite
|
class test_stylesheet : public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void test_ctor()
|
void test_ctor()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user