MCPcopy Create free account
hub / github.com/Kitware/VTK / xptrDocTest

Function xptrDocTest

ThirdParty/libxml2/vtklibxml2/runtest.c:2726–2765  ·  view source on GitHub ↗

* xptrDocTest: * @filename: the file to parse * @result: the file with expected result * @err: the file with error messages * * Parse a file containing XPath expressions and evaluate them against * a set of corresponding documents. * * Returns 0 in case of success, an error code otherwise */

Source from the content-addressed store, hash-verified

2724 * Returns 0 in case of success, an error code otherwise
2725 */
2726static int
2727xptrDocTest(const char *filename,
2728 const char *resul ATTRIBUTE_UNUSED,
2729 const char *err ATTRIBUTE_UNUSED,
2730 int options) {
2731
2732 char pattern[500];
2733 char result[500];
2734 glob_t globbuf;
2735 size_t i;
2736 int ret = 0, res;
2737 const char *subdir = options == -1 ? "xptr-xp1" : "xptr";
2738
2739 xpathDocument = xmlReadFile(filename, NULL,
2740 XML_PARSE_DTDATTR | XML_PARSE_NOENT);
2741 if (xpathDocument == NULL) {
2742 fprintf(stderr, "Failed to load %s\n", filename);
2743 return(-1);
2744 }
2745
2746 res = snprintf(pattern, 499, "./test/XPath/%s/%s*",
2747 subdir, baseFilename(filename));
2748 if (res >= 499)
2749 pattern[499] = 0;
2750 globbuf.gl_offs = 0;
2751 glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
2752 for (i = 0;i < globbuf.gl_pathc;i++) {
2753 res = snprintf(result, 499, "result/XPath/%s/%s",
2754 subdir, baseFilename(globbuf.gl_pathv[i]));
2755 if (res >= 499)
2756 result[499] = 0;
2757 res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 1, 0);
2758 if (res != 0)
2759 ret = res;
2760 }
2761 globfree(&globbuf);
2762
2763 xmlFreeDoc(xpathDocument);
2764 return(ret);
2765}
2766#endif /* LIBXML_XPTR_ENABLED */
2767
2768#ifdef LIBXML_VALID_ENABLED

Callers

nothing calls this directly

Calls 7

xmlReadFileFunction · 0.85
fprintfFunction · 0.85
baseFilenameFunction · 0.85
globFunction · 0.85
xpathCommonTestFunction · 0.85
globfreeFunction · 0.85
xmlFreeDocFunction · 0.85

Tested by

no test coverage detected