aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlm <vlm@59561ff5-6e30-0410-9f3c-9617f08c8826>2007-06-26 09:54:17 +0000
committervlm <vlm@59561ff5-6e30-0410-9f3c-9617f08c8826>2007-06-26 09:54:17 +0000
commit4707db76858be9d3d9f441a64f2d2b67f9e977bb (patch)
tree703eff7c30a39e4392a91634d66207a392b951ea
parent32193f184bcdafd559fd5a8c3d5f71de30e71378 (diff)
diverging
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1338 59561ff5-6e30-0410-9f3c-9617f08c8826
-rw-r--r--asn1c/tests/check-126.-gen-PER.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/asn1c/tests/check-126.-gen-PER.c b/asn1c/tests/check-126.-gen-PER.c
index 86244efd..db210b4c 100644
--- a/asn1c/tests/check-126.-gen-PER.c
+++ b/asn1c/tests/check-126.-gen-PER.c
@@ -230,45 +230,23 @@ compare_with_data_out(const char *fname, char *buf, int size) {
char fbuf[1024];
size_t rd;
FILE *f;
+ char lastChar;
+ int mustfail, compare;
sprintf(outName, "../data-126/%s", fname);
strcpy(outName + strlen(outName) - 3, ".out");
fprintf(stderr, "Comparing PER output with [%s]\n", outName);
- if(strstr(outName, "-06-P.out")) {
- f = fopen(outName, "w");
- fbuf[0] = 0x81;
- 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);
- }
+ lastChar = outName[strlen(outName)-5];
+ mustfail = lastChar == 'P';
+ compare = lastChar != 'C';
- if(strstr(outName, "-08-P.out")) {
- f = fopen(outName, "w");
- fbuf[0] = 0x81;
- fbuf[1] = 0x40;
- fbuf[2] = 0x80;
- fwrite(fbuf, 1, 3, f);
- fclose(f);
- }
-
- if(getenv("REGENERATE")) {
+ if(compare && getenv("REGENERATE")) {
f = fopen(outName, "w");
fwrite(buf, 1, size, f);
fclose(f);
} else {
- int mustfail = outName[strlen(outName)-5] == 'P';
f = fopen(outName, "r");
assert(f);
rd = fread(fbuf, 1, sizeof(fbuf), f);
@@ -279,9 +257,14 @@ compare_with_data_out(const char *fname, char *buf, int size) {
load_object_from(outName, fbuf, rd, AS_PER, mustfail);
if(mustfail) return;
- assert(rd == (size_t)size);
- assert(memcmp(fbuf, buf, rd) == 0);
- fprintf(stderr, "XER->PER recoding .in->.out match.\n");
+ if(compare) {
+ assert(rd == (size_t)size);
+ 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");
+ }
}
}