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

Function patternTest

ThirdParty/libxml2/vtklibxml2/runtest.c:3709–3841  ·  view source on GitHub ↗

* patternTest: * @filename: the schemas file * @result: the file with expected result * @err: the file with error messages * * Parse a set of files with streaming, applying an RNG schemas * * Returns 0 in case of success, an error code otherwise */

Source from the content-addressed store, hash-verified

3707 * Returns 0 in case of success, an error code otherwise
3708 */
3709static int
3710patternTest(const char *filename,
3711 const char *resul ATTRIBUTE_UNUSED,
3712 const char *err ATTRIBUTE_UNUSED,
3713 int options) {
3714 xmlPatternPtr patternc = NULL;
3715 xmlStreamCtxtPtr patstream = NULL;
3716 FILE *o, *f;
3717 char str[1024];
3718 char xml[500];
3719 char result[500];
3720 int len, i;
3721 int ret = 0, res;
3722 char *temp;
3723 xmlTextReaderPtr reader;
3724 xmlDocPtr doc;
3725
3726 len = strlen(filename);
3727 len -= 4;
3728 memcpy(xml, filename, len);
3729 xml[len] = 0;
3730 if (snprintf(result, 499, "result/pattern/%s", baseFilename(xml)) >= 499)
3731 result[499] = 0;
3732 memcpy(xml + len, ".xml", 5);
3733
3734 if (!checkTestFile(xml) && !update_results) {
3735 fprintf(stderr, "Missing xml file %s\n", xml);
3736 return(-1);
3737 }
3738 f = fopen(filename, "rb");
3739 if (f == NULL) {
3740 fprintf(stderr, "Failed to open %s\n", filename);
3741 return(-1);
3742 }
3743 temp = resultFilename(filename, temp_directory, ".res");
3744 if (temp == NULL) {
3745 fprintf(stderr, "Out of memory\n");
3746 fatalError();
3747 }
3748 o = fopen(temp, "wb");
3749 if (o == NULL) {
3750 fprintf(stderr, "failed to open output file %s\n", temp);
3751 fclose(f);
3752 free(temp);
3753 return(-1);
3754 }
3755 while (1) {
3756 /*
3757 * read one line in string buffer.
3758 */
3759 if (fgets (&str[0], sizeof (str) - 1, f) == NULL)
3760 break;
3761
3762 /*
3763 * remove the ending spaces
3764 */
3765 i = strlen(str);
3766 while ((i > 0) &&

Callers

nothing calls this directly

Calls 15

baseFilenameFunction · 0.85
fprintfFunction · 0.85
resultFilenameFunction · 0.85
xmlReadFileFunction · 0.85
xmlDocGetRootElementFunction · 0.85
xmlPatterncompileFunction · 0.85
xmlFreeDocFunction · 0.85
xmlPatternGetStreamCtxtFunction · 0.85
xmlStreamPushFunction · 0.85
xmlFreeStreamCtxtFunction · 0.85
xmlReaderWalkerFunction · 0.85
xmlTextReaderReadFunction · 0.85

Tested by

no test coverage detected