From 2cef2d4e0bb490f8e5002e47368bac8e89dbeb88 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 4 Apr 2022 16:04:17 -0500 Subject: add LILY_NARGS() --- lily-test.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lily-test.h') diff --git a/lily-test.h b/lily-test.h index 1e604fe..51b440f 100644 --- a/lily-test.h +++ b/lily-test.h @@ -114,6 +114,7 @@ void _lily_assert_memory_not_equal(const char *name_a, const char *name_b, * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + typedef struct lily_queue_t { size_t buf_size; uint8_t *buf; @@ -124,10 +125,10 @@ typedef struct lily_queue_t { lily_queue_t* lily_queue_create(); void lily_queue_destroy(lily_queue_t *q); -#define lily_enqueue(q, type, value) \ - do { \ - type _var = value; \ - _lily_enqueue(q, sizeof(type), (uint8_t*)(&_var)); \ +#define lily_enqueue(q, type, value) \ + do { \ + type _var = value; \ + _lily_enqueue(q, sizeof(type), (uint8_t*)(&_var)); \ } while(0) void _lily_enqueue(lily_queue_t *q, size_t size, uint8_t *data); @@ -136,4 +137,18 @@ void _lily_enqueue(lily_queue_t *q, size_t size, uint8_t *data); _lily_dequeue(q, sizeof(type), (uint8_t*) ptr) void _lily_dequeue(lily_queue_t *q, size_t size, uint8_t *ptr); + +struct lily_mock_arg_t { + size_t size; + void *var; +}; + +#define LILY_NARGS(args) (sizeof(args)/sizeof(struct lily_mock_arg_t)) + +typedef struct lily_mock_t { + unsigned int n_calls; + lily_queue_t *arguments; + lily_queue_t *values; +} lily_mock_t; + #endif -- cgit v1.2.1