blob: 21ae6906b1d0980cee7703c7d0aac95dd91f8261 [file] [log] [blame]
Lev Walkin75809e82004-06-28 21:25:18 +00001#undef NDEBUG
2#include <stdio.h>
3#include <stdlib.h>
4#include <sys/types.h>
5#include <string.h>
6#include <assert.h>
7
8#include <T.h>
9
10uint8_t buf1[] = {
11 32 | ((2 << 6) + 3), /* [3], constructed */
12 5,
13 ((2 << 6) + 5), /* [5], primitive */
14 3, /* L */
15 'a',
16 'b',
17 'c',
18};
19
20static void
Lev Walkin1715b322013-03-28 04:02:13 -070021check(uint8_t *buf, size_t size, size_t consumed) {
Lev Walkin75809e82004-06-28 21:25:18 +000022 T_t t, *tp;
Lev Walkin90bf7ae2004-10-20 15:46:56 +000023 asn_dec_rval_t rval;
Lev Walkin75809e82004-06-28 21:25:18 +000024
25 tp = memset(&t, 0, sizeof(t));
26
27 fprintf(stderr, "Buf %p\n", buf);
Lev Walkinc7400c52004-09-29 13:14:36 +000028 rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size);
Lev Walkin1715b322013-03-28 04:02:13 -070029 fprintf(stderr, "Returned code %d, consumed %zd\n",
30 (int)rval.code, rval.consumed);
Lev Walkin75809e82004-06-28 21:25:18 +000031
32 assert(rval.code == RC_OK);
33 assert(rval.consumed == consumed);
Vasil Velichkovcef21e02017-10-09 23:40:17 +030034 ASN_STRUCT_RESET(asn_DEF_T, tp);
Lev Walkin75809e82004-06-28 21:25:18 +000035}
36
37int
38main(int ac, char **av) {
39
40 (void)ac; /* Unused argument */
41 (void)av; /* Unused argument */
42
43 check(buf1, sizeof(buf1), sizeof(buf1));
44
45 return 0;
46}
47