| 4079 | } |
| 4080 | |
| 4081 | static int |
| 4082 | c14nCommonTest(const char *filename, int with_comments, int mode, |
| 4083 | const char *subdir) { |
| 4084 | char buf[500]; |
| 4085 | char prefix[500]; |
| 4086 | const char *base; |
| 4087 | int len; |
| 4088 | char *result = NULL; |
| 4089 | char *xpath = NULL; |
| 4090 | char *ns = NULL; |
| 4091 | int ret = 0; |
| 4092 | |
| 4093 | base = baseFilename(filename); |
| 4094 | len = strlen(base); |
| 4095 | len -= 4; |
| 4096 | memcpy(prefix, base, len); |
| 4097 | prefix[len] = 0; |
| 4098 | |
| 4099 | if (snprintf(buf, 499, "result/c14n/%s/%s", subdir, prefix) >= 499) |
| 4100 | buf[499] = 0; |
| 4101 | result = strdup(buf); |
| 4102 | if (snprintf(buf, 499, "test/c14n/%s/%s.xpath", subdir, prefix) >= 499) |
| 4103 | buf[499] = 0; |
| 4104 | if (checkTestFile(buf)) { |
| 4105 | xpath = strdup(buf); |
| 4106 | } |
| 4107 | if (snprintf(buf, 499, "test/c14n/%s/%s.ns", subdir, prefix) >= 499) |
| 4108 | buf[499] = 0; |
| 4109 | if (checkTestFile(buf)) { |
| 4110 | ns = strdup(buf); |
| 4111 | } |
| 4112 | |
| 4113 | nb_tests++; |
| 4114 | if (c14nRunTest(filename, with_comments, mode, |
| 4115 | xpath, ns, result) < 0) |
| 4116 | ret = 1; |
| 4117 | |
| 4118 | if (result != NULL) free(result); |
| 4119 | if (xpath != NULL) free(xpath); |
| 4120 | if (ns != NULL) free(ns); |
| 4121 | return(ret); |
| 4122 | } |
| 4123 | |
| 4124 | static int |
| 4125 | c14nWithCommentTest(const char *filename, |
no test coverage detected