summaryrefslogtreecommitdiff
path: root/tests/test_xpath_functions.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-31 12:00:38 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-31 12:00:38 +0000
commitd8b256203c01eaa8ce7b54e296ff33bd1afaf583 (patch)
treee08ed3a93cf4c32538810521925d168b64fcf47e /tests/test_xpath_functions.cpp
parenta2433c90a284d94310ec9955bd37c3009b25104c (diff)
tests: Added more XPath tests based on recommendation errata
git-svn-id: http://pugixml.googlecode.com/svn/trunk@483 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_functions.cpp')
-rw-r--r--tests/test_xpath_functions.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp
index 06b9e79..7b44294 100644
--- a/tests/test_xpath_functions.cpp
+++ b/tests/test_xpath_functions.cpp
@@ -81,6 +81,14 @@ TEST(xpath_number_floor)
// floor with 2 arguments
CHECK_XPATH_FAIL(STR("floor(1, 2)"));
+
+ // floor with argument 0 should return 0
+ CHECK_XPATH_STRING(c, STR("string(1 div floor(0))"), STR("Infinity"));
+
+ // floor with argument -0 should return -0
+#if !(defined(__APPLE__) && defined(__MACH__)) // MacOS X gcc 4.0.1 implements floor incorrectly (floor never returns -0)
+ CHECK_XPATH_STRING(c, STR("string(1 div floor(-0))"), STR("-Infinity"));
+#endif
}
TEST(xpath_number_ceiling)
@@ -102,9 +110,10 @@ TEST(xpath_number_ceiling)
// ceiling with 2 arguments
CHECK_XPATH_FAIL(STR("ceiling(1, 2)"));
- // ceiling with argument in range (-1, -0] should result in minus zero
+ // ceiling with argument 0 should return 0
CHECK_XPATH_STRING(c, STR("string(1 div ceiling(0))"), STR("Infinity"));
+ // ceiling with argument in range (-1, -0] should result in minus zero
#if !(defined(__APPLE__) && defined(__MACH__)) // MacOS X gcc 4.0.1 implements ceil incorrectly (ceil never returns -0)
CHECK_XPATH_STRING(c, STR("string(1 div ceiling(-0))"), STR("-Infinity"));
CHECK_XPATH_STRING(c, STR("string(1 div ceiling(-0.1))"), STR("-Infinity"));