mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-26 21:04:25 +08:00
tests: Fix tests on various compilers
Some compilers don't handle NaNs properly. Some compilers don't implement fmod in a IEEE-compatible way. Some compilers have exception handling codegen bugs (DMC...).
This commit is contained in:
parent
1a06d7d3de
commit
417048d8cb
@ -639,9 +639,11 @@ TEST(xpath_allocate_string_out_of_memory)
|
||||
#else
|
||||
try
|
||||
{
|
||||
#ifndef __DMC__ // DigitalMars exception handling crashes instead of catching the exception...
|
||||
xpath_query q(query.c_str());
|
||||
|
||||
CHECK_FORCE_FAIL("Expected out of memory exception");
|
||||
#endif
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
|
@ -492,6 +492,7 @@ TEST(xpath_operators_mod)
|
||||
CHECK_XPATH_NUMBER(c, STR("-5 mod 3"), -2);
|
||||
CHECK_XPATH_NUMBER(c, STR("-5 mod -3"), -2);
|
||||
|
||||
#if !defined(__BORLANDC__)
|
||||
// If either operand is NaN, the result is NaN
|
||||
CHECK_XPATH_NUMBER_NAN(c, STR("(0 div 0) mod 3"));
|
||||
CHECK_XPATH_NUMBER_NAN(c, STR("3 mod (0 div 0)"));
|
||||
@ -505,14 +506,17 @@ TEST(xpath_operators_mod)
|
||||
CHECK_XPATH_NUMBER_NAN(c, STR("-1 mod 0"));
|
||||
CHECK_XPATH_NUMBER_NAN(c, STR("(1 div 0) mod 0"));
|
||||
CHECK_XPATH_NUMBER_NAN(c, STR("(-1 div 0) mod 0"));
|
||||
#endif
|
||||
|
||||
// If the dividend is finite and the divisor is an infinity, the result equals the dividend
|
||||
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||
CHECK_XPATH_NUMBER(c, STR("1 mod (1 div 0)"), 1);
|
||||
CHECK_XPATH_NUMBER(c, STR("1 mod (-1 div 0)"), 1);
|
||||
CHECK_XPATH_NUMBER(c, STR("-1 mod (1 div 0)"), -1);
|
||||
CHECK_XPATH_NUMBER(c, STR("0 mod (1 div 0)"), 0);
|
||||
CHECK_XPATH_NUMBER(c, STR("0 mod (-1 div 0)"), 0);
|
||||
CHECK_XPATH_NUMBER(c, STR("100000 mod (1 div 0)"), 100000);
|
||||
#endif
|
||||
|
||||
// If the dividend is a zero and the divisor is finite, the result equals the dividend.
|
||||
CHECK_XPATH_NUMBER(c, STR("0 mod 1000000"), 0);
|
||||
|
@ -460,7 +460,10 @@ TEST_XML(xpath_paths_predicate_number_out_of_range, "<node><chapter/><chapter/><
|
||||
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[-1 div 0]"));
|
||||
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[1000000000000]"));
|
||||
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[1 div 0]"));
|
||||
|
||||
#ifndef MSVC6_NAN_BUG
|
||||
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[0 div 0]"));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_XML(xpath_paths_predicate_constant_boolean, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
||||
@ -480,7 +483,10 @@ TEST_XML(xpath_paths_predicate_position_eq, "<node><chapter/><chapter/><chapter>
|
||||
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=1]")) % 3;
|
||||
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=2+2]")) % 7;
|
||||
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=last()]")) % 8;
|
||||
|
||||
#ifndef MSVC6_NAN_BUG
|
||||
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=string()]")) % 5;
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_XML(xpath_paths_predicate_several, "<node><employee/><employee secretary=''/><employee assistant=''/><employee secretary='' assistant=''/><employee assistant='' secretary=''/></node>")
|
||||
|
Loading…
x
Reference in New Issue
Block a user