diff options
author | kartofen <mladenovnasko0@gmail.com> | 2025-03-25 01:55:32 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2025-03-25 01:55:32 +0200 |
commit | c5e2ebc18ec867caf6f7c2edf2305f1cdb65b053 (patch) | |
tree | 349b9e481004a34c52f6a92c7718ce23b0a9451c /msgpack.c | |
parent | d3598381289ac23217c472d5f48df3bea891ecf2 (diff) |
unit testing in main.c
Diffstat (limited to 'msgpack.c')
-rw-r--r-- | msgpack.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -184,8 +184,21 @@ int msgpack_read_map (msgpack_t *pack, size_t *length); int msgpack_read_array2 (const msgpack_t *pack, struct mp_array *m); int msgpack_read_map2 (const msgpack_t *pack, struct mp_map *m); +#define CHECK_WRITE_ARGS(type, pack, m) \ + do { \ + if(!(pack) || !(pack)->bin || (pack)->size == 0) \ + return ERROR((type), MSGPACK_ERROR_INVALID_PACK); \ + if((pack)->bin[0] == 0xc) \ + return ERROR2((type), MSGPACK_ERROR_WRONG_TYPE, MSGPACK_NIL); \ + if(!(m)) \ + return ERROR((type), MSGPACK_ERROR_INVALID_ARGUMENT); \ + } while(0) + +int msgpack_write_int (msgpack_t *pack, const union mp_int *m, int subtype) + ;// { + +// } -int msgpack_write_int (msgpack_t *pack, const union mp_int *m, int subtype); int msgpack_write_bool (msgpack_t *pack, const int *m); int msgpack_write_float (msgpack_t *pack, const union mp_float *m, int subtype); |