mirror of https://gerrit.osmocom.org/asn1c
add 135 encode-decode test
This commit is contained in:
parent
51a1f3f68b
commit
4a06e6a8eb
|
@ -13,10 +13,22 @@
|
|||
#include <T.h>
|
||||
|
||||
int main() {
|
||||
T_t t;
|
||||
uint8_t tmpbuf[128];
|
||||
T_t empty_t;
|
||||
T_t *decoded_t = 0; /* "= 0" is important */
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
memset(&empty_t, 0, sizeof(empty_t));
|
||||
|
||||
return 0;
|
||||
asn_enc_rval_t er =
|
||||
oer_encode_to_buffer(&asn_DEF_T, 0, &empty_t, tmpbuf, sizeof(tmpbuf));
|
||||
assert(er.encoded != -1);
|
||||
|
||||
asn_dec_rval_t dr =
|
||||
oer_decode(0, &asn_DEF_T, (void **)&decoded_t, tmpbuf, er.encoded);
|
||||
|
||||
assert(dr.code == RC_OK);
|
||||
assert(dr.consumed == er.encoded);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue