Skip to content

Commit d65b6b0

Browse files
author
Arto Kinnunen
authored
Update unittests for nsdynmemlib API change (ARMmbed#71)
Update unittests to cope with new nsdynmemlib API.
1 parent bc69b8b commit d65b6b0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

test/coap-service/unittest/stub/nsdynmemLIB_stub.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@
1010

1111
nsdynmemlib_stub_data_t nsdynmemlib_stub;
1212

13+
#if NSDYNMEMLIB_API_VERSION < 2
14+
typedef int16_t ns_mem_block_size_t;
15+
typedef int16_t ns_mem_heap_size_t;
1316
void ns_dyn_mem_init(uint8_t *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
1417
{
1518
}
19+
#else
20+
void ns_dyn_mem_init(void *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
21+
{
22+
}
23+
#endif
1624

17-
void *ns_dyn_mem_alloc(int16_t alloc_size)
25+
void *ns_dyn_mem_alloc(ns_mem_block_size_t alloc_size)
1826
{
1927
if (nsdynmemlib_stub.returnCounter > 0)
2028
{
@@ -27,7 +35,7 @@ void *ns_dyn_mem_alloc(int16_t alloc_size)
2735
}
2836
}
2937

30-
void *ns_dyn_mem_temporary_alloc(int16_t alloc_size)
38+
void *ns_dyn_mem_temporary_alloc(ns_mem_block_size_t alloc_size)
3139
{
3240
if (nsdynmemlib_stub.returnCounter > 0)
3341
{

test/coap-service/unittest/stub/nsdynmemLIB_stub.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ typedef struct {
3131

3232
extern nsdynmemlib_stub_data_t nsdynmemlib_stub;
3333

34-
35-
void *ns_dyn_mem_alloc(int16_t alloc_size);
36-
void *ns_dyn_mem_temporary_alloc(int16_t alloc_size);
37-
void ns_dyn_mem_free(void *block);
38-
3934
#ifdef __cplusplus
4035
}
4136
#endif

0 commit comments

Comments
 (0)