fix: more tests + xml_text.set support
This commit is contained in:
parent
3d3a3b9ab5
commit
adc65a7f21
@ -6562,6 +6562,13 @@ namespace pugi
|
||||
return dn ? impl::set_value_convert(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, default_float_precision) : false;
|
||||
}
|
||||
|
||||
PUGI__FN bool xml_text::set(float rhs, int precision)
|
||||
{
|
||||
xml_node_struct* dn = _data_new();
|
||||
|
||||
return dn ? impl::set_value_convert(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, precision) : false;
|
||||
}
|
||||
|
||||
PUGI__FN bool xml_text::set(double rhs)
|
||||
{
|
||||
xml_node_struct* dn = _data_new();
|
||||
@ -6569,6 +6576,13 @@ namespace pugi
|
||||
return dn ? impl::set_value_convert(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, default_double_precision) : false;
|
||||
}
|
||||
|
||||
PUGI__FN bool xml_text::set(double rhs, int precision)
|
||||
{
|
||||
xml_node_struct* dn = _data_new();
|
||||
|
||||
return dn ? impl::set_value_convert(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, precision) : false;
|
||||
}
|
||||
|
||||
PUGI__FN bool xml_text::set(bool rhs)
|
||||
{
|
||||
xml_node_struct* dn = _data_new();
|
||||
|
||||
@ -772,7 +772,9 @@ namespace pugi
|
||||
bool set(long rhs);
|
||||
bool set(unsigned long rhs);
|
||||
bool set(double rhs);
|
||||
bool set(double rhs, int precision);
|
||||
bool set(float rhs);
|
||||
bool set(float rhs, int precision);
|
||||
bool set(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
|
||||
@ -1773,10 +1773,17 @@ TEST(dom_fp_double_custom_precision)
|
||||
|
||||
attr.set_value(1.0f, 5);
|
||||
CHECK(fp_equal(attr.as_double(), static_cast<double>(1.0f)));
|
||||
|
||||
attr.set_value(3.1415926f, 3);
|
||||
CHECK(!fp_equal(attr.as_double(), static_cast<double>(3.1415926f)));
|
||||
|
||||
node.text().set(std::numeric_limits<double>::max());
|
||||
node.text().set(1.0f, 5);
|
||||
CHECK(fp_equal(node.text().as_double(), static_cast<double>(1.0f)));
|
||||
|
||||
node.text().set(3.1415926f, 3);
|
||||
CHECK(!fp_equal(node.text().as_double(), static_cast<double>(3.1415926f)));
|
||||
|
||||
node.text().set(std::numeric_limits<double>::max(), 20);
|
||||
CHECK(fp_equal(node.text().as_double(), std::numeric_limits<double>::max()));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user