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