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 // Functions to test that the tokenization macro works correctly in C code. 16 // These are defined in tokenize_test.c and global_handlers_test.c. 17 #pragma once 18 19 #include <stddef.h> 20 #include <stdint.h> 21 22 #include "pw_preprocessor/util.h" 23 24 PW_EXTERN_C_START 25 26 #define TEST_FORMAT_STRING_SHORT_FLOAT "Hello %s! %hd %e" 27 28 void pw_tokenizer_ToBufferTest_StringShortFloat(void* buffer, 29 size_t* buffer_size); 30 31 #define TEST_FORMAT_SEQUENTIAL_ZIG_ZAG "%u%d%02x%X%hu%hhd%d%ld%lu%lld%llu%c%c%c" 32 33 void pw_tokenizer_ToBufferTest_SequentialZigZag(void* buffer, 34 size_t* buffer_size); 35 36 void pw_tokenizer_ToCallbackTest_SequentialZigZag( 37 void (*callback)(const uint8_t* buffer, size_t size)); 38 39 #define TEST_FORMAT_REQUIRES_8 "Won't fit : %s%d" 40 41 void pw_tokenizer_ToBufferTest_Requires8(void* buffer, size_t* buffer_size); 42 43 void pw_tokenizer_ToGlobalHandlerTest_SequentialZigZag(void); 44 45 void pw_tokenizer_ToGlobalHandlerWithPayloadTest_SequentialZigZag(void); 46 47 PW_EXTERN_C_END 48