Commit b4326de2 authored by Lev Walkin's avatar Lev Walkin

diverging

parent 06230f79
...@@ -230,45 +230,23 @@ compare_with_data_out(const char *fname, char *buf, int size) { ...@@ -230,45 +230,23 @@ compare_with_data_out(const char *fname, char *buf, int size) {
char fbuf[1024]; char fbuf[1024];
size_t rd; size_t rd;
FILE *f; FILE *f;
char lastChar;
int mustfail, compare;
sprintf(outName, "../data-126/%s", fname); sprintf(outName, "../data-126/%s", fname);
strcpy(outName + strlen(outName) - 3, ".out"); strcpy(outName + strlen(outName) - 3, ".out");
fprintf(stderr, "Comparing PER output with [%s]\n", outName); fprintf(stderr, "Comparing PER output with [%s]\n", outName);
if(strstr(outName, "-06-P.out")) { lastChar = outName[strlen(outName)-5];
f = fopen(outName, "w"); mustfail = lastChar == 'P';
fbuf[0] = 0x81; compare = lastChar != 'C';
fbuf[1] = 0x40;
fbuf[2] = 0x00;
fwrite(fbuf, 1, 3, f);
fclose(f);
}
if(strstr(outName, "-07-P.out")) {
f = fopen(outName, "w");
fbuf[0] = 0x81;
fbuf[1] = 0x40;
fbuf[2] = 0x40;
fwrite(fbuf, 1, 3, f);
fclose(f);
}
if(strstr(outName, "-08-P.out")) { if(compare && getenv("REGENERATE")) {
f = fopen(outName, "w");
fbuf[0] = 0x81;
fbuf[1] = 0x40;
fbuf[2] = 0x80;
fwrite(fbuf, 1, 3, f);
fclose(f);
}
if(getenv("REGENERATE")) {
f = fopen(outName, "w"); f = fopen(outName, "w");
fwrite(buf, 1, size, f); fwrite(buf, 1, size, f);
fclose(f); fclose(f);
} else { } else {
int mustfail = outName[strlen(outName)-5] == 'P';
f = fopen(outName, "r"); f = fopen(outName, "r");
assert(f); assert(f);
rd = fread(fbuf, 1, sizeof(fbuf), f); rd = fread(fbuf, 1, sizeof(fbuf), f);
...@@ -279,9 +257,14 @@ compare_with_data_out(const char *fname, char *buf, int size) { ...@@ -279,9 +257,14 @@ compare_with_data_out(const char *fname, char *buf, int size) {
load_object_from(outName, fbuf, rd, AS_PER, mustfail); load_object_from(outName, fbuf, rd, AS_PER, mustfail);
if(mustfail) return; if(mustfail) return;
assert(rd == (size_t)size); if(compare) {
assert(memcmp(fbuf, buf, rd) == 0); assert(rd == (size_t)size);
fprintf(stderr, "XER->PER recoding .in->.out match.\n"); assert(memcmp(fbuf, buf, rd) == 0);
fprintf(stderr, "XER->PER recoding .in->.out match.\n");
} else {
assert(rd != (size_t)size || memcmp(fbuf, buf, rd));
fprintf(stderr, "XER->PER recoding .in->.out diverge.\n");
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment