1 // Copyright 2022 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 #include "pw_tokenizer/encode_args.h" 16 17 #include "gtest/gtest.h" 18 19 namespace pw { 20 namespace tokenizer { 21 22 static_assert(MinEncodingBufferSizeBytes<>() == 4); 23 static_assert(MinEncodingBufferSizeBytes<bool>() == 4 + 2); 24 static_assert(MinEncodingBufferSizeBytes<char>() == 4 + 2); 25 static_assert(MinEncodingBufferSizeBytes<short>() == 4 + 3); 26 static_assert(MinEncodingBufferSizeBytes<int>() == 4 + 5); 27 static_assert(MinEncodingBufferSizeBytes<long long>() == 4 + 10); 28 static_assert(MinEncodingBufferSizeBytes<float>() == 4 + 4); 29 static_assert(MinEncodingBufferSizeBytes<double>() == 4 + 4); 30 static_assert(MinEncodingBufferSizeBytes<const char*>() == 4 + 1); 31 static_assert(MinEncodingBufferSizeBytes<void*>() == 4 + 5 || 32 MinEncodingBufferSizeBytes<void*>() == 4 + 10); 33 34 static_assert(MinEncodingBufferSizeBytes<int, double>() == 4 + 5 + 4); 35 static_assert(MinEncodingBufferSizeBytes<int, int, const char*>() == 36 4 + 5 + 5 + 1); 37 static_assert( 38 MinEncodingBufferSizeBytes<const char*, long long, int, short>() == 39 4 + 1 + 10 + 5 + 3); 40 41 } // namespace tokenizer 42 } // namespace pw 43