summaryrefslogtreecommitdiff
path: root/tests/test_xpath_parse.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-21 19:09:12 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-21 19:09:12 +0000
commit40c0a5f09a68b18409793bf1dffcba19a8704ec7 (patch)
treef43b431bb3f55fa8cf5d0ba8eef0f7c90ad85793 /tests/test_xpath_parse.cpp
parentcbdce99d5c68fbfc7e878d108f1d16f8a08cfcb7 (diff)
tests: Added basic XPath tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@170 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_parse.cpp')
-rw-r--r--tests/test_xpath_parse.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_xpath_parse.cpp b/tests/test_xpath_parse.cpp
new file mode 100644
index 0000000..b7604f5
--- /dev/null
+++ b/tests/test_xpath_parse.cpp
@@ -0,0 +1,33 @@
+#include "common.hpp"
+
+TEST(xpath_literal_parse)
+{
+ xml_node c;
+ CHECK_XPATH_STRING(c, "'a\"b'", "a\"b");
+ CHECK_XPATH_STRING(c, "\"a'b\"", "a'b");
+ CHECK_XPATH_STRING(c, "\"\"", "");
+ CHECK_XPATH_STRING(c, "\'\'", "");
+}
+
+TEST(xpath_literal_error)
+{
+ CHECK_XPATH_FAIL("\"");
+ CHECK_XPATH_FAIL("\'");
+}
+
+TEST(xpath_number_parse)
+{
+ xml_node c;
+ CHECK_XPATH_NUMBER(c, "0", 0);
+ CHECK_XPATH_NUMBER(c, "123", 123);
+ CHECK_XPATH_NUMBER(c, "123.456", 123.456);
+ CHECK_XPATH_NUMBER(c, ".123", 0.123);
+}
+
+TEST(xpath_number_error)
+{
+ xml_node c;
+ CHECK_XPATH_FAIL("123a");
+ CHECK_XPATH_FAIL("123.a");
+ CHECK_XPATH_FAIL(".123a");
+}