diverging

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1338 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/asn1c/tests/check-126.-gen-PER.c b/asn1c/tests/check-126.-gen-PER.c
index 86244ef..db210b4 100644
--- a/asn1c/tests/check-126.-gen-PER.c
+++ b/asn1c/tests/check-126.-gen-PER.c
@@ -230,45 +230,23 @@
 	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);
-	}
+	lastChar = outName[strlen(outName)-5];
+	mustfail = lastChar == 'P';
+	compare = lastChar != 'C';
 
-	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")) {
-		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 @@
 		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");
+		}
 	}
 }