aboutsummaryrefslogtreecommitdiffstats
path: root/asn1c
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-06-28 21:25:18 +0000
committerLev Walkin <vlm@lionet.info>2004-06-28 21:25:18 +0000
commit75809e8260e6f50da6e7ac7f74804ce0e7645b08 (patch)
treefd8efb323962efd3bdcb35d0d58d46aafe791c99 /asn1c
parentced3ff3c57e6a7bf377d22d6dc202f256952be66 (diff)
46 test case
Diffstat (limited to 'asn1c')
-rw-r--r--asn1c/tests/check-46.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/asn1c/tests/check-46.c b/asn1c/tests/check-46.c
new file mode 100644
index 00000000..d2183d3c
--- /dev/null
+++ b/asn1c/tests/check-46.c
@@ -0,0 +1,46 @@
+#undef NDEBUG
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+#include <assert.h>
+
+#include <T.h>
+
+uint8_t buf1[] = {
+ 32 | ((2 << 6) + 3), /* [3], constructed */
+ 5,
+ ((2 << 6) + 5), /* [5], primitive */
+ 3, /* L */
+ 'a',
+ 'b',
+ 'c',
+};
+
+static void
+check(uint8_t *buf, int size, size_t consumed) {
+ T_t t, *tp;
+ ber_dec_rval_t rval;
+
+ tp = memset(&t, 0, sizeof(t));
+
+ fprintf(stderr, "Buf %p\n", buf);
+ rval = ber_decode(&asn1_DEF_T, (void **)&tp, buf, size);
+ fprintf(stderr, "Returned code %d, consumed %d\n",
+ (int)rval.code, (int)rval.consumed);
+
+ assert(rval.code == RC_OK);
+ assert(rval.consumed == consumed);
+}
+
+int
+main(int ac, char **av) {
+
+ (void)ac; /* Unused argument */
+ (void)av; /* Unused argument */
+
+ check(buf1, sizeof(buf1), sizeof(buf1));
+
+ return 0;
+}
+