Mistake on this page?
Report an issue in GitHub or email us
qcbor_encode_tests.h
1 /*==============================================================================
2  Copyright (c) 2016-2018, The Linux Foundation.
3  Copyright (c) 2018-2019, Laurence Lundblade.
4  All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  * Redistributions in binary form must reproduce the above
12  copyright notice, this list of conditions and the following
13  disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  * Neither the name of The Linux Foundation nor the names of its
16  contributors, nor the name "Laurence Lundblade" may be used to
17  endorse or promote products derived from this software without
18  specific prior written permission.
19 
20 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
21 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
24 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  ==============================================================================*/
32 
33 #ifndef __QCBOR__qcbor_encode_tests__
34 #define __QCBOR__qcbor_encode_tests__
35 
36 #include "qcbor.h"
37 
38 
39 /*
40  Notes:
41 
42  - All the functions in qcbor.h are called once in the aggregation of all the tests below.
43 
44  - All the types that are supported are given as input and parsed by these tests
45 
46  - There is some hostile input such as invalid lengths and CBOR too complex
47  and types this parser doesn't handle
48 
49  */
50 
51 
52 /*
53  Most basic test.
54  */
55 int BasicEncodeTest(void);
56 
57 
58 /*
59  Encode lots of integer values, particularly around the boundary and make sure they
60  Match the expected binary output. Primarily an encoding test.
61  */
62 int IntegerValuesTest1(void);
63 
64 
65 
66 /*
67  Create nested arrays to the max depth allowed and make sure it succeeds.
68  This is an encoding test.
69  */
70 int ArrayNestingTest1(void);
71 
72 
73 /*
74  Create nested arrays to one more than the meax depth and make sure it fails.
75  This is an encoding test.
76  */
77 int ArrayNestingTest2(void);
78 
79 
80 /*
81  Encoding test.
82  Create arrays to max depth and close one extra time and look for correct error code
83  */
84 int ArrayNestingTest3(void);
85 
86 
87 /*
88  This tests the QCBOREncode_AddRaw() function by adding two chunks or RAWCBOR to an
89  array and comparing with expected values. This is an encoding test.
90  */
91 int EncodeRawTest(void);
92 
93 
94 /*
95  This creates a somewhat complicated CBOR MAP and verifies it against expected
96  data. This is an encoding test.
97  */
98 int MapEncodeTest(void);
99 
100 
101 
102 /*
103  Encodes a goodly number of floats and doubles and checks encoding is right
104  */
105 int FloatValuesTest1(void);
106 
107 
108 /*
109  Encodes true, false and the like
110  */
111 int SimpleValuesTest1(void);
112 
113 
114 /*
115  Encodes most data formats that are supported */
116 int EncodeDateTest(void);
117 
118 
119 /*
120  Encodes particular data structure that a particular app will need...
121  */
122 int RTICResultsTest(void);
123 
124 
125 /*
126  Calls all public encode methods in qcbor.h once.
127  */
128 int AllAddMethodsTest(void);
129 
130 /*
131  The binary string wrapping of maps and arrays used by COSE
132  */
133 int BstrWrapTest(void);
134 
135 int BstrWrapErrorTest(void);
136 
137 int BstrWrapNestTest(void);
138 
139 int CoseSign1TBSTest(void);
140 
141 int EncodeErrorTests(void);
142 
143 
144 
145 #endif /* defined(__QCBOR__qcbor_encode_tests__) */
Q C B O R E n c o d e / D e c o d e.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.