mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/cn-cbor: compile with context pointer support
This commit is contained in:
parent
56917c8709
commit
ad8e69da96
@ -1 +1,4 @@
|
||||
INCLUDES += -I$(PKGDIRBASE)/cn-cbor/include
|
||||
|
||||
#enable context pointer
|
||||
CFLAGS += -DUSE_CBOR_CONTEXT
|
||||
|
@ -36,6 +36,14 @@ static size_t test, offs;
|
||||
static unsigned char ebuf[EBUF_SIZE];
|
||||
static cn_cbor_errback errb;
|
||||
|
||||
/* Dummy context struct to force fallback to POSIX calloc/free */
|
||||
static cn_cbor_context ct =
|
||||
{
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void setup_cn_cbor(void)
|
||||
{
|
||||
test = 0;
|
||||
@ -107,7 +115,7 @@ static void test_parse(void)
|
||||
|
||||
errb.err = CN_CBOR_NO_ERROR;
|
||||
|
||||
cn_cbor *cbor = cn_cbor_decode(buf, len, &errb);
|
||||
cn_cbor *cbor = cn_cbor_decode(buf, len, &ct, &errb);
|
||||
TEST_ASSERT_EQUAL_INT(errb.err, CN_CBOR_NO_ERROR);
|
||||
TEST_ASSERT_NOT_NULL(cbor);
|
||||
|
||||
@ -143,7 +151,7 @@ static void test_errors(void)
|
||||
size_t len = fmt_hex_bytes(buf, tests[offs].hex);
|
||||
TEST_ASSERT(len);
|
||||
|
||||
cn_cbor *cbor = cn_cbor_decode(buf, len, &errb);
|
||||
cn_cbor *cbor = cn_cbor_decode(buf, len, &ct, &errb);
|
||||
TEST_ASSERT_NULL(cbor);
|
||||
TEST_ASSERT_EQUAL_INT(errb.err, tests[offs].err);
|
||||
cn_cbor_free(cbor);
|
||||
|
Loading…
Reference in New Issue
Block a user