0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 21:04:25 +08:00
pugixml/tests/test_xpath_parse.cpp
arseny.kapoulkine 40c0a5f09a tests: Added basic XPath tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@170 99668b35-9821-0410-8761-19e4c4f06640
2009-10-21 19:09:12 +00:00

34 lines
656 B
C++

#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");
}