From 02cee98492233f4ae91f025fc38f9df8b4bc0efe Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 30 Jan 2017 21:36:05 -0800 Subject: tests: Add more tests for branch coverage gcov -b surfaced many lines with partial coverage, where branch is only ever taken or not taken, or one of the expressions in a complex conditional is always either true or false. This change adds a series of tests (mostly focusing on XPath) to reduce the number of partially covered lines. --- tests/test_xpath_functions.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/test_xpath_functions.cpp') diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp index 211dbfb..480eb97 100644 --- a/tests/test_xpath_functions.cpp +++ b/tests/test_xpath_functions.cpp @@ -566,6 +566,7 @@ TEST(xpath_string_translate_table) CHECK_XPATH_STRING(c, STR("translate('abcd\xe9 ', 'abc', 'ABC')"), STR("ABCd\xe9 ")); CHECK_XPATH_STRING(c, STR("translate('abcd\xe9 ', 'abc\xe9', 'ABC!')"), STR("ABCd! ")); + CHECK_XPATH_STRING(c, STR("translate('abcd! ', 'abc!', 'ABC\xe9')"), STR("ABCd\xe9 ")); CHECK_XPATH_STRING(c, STR("translate('abcde', concat('abc', 'd'), 'ABCD')"), STR("ABCDe")); CHECK_XPATH_STRING(c, STR("translate('abcde', 'abcd', concat('ABC', 'D'))"), STR("ABCDe")); } @@ -799,4 +800,17 @@ TEST_XML(xpath_string_concat_translate, "foobar") CHECK_XPATH_STRING(doc, STR("concat('a', 'b', 'c', translate(node, 'o', 'a'), 'd')"), STR("abcfaabard")); } +TEST(xpath_unknown_functions) +{ + char_t query[] = STR("a()"); + + for (char ch = 'a'; ch <= 'z'; ++ch) + { + query[0] = ch; + CHECK_XPATH_FAIL(query); + + query[0] = ch - 32; + CHECK_XPATH_FAIL(query); + } +} #endif -- cgit v1.2.3