From 4394a588c2d8f07b12201592054234cb321f37e5 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Mon, 14 Jun 2010 18:03:50 +0000 Subject: XPath: Rewritten number->string conversion using CRT scientific format (much better XPath REC compliance) git-svn-id: http://pugixml.googlecode.com/svn/trunk@523 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_xpath.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'tests/test_xpath.cpp') diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 3a855cc..7b52437 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -118,13 +118,27 @@ TEST(xpath_long_numbers_stringize) xml_node c; - CHECK(test_xpath_string_prefix(c, str_flt_max, str_flt_max, 16)); - CHECK(test_xpath_string_prefix(c, str_flt_max_dec, str_flt_max, 16)); + CHECK(test_xpath_string_prefix(c, str_flt_max, str_flt_max, 15)); + CHECK(test_xpath_string_prefix(c, str_flt_max_dec, str_flt_max, 15)); -#ifndef __BORLANDC__ // printf with %f format still results in 1.xxxe+308 form - CHECK(test_xpath_string_prefix(c, str_dbl_max, str_dbl_max, 16)); - CHECK(test_xpath_string_prefix(c, str_dbl_max_dec, str_dbl_max, 16)); -#endif + CHECK(test_xpath_string_prefix(c, str_dbl_max, str_dbl_max, 15)); + CHECK(test_xpath_string_prefix(c, str_dbl_max_dec, str_dbl_max, 15)); +} + +#include + +TEST(xpath_denorm_numbers) +{ + pugi::string_t query; + + // 10^-318 - double denormal + for (int i = 0; i < 106; ++i) + { + if (i != 0) query += STR(" * "); + query += STR("0.001"); + } + + CHECK_XPATH_STRING(xml_node(), query.c_str(), STR("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009999987484955998")); } TEST_XML(xpath_rexml_1, "") -- cgit v1.2.3