1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef COMMON_TEST_H__
8 #define COMMON_TEST_H__
9 
10 #define CONCAT_BYTE(a,b) a ## b
11 
12 #ifdef TEST_INDEFINITE_LENGTH_ARRAYS
13 #define LIST(num) 0x9F /* Use short count 31 (indefinite-length). Note that the 'num' argument is ignored */
14 #define LIST2(num) 0x9F /* Use short count 31 (indefinite-length). Note that the 'num' argument is ignored */
15 #define LIST3(num) 0x9F /* Use short count 31 (indefinite-length). Note that the 'num' argument is ignored */
16 #define MAP(num) 0xBF  /* Use short count 31 (indefinite-length). Note that the 'num' argument is ignored */
17 #define ARR_ERR1 ZCBOR_ERR_WRONG_TYPE
18 #define ARR_ERR2 ZCBOR_ERR_NO_PAYLOAD
19 #define ARR_ERR3 ZCBOR_ERR_WRONG_TYPE
20 #define ARR_ERR4 ZCBOR_ERR_PAYLOAD_NOT_CONSUMED
21 #define END 0xFF,
22 #define STR_LEN(len, lists) (len + lists)
23 #else
24 #define LIST(num) CONCAT_BYTE(0x8, num)
25 #define LIST2(num) CONCAT_BYTE(0x9, num)
26 #define LIST3(num) 0x98, num
27 #define MAP(num) CONCAT_BYTE(0xA, num)
28 #define ARR_ERR1 ZCBOR_ERR_HIGH_ELEM_COUNT
29 #define ARR_ERR2 ZCBOR_ERR_HIGH_ELEM_COUNT
30 #define ARR_ERR3 ZCBOR_ERR_NO_PAYLOAD
31 #define ARR_ERR4 ZCBOR_ERR_NO_PAYLOAD
32 #define END
33 #define STR_LEN(len, lists) (len)
34 #endif
35 
36 #endif /* COMMON_TEST_H__ */
37