Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
test_m2mstringbufferbase.cpp
00001 /* 00002 * Copyright (c) 2016 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #include "CppUTest/TestHarness.h" 00017 #include "test_m2mstringbufferbase.h" 00018 //#include "m2mstringbuffer.h" 00019 00020 00021 00022 Test_M2Mstringbufferbase::Test_M2Mstringbufferbase() 00023 { 00024 } 00025 00026 Test_M2Mstringbufferbase::~Test_M2Mstringbufferbase() 00027 { 00028 } 00029 00030 void Test_M2Mstringbufferbase::test_ensure_space() 00031 { 00032 CHECK(ensure_space(1, 1)); 00033 CHECK(!ensure_space(1, 2)); 00034 } 00035 00036 void Test_M2Mstringbufferbase::test_append() 00037 { 00038 char data[2]; 00039 00040 _curr_size = 0; 00041 CHECK(append(data, 2, 'a')); 00042 CHECK(!append(data, 2, 'a')); 00043 00044 _curr_size = 0; 00045 CHECK(append(data, 2, "a")); 00046 CHECK(!append(data, 2, "a")); 00047 00048 _curr_size = 0; 00049 CHECK(!append(data, 2, "aa")); 00050 00051 _curr_size = 0; 00052 CHECK(append(data, 2, "aa", 1)); 00053 00054 _curr_size = 0; 00055 CHECK(!append(data, 2, "aa", 2)); 00056 00057 00058 } 00059 00060 void Test_M2Mstringbufferbase::test_append_int() 00061 { 00062 char data[2]; 00063 _curr_size = 0; 00064 CHECK(append_int(data, 2, 1)); 00065 CHECK(!append_int(data, 2, 2)); 00066 _curr_size = 0; 00067 CHECK(!append_int(data, 2, 666)); 00068 } 00069 00070 void Test_M2Mstringbufferbase::test_find_last_of() 00071 { 00072 char data[2]; 00073 _curr_size = 0; 00074 CHECK(append(data, 2, 'a')); 00075 CHECK(0 == find_last_of(data, 'a')); 00076 CHECK(0 > find_last_of(data, 'b')); 00077 } 00078 00079 /* 00080 bool ensure_space(size_t max_size, size_t required_size) const; 00081 00082 bool append(char *buff, size_t max_size, char data); 00083 00084 bool append(char *buff, size_t max_size, const char *data); 00085 00086 bool append(char *buff, size_t max_size, const char *data, size_t data_len); 00087 00088 bool append_int(char *buff, size_t max_size, uint16_t data); 00089 00090 int find_last_of(const char *buff, char search_char) const;*/
Generated on Tue Jul 12 2022 21:20:30 by
1.7.2