Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_tokenizer / global_handlers_test_c.c
1 // Copyright 2020 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14
15 // This function tests the C implementation of tokenization API. These functions
16 // are called from the main C++ test file.
17
18 #include "pw_tokenizer/tokenize_to_global_handler.h"
19 #include "pw_tokenizer/tokenize_to_global_handler_with_payload.h"
20 #include "pw_tokenizer_private/tokenize_test.h"
21
22 #ifdef __cplusplus
23 #error "This is a test of C code and must be compiled as C, not C++."
24 #endif  // __cplusplus
25
26 // This test invokes the tokenization API with a variety of types. To simplify
27 // validating the encoded data, numbers that are sequential when zig-zag encoded
28 // are used as arguments.
29 void pw_tokenizer_ToGlobalHandlerTest_SequentialZigZag(void) {
30   PW_TOKENIZE_TO_GLOBAL_HANDLER(TEST_FORMAT_SEQUENTIAL_ZIG_ZAG,
31                                 0u,
32                                 -1,
33                                 1u,
34                                 (unsigned)-2,
35                                 (unsigned short)2u,
36                                 (signed char)-3,
37                                 3,
38                                 -4l,
39                                 4ul,
40                                 -5ll,
41                                 5ull,
42                                 (signed char)-6,
43                                 (char)6,
44                                 (signed char)-7);
45 }
46
47 void pw_tokenizer_ToGlobalHandlerWithPayloadTest_SequentialZigZag(void) {
48   PW_TOKENIZE_TO_GLOBAL_HANDLER_WITH_PAYLOAD((pw_tokenizer_Payload)600613,
49                                              TEST_FORMAT_SEQUENTIAL_ZIG_ZAG,
50                                              0u,
51                                              -1,
52                                              1u,
53                                              (unsigned)-2,
54                                              (unsigned short)2u,
55                                              (signed char)-3,
56                                              3,
57                                              -4l,
58                                              4ul,
59                                              -5ll,
60                                              5ull,
61                                              (signed char)-6,
62                                              (char)6,
63                                              (signed char)-7);
64 }