Skip to content

Commit

Permalink
Update unittests for nsdynmemlib API change (ARMmbed#71)
Browse files Browse the repository at this point in the history
Update unittests to cope with new nsdynmemlib API.
  • Loading branch information
Arto Kinnunen committed Jul 6, 2017
1 parent bc69b8b commit d65b6b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 10 additions & 2 deletions test/coap-service/unittest/stub/nsdynmemLIB_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@

nsdynmemlib_stub_data_t nsdynmemlib_stub;

#if NSDYNMEMLIB_API_VERSION < 2
typedef int16_t ns_mem_block_size_t;
typedef int16_t ns_mem_heap_size_t;
void ns_dyn_mem_init(uint8_t *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
{
}
#else
void ns_dyn_mem_init(void *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
{
}
#endif

void *ns_dyn_mem_alloc(int16_t alloc_size)
void *ns_dyn_mem_alloc(ns_mem_block_size_t alloc_size)
{
if (nsdynmemlib_stub.returnCounter > 0)
{
Expand All @@ -27,7 +35,7 @@ void *ns_dyn_mem_alloc(int16_t alloc_size)
}
}

void *ns_dyn_mem_temporary_alloc(int16_t alloc_size)
void *ns_dyn_mem_temporary_alloc(ns_mem_block_size_t alloc_size)
{
if (nsdynmemlib_stub.returnCounter > 0)
{
Expand Down
5 changes: 0 additions & 5 deletions test/coap-service/unittest/stub/nsdynmemLIB_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ typedef struct {

extern nsdynmemlib_stub_data_t nsdynmemlib_stub;


void *ns_dyn_mem_alloc(int16_t alloc_size);
void *ns_dyn_mem_temporary_alloc(int16_t alloc_size);
void ns_dyn_mem_free(void *block);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit d65b6b0

Please sign in to comment.