more testing


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1210 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/examples/sample.makefile.regen b/examples/sample.makefile.regen
index 1b8f8c4..b3b0e0d 100755
--- a/examples/sample.makefile.regen
+++ b/examples/sample.makefile.regen
@@ -44,7 +44,7 @@
 	> Makefile.$$
 
 (	echo
-	echo "${ASN1PDU}.c: $0"
+	echo "${ASN1PDU}.c: $0 ${ASN1MODULES}"
 	echo "	make regen-makefile"
 	echo "	@touch ${ASN1PDU}.c"
 	echo "	make"
@@ -82,17 +82,36 @@
 	echo '	rm -f ./.tmp.[12].$$$$; \'
 	echo '	done; fi'
 	echo "	@if test -f ./sample-${ASN1PDU}-1.per ; then \\"
-	echo "	for f in ./sample-${ASN1PDU}-*.per; do \\"
+	echo "	for f in ./sample-${ASN1PDU}-[1-9].per; do \\"
 	echo '	echo "Recoding $$f into DER into XER and back..."; \'
-	echo '	./${TARGET} -iper -oder -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \'
-	echo '	./${TARGET} -iper -oder -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \'
-	echo '	./${TARGET} -iper -oder -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \'
-	echo '	./${TARGET} -iper -oder -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \'
+	echo '	./${TARGET} -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \'
+	echo '	./${TARGET} -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \'
+	echo '	./${TARGET} -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \'
+	echo '	./${TARGET} -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \'
 	echo '	./${TARGET} -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \'
 	echo '	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \'
+	echo '	./${TARGET} -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \'
+	echo '	rm -f ./.tmp.[1234].$$$$; \'
+	echo '	done; fi'
+	echo "	@if test -f ./sample-${ASN1PDU}-1-padded.per ; then \\"
+	echo "	for f in ./sample-${ASN1PDU}-[1-9]-padded.per; do \\"
+	echo '	echo "Recoding byte-padded $$f into DER into XER and back..."; \'
+	echo '	./${TARGET} -per-padded -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \'
+	echo '	./${TARGET} -per-padded -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \'
+	echo '	./${TARGET} -per-padded -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \'
+	echo '	./${TARGET} -per-padded -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \'
+	echo '	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \'
+	echo '	./${TARGET} -per-padded -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \'
+	echo '	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \'
 	echo '	./${TARGET} -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \'
 	echo '	diff $$f ./.tmp.1.$$$$ || exit 2; \'
-	echo '	rm -f ./.tmp.[12].$$$$; \'
+	echo '	rm -f ./.tmp.[1234].$$$$; \'
 	echo '	done; fi'
 	echo '	@echo ================'
 	echo '	@echo All tests passed'
diff --git a/examples/sample.source.LDAP3/Makefile b/examples/sample.source.LDAP3/Makefile
index 1c4ff23..6de7245 100644
--- a/examples/sample.source.LDAP3/Makefile
+++ b/examples/sample.source.LDAP3/Makefile
@@ -187,7 +187,7 @@
 	../../asn1c/asn1c -S ../../skeletons -fcompound-names ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
 
 
-LDAPMessage.c: ../sample.makefile.regen
+LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
 	make regen-makefile
 	@touch LDAPMessage.c
 	make
@@ -203,27 +203,58 @@
 	@if test -f ./sample-LDAPMessage-1.[db]er ; then \
 	for f in ./sample-LDAPMessage-*.[db]er; do \
 	echo "Recoding $$f into XER and back..."; \
-	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -ixer -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -iber -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-LDAPMessage-1.xer ; then \
 	for f in ./sample-LDAPMessage-*.xer; do \
 	echo "Recoding $$f into DER and back..."; \
-	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -iber -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	diff $$f ./.tmp.2.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -ixer -oder -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	diff $$f ./.tmp.2.$$$$ || exit 2; \
+	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-LDAPMessage-1.per ; then \
-	for f in ./sample-LDAPMessage-*.per; do \
+	for f in ./sample-LDAPMessage-[1-9].per; do \
 	echo "Recoding $$f into DER into XER and back..."; \
-	./${TARGET} -iper -oder $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -ider -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	./${TARGET} -ixer -oper ./.tmp.2.$$ > ./.tmp.1.$$ || exit 2; \
-	diff $$f ./.tmp.1.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
+	done; fi
+	@if test -f ./sample-LDAPMessage-1-padded.per ; then \
+	for f in ./sample-LDAPMessage-[1-9]-padded.per; do \
+	echo "Recoding byte-padded $$f into DER into XER and back..."; \
+	./${TARGET} -per-padded -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
+	diff $$f ./.tmp.1.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
 	done; fi
 	@echo ================
 	@echo All tests passed
diff --git a/examples/sample.source.MHEG5/Makefile b/examples/sample.source.MHEG5/Makefile
index db9e195..53490ef 100644
--- a/examples/sample.source.MHEG5/Makefile
+++ b/examples/sample.source.MHEG5/Makefile
@@ -477,7 +477,7 @@
 	../../asn1c/asn1c -S ../../skeletons -fcompound-names ../ISO13522-MHEG-5.asn
 
 
-InterchangedObject.c: ../sample.makefile.regen
+InterchangedObject.c: ../sample.makefile.regen ../ISO13522-MHEG-5.asn
 	make regen-makefile
 	@touch InterchangedObject.c
 	make
@@ -493,6 +493,10 @@
 	@if test -f ./sample-InterchangedObject-1.[db]er ; then \
 	for f in ./sample-InterchangedObject-*.[db]er; do \
 	echo "Recoding $$f into XER and back..."; \
+	./${TARGET} -iber -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
 	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
 	./${TARGET} -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
 	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
@@ -501,19 +505,46 @@
 	@if test -f ./sample-InterchangedObject-1.xer ; then \
 	for f in ./sample-InterchangedObject-*.xer; do \
 	echo "Recoding $$f into DER and back..."; \
+	./${TARGET} -ixer -oder -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
 	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
 	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
 	diff $$f ./.tmp.2.$$$$ || exit 2; \
 	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-InterchangedObject-1.per ; then \
-	for f in ./sample-InterchangedObject-*.per; do \
+	for f in ./sample-InterchangedObject-[1-9].per; do \
 	echo "Recoding $$f into DER into XER and back..."; \
+	./${TARGET} -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
 	./${TARGET} -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
 	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
+	done; fi
+	@if test -f ./sample-InterchangedObject-1-padded.per ; then \
+	for f in ./sample-InterchangedObject-[1-9]-padded.per; do \
+	echo "Recoding byte-padded $$f into DER into XER and back..."; \
+	./${TARGET} -per-padded -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
 	./${TARGET} -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
 	diff $$f ./.tmp.1.$$$$ || exit 2; \
-	rm -f ./.tmp.[12].$$$$; \
+	rm -f ./.tmp.[1234].$$$$; \
 	done; fi
 	@echo ================
 	@echo All tests passed
diff --git a/examples/sample.source.PKIX1/Makefile b/examples/sample.source.PKIX1/Makefile
index de54195..b0fde7f 100644
--- a/examples/sample.source.PKIX1/Makefile
+++ b/examples/sample.source.PKIX1/Makefile
@@ -369,7 +369,7 @@
 	../../asn1c/asn1c -S ../../skeletons ../rfc3280-PKIX1Explicit88.asn1 ../rfc3280-PKIX1Implicit88.asn1
 
 
-Certificate.c: ../sample.makefile.regen
+Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1
 	make regen-makefile
 	@touch Certificate.c
 	make
@@ -385,27 +385,58 @@
 	@if test -f ./sample-Certificate-1.[db]er ; then \
 	for f in ./sample-Certificate-*.[db]er; do \
 	echo "Recoding $$f into XER and back..."; \
-	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -ixer -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -iber -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-Certificate-1.xer ; then \
 	for f in ./sample-Certificate-*.xer; do \
 	echo "Recoding $$f into DER and back..."; \
-	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -iber -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	diff $$f ./.tmp.2.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -ixer -oder -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	diff $$f ./.tmp.2.$$$$ || exit 2; \
+	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-Certificate-1.per ; then \
-	for f in ./sample-Certificate-*.per; do \
+	for f in ./sample-Certificate-[1-9].per; do \
 	echo "Recoding $$f into DER into XER and back..."; \
-	./${TARGET} -iper -oder $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -ider -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	./${TARGET} -ixer -oper ./.tmp.2.$$ > ./.tmp.1.$$ || exit 2; \
-	diff $$f ./.tmp.1.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
+	done; fi
+	@if test -f ./sample-Certificate-1-padded.per ; then \
+	for f in ./sample-Certificate-[1-9]-padded.per; do \
+	echo "Recoding byte-padded $$f into DER into XER and back..."; \
+	./${TARGET} -per-padded -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
+	diff $$f ./.tmp.1.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
 	done; fi
 	@echo ================
 	@echo All tests passed
diff --git a/examples/sample.source.RRC/Makefile b/examples/sample.source.RRC/Makefile
index f694fc4..6e62389 100644
--- a/examples/sample.source.RRC/Makefile
+++ b/examples/sample.source.RRC/Makefile
@@ -4764,7 +4764,7 @@
 	../../asn1c/asn1c -S ../../skeletons -fcompound-names -pdu=auto -gen-PER ../rrc.asn1
 
 
-DL-DCCH-Message.c: ../sample.makefile.regen
+DL-DCCH-Message.c: ../sample.makefile.regen ../rrc.asn1
 	make regen-makefile
 	@touch DL-DCCH-Message.c
 	make
@@ -4802,13 +4802,36 @@
 	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-DL-DCCH-Message-1.per ; then \
-	for f in ./sample-DL-DCCH-Message-*.per; do \
+	for f in ./sample-DL-DCCH-Message-[1-9].per; do \
 	echo "Recoding $$f into DER into XER and back..."; \
+	./${TARGET} -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
 	./${TARGET} -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
 	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
+	done; fi
+	@if test -f ./sample-DL-DCCH-Message-1-padded.per ; then \
+	for f in ./sample-DL-DCCH-Message-[1-9]-padded.per; do \
+	echo "Recoding byte-padded $$f into DER into XER and back..."; \
+	./${TARGET} -per-padded -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 1; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 3; \
+	./${TARGET} -per-padded -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
 	./${TARGET} -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
-	diff $$f ./.tmp.1.$$$$ || exit 2; \
-	rm -f ./.tmp.[12].$$$$; \
+	diff $$f ./.tmp.1.$$$$ || exit 4; \
+	rm -f ./.tmp.[1234].$$$$; \
 	done; fi
 	@echo ================
 	@echo All tests passed
diff --git a/examples/sample.source.RRC/sample-DL-DCCH-Message-1-padded.per b/examples/sample.source.RRC/sample-DL-DCCH-Message-1-padded.per
new file mode 100644
index 0000000..2ae327a
--- /dev/null
+++ b/examples/sample.source.RRC/sample-DL-DCCH-Message-1-padded.per
Binary files differ
diff --git a/examples/sample.source.RRC/sample-DL-DCCH-Message-1.per b/examples/sample.source.RRC/sample-DL-DCCH-Message-1.per
new file mode 100644
index 0000000..584e85b
--- /dev/null
+++ b/examples/sample.source.RRC/sample-DL-DCCH-Message-1.per
Binary files differ
diff --git a/examples/sample.source.TAP3/Makefile b/examples/sample.source.TAP3/Makefile
index 4dd100c..e382616 100644
--- a/examples/sample.source.TAP3/Makefile
+++ b/examples/sample.source.TAP3/Makefile
@@ -703,7 +703,7 @@
 	../../asn1c/asn1c -S ../../skeletons ../tap3.asn1
 
 
-DataInterChange.c: ../sample.makefile.regen
+DataInterChange.c: ../sample.makefile.regen ../tap3.asn1
 	make regen-makefile
 	@touch DataInterChange.c
 	make
@@ -719,27 +719,58 @@
 	@if test -f ./sample-DataInterChange-1.[db]er ; then \
 	for f in ./sample-DataInterChange-*.[db]er; do \
 	echo "Recoding $$f into XER and back..."; \
-	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -ixer -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -iber -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-DataInterChange-1.xer ; then \
 	for f in ./sample-DataInterChange-*.xer; do \
 	echo "Recoding $$f into DER and back..."; \
-	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -iber -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	diff $$f ./.tmp.2.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -ixer -oder -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 17 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 33 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder -b 980 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	diff $$f ./.tmp.2.$$$$ || exit 2; \
+	rm -f ./.tmp.[12].$$$$; \
 	done; fi
 	@if test -f ./sample-DataInterChange-1.per ; then \
-	for f in ./sample-DataInterChange-*.per; do \
+	for f in ./sample-DataInterChange-[1-9].per; do \
 	echo "Recoding $$f into DER into XER and back..."; \
-	./${TARGET} -iper -oder $$f > ./.tmp.1.$$ || exit 2; \
-	./${TARGET} -ider -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
-	./${TARGET} -ixer -oper ./.tmp.2.$$ > ./.tmp.1.$$ || exit 2; \
-	diff $$f ./.tmp.1.$$ || exit 2; \
-	rm -f ./.tmp.[12].$$; \
+	./${TARGET} -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
+	done; fi
+	@if test -f ./sample-DataInterChange-1-padded.per ; then \
+	for f in ./sample-DataInterChange-[1-9]-padded.per; do \
+	echo "Recoding byte-padded $$f into DER into XER and back..."; \
+	./${TARGET} -per-padded -iper -oxer -b 1 $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 17 $$f > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 33 $$f > ./.tmp.3.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oxer -b 980 $$f > ./.tmp.4.$$$$ || exit 2; \
+	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
+	diff ./.tmp.2.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	diff ./.tmp.3.$$$$ ./.tmp.4.$$$$ || exit 2; \
+	./${TARGET} -per-padded -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+	./${TARGET} -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
+	./${TARGET} -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
+	diff $$f ./.tmp.1.$$$$ || exit 2; \
+	rm -f ./.tmp.[1234].$$$$; \
 	done; fi
 	@echo ================
 	@echo All tests passed