aboutsummaryrefslogtreecommitdiffstats
path: root/asn1c/tests
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2007-12-03 13:41:36 +0000
committerLev Walkin <vlm@lionet.info>2007-12-03 13:41:36 +0000
commit8bb57a29c1458da3d88bfc2e82eb37c65395d70c (patch)
treec453a143c22610048408536ba901a65c1e6a9712 /asn1c/tests
parentf3c089ee4874659d47215365d1724c4c4af139d6 (diff)
unsigned integer of 32-bit widtth support for per
Diffstat (limited to 'asn1c/tests')
-rw-r--r--asn1c/tests/check-127.-fnative-types.-gen-PER.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/asn1c/tests/check-127.-fnative-types.-gen-PER.c b/asn1c/tests/check-127.-fnative-types.-gen-PER.c
index 9cca644b..34b6d748 100644
--- a/asn1c/tests/check-127.-fnative-types.-gen-PER.c
+++ b/asn1c/tests/check-127.-fnative-types.-gen-PER.c
@@ -9,30 +9,36 @@
#include <T.h>
-void
-verify(T_t *ti) {
+static void
+verify(int testNo, T_t *ti) {
asn_enc_rval_t er;
asn_dec_rval_t rv;
- unsigned char buf[8];
+ unsigned char buf[16];
T_t *to = 0;
- fprintf(stderr, "IN: { %ld, %ld }\n",
- ti->small32range, ti->full32range);
+ fprintf(stderr, "%d IN: { %ld, %ld, %lu, %lu }\n", testNo,
+ ti->small32range, ti->full32range,
+ ti->unsigned32, ti->unsplit32);
er = uper_encode_to_buffer(&asn_DEF_T, ti, buf, sizeof buf);
- assert(er.encoded == 64);
+ assert(er.encoded == 8 * sizeof(buf));
rv = uper_decode(0, &asn_DEF_T, (void *)&to, buf, sizeof buf, 0, 0);
assert(rv.code == RC_OK);
- fprintf(stderr, "ENC: %2x%2x%2x%2x %2x%2x%2x%2x\n",
+ fprintf(stderr, "%d ENC: %2x%2x%2x%2x %2x%2x%2x%2x\n", testNo,
buf[0], buf[1], buf[2], buf[3],
buf[4], buf[5], buf[6], buf[7]);
- fprintf(stderr, "OUT: { %ld, %ld } vs { %ld, %ld }\n",
+ fprintf(stderr, "%d OUT: { %ld, %ld, %lu, %lu } vs { %ld, %ld, %lu, %lu }\n",
+ testNo,
ti->small32range, ti->full32range,
- to->small32range, to->full32range);
+ ti->unsigned32, ti->unsplit32,
+ to->small32range, to->full32range,
+ to->unsigned32, to->unsplit32);
assert(ti->small32range == to->small32range);
assert(ti->full32range == to->full32range);
+ assert(ti->unsigned32 == to->unsigned32);
+ assert(ti->unsplit32 == to->unsplit32);
xer_fprint(stderr, &asn_DEF_T, ti);
xer_fprint(stderr, &asn_DEF_T, to);
@@ -43,27 +49,39 @@ int main() {
ti.small32range = 0;
ti.full32range = 0;
- verify(&ti);
+ ti.unsigned32 = 0;
+ ti.unsplit32 = 5;
+ verify(1, &ti);
ti.small32range = -1;
ti.full32range = -1;
- verify(&ti);
+ ti.unsigned32 = 1;
+ ti.unsplit32 = 300;
+ verify(2, &ti);
ti.small32range = -2000000000;
ti.full32range = (-2147483647L - 1);
- verify(&ti);
+ ti.unsigned32 = 4000000000;
+ ti.unsplit32 = 500;
+ verify(3, &ti);
ti.small32range = -1999999999;
ti.full32range = (-2147483647L);
- verify(&ti);
+ ti.unsigned32 = 4294967295UL;
+ ti.unsplit32 = 600;
+ verify(4, &ti);
ti.small32range = 2000000000;
ti.full32range = 2147483647;
- verify(&ti);
+ ti.unsigned32 = 4294967295UL - 100;
+ ti.unsplit32 = 4294967290UL;
+ verify(5, &ti);
ti.small32range = 1999999999;
ti.full32range = 2147483647 - 1;
- verify(&ti);
+ ti.unsigned32 = 4294967295UL - 1;
+ ti.unsplit32 = 4294967290UL - 1;
+ verify(6, &ti);
return 0;
}