Build and run tests with Clang-9 on Linux (#252)

* Try to build on Ubuntu-18.04 with Clang-9

* Build with pushes on clang-9 branch too

* Using CC and CXX to set clang-9

* Adding atomic lib for test build on Linux with Clang

* Partial conversion CHECK_EQUAL to CHECK for clang-9

* Replaced CHECK_EQUAL with CHECK

* Replaced CHECK_EQUAL with CHECK

* Replaced CHECK_EQUAL with CHECK

* Replaced CHECK_EQUAL with CHECK

* Replaced CHECK_EQUAL with CHECK

* Replaced CHECK_EQUAL with CHECK

* Replaced CHECK_EQUAL with CHECK

Co-authored-by: finger42 <finger42>
This commit is contained in:
finger42 2020-08-01 15:20:14 +02:00 committed by GitHub
parent eb2902de88
commit 8f1361649e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 1378 additions and 1361 deletions

View File

@ -1,7 +1,7 @@
name: CI name: CI
on: on:
push: push:
branches: [ master ] branches: [ master, clang-9 ]
pull_request: pull_request:
branches: [ master ] branches: [ master ]
@ -29,3 +29,14 @@ jobs:
with: with:
name: Testfile name: Testfile
path: test/etl_tests path: test/etl_tests
build-clang-9-Linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build with Clang 9
run: |
export CC=clang-9
export CXX=clang++-9
cmake -D BUILD_TESTS=ON ./
make

View File

@ -158,8 +158,14 @@ endif()
add_executable(etl_tests add_executable(etl_tests
${TEST_SOURCE_FILES} ${TEST_SOURCE_FILES}
) )
#target_link_libraries(etl_tests etl UnitTest++)
target_link_libraries(etl_tests UnitTest++) if(UNIX AND NOT APPLE)
# atomic is need on Linux with Clang
target_link_libraries(etl_tests UnitTest++ atomic)
else()
target_link_libraries(etl_tests UnitTest++)
endif()
target_include_directories(etl_tests target_include_directories(etl_tests
PUBLIC PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}

View File

@ -309,10 +309,10 @@ namespace
{ {
DataDC data; DataDC data;
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size()== size_t(0));
CHECK(data.empty()); CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE); CHECK(data.capacity()== SIZE);
CHECK_EQUAL(data.max_size(), SIZE); CHECK(data.max_size()== SIZE);
CHECK(data.begin() == data.end()); CHECK(data.begin() == data.end());
} }
@ -322,11 +322,11 @@ namespace
int current_count = NDC::get_instance_count(); int current_count = NDC::get_instance_count();
DataNDC* pdata = new DataNDC(initial_data.begin(), initial_data.end()); DataNDC* pdata = new DataNDC(initial_data.begin(), initial_data.end());
CHECK_EQUAL(int(current_count + initial_data.size()), NDC::get_instance_count()); CHECK(int(current_count + initial_data.size())== NDC::get_instance_count());
IDataNDC* pidata = pdata; IDataNDC* pidata = pdata;
delete pidata; delete pidata;
CHECK_EQUAL(current_count, NDC::get_instance_count()); CHECK(current_count== NDC::get_instance_count());
} }
//************************************************************************* //*************************************************************************
@ -336,7 +336,7 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size()== data.size());
CHECK(!data.empty()); CHECK(!data.empty());
} }
@ -348,7 +348,7 @@ namespace
DataNDC data = { ElementNDC(0, N0), ElementNDC(1, N1), ElementNDC(2, N2), ElementNDC(3, N3), ElementNDC(4, N4) }; DataNDC data = { ElementNDC(0, N0), ElementNDC(1, N1), ElementNDC(2, N2), ElementNDC(3, N3), ElementNDC(4, N4) };
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size()== data.size());
CHECK(!data.empty()); CHECK(!data.empty());
bool isEqual = std::equal(data.begin(), bool isEqual = std::equal(data.begin(),
@ -381,15 +381,15 @@ namespace
DataM data2(std::move(data1)); DataM data2(std::move(data1));
CHECK_EQUAL(4U, data1.size()); // Move does not clear the source. CHECK(4U== data1.size()); // Move does not clear the source.
CHECK_EQUAL(4U, data2.size()); CHECK(4U== data2.size());
DataM::const_iterator itr = data2.begin(); DataM::const_iterator itr = data2.begin();
CHECK_EQUAL("1", (*itr++).second.value); CHECK("1"== (*itr++).second.value);
CHECK_EQUAL("2", (*itr++).second.value); CHECK("2"== (*itr++).second.value);
CHECK_EQUAL("3", (*itr++).second.value); CHECK("3"== (*itr++).second.value);
CHECK_EQUAL("4", (*itr++).second.value); CHECK("4"== (*itr++).second.value);
} }
//************************************************************************* //*************************************************************************
@ -446,8 +446,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -456,8 +456,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -486,16 +486,16 @@ namespace
DataDC data(compare_data.begin(), compare_data.end()); DataDC data(compare_data.begin(), compare_data.end());
CHECK_EQUAL(compare_data[0], data[0]); CHECK(compare_data[0] == data[0]);
CHECK_EQUAL(compare_data[1], data[1]); CHECK(compare_data[1] == data[1]);
CHECK_EQUAL(compare_data[2], data[2]); CHECK(compare_data[2] == data[2]);
CHECK_EQUAL(compare_data[3], data[3]); CHECK(compare_data[3] == data[3]);
CHECK_EQUAL(compare_data[4], data[4]); CHECK(compare_data[4] == data[4]);
CHECK_EQUAL(compare_data[5], data[5]); CHECK(compare_data[5] == data[5]);
CHECK_EQUAL(compare_data[6], data[6]); CHECK(compare_data[6] == data[6]);
CHECK_EQUAL(compare_data[7], data[7]); CHECK(compare_data[7] == data[7]);
CHECK_EQUAL(compare_data[8], data[8]); CHECK(compare_data[8] == data[8]);
CHECK_EQUAL(compare_data[9], data[9]); CHECK(compare_data[9] == data[9]);
} }
//************************************************************************* //*************************************************************************
@ -516,16 +516,16 @@ namespace
data[initial_data_dc[7].first] = initial_data_dc[7].second; data[initial_data_dc[7].first] = initial_data_dc[7].second;
data[initial_data_dc[9].first] = initial_data_dc[9].second; data[initial_data_dc[9].first] = initial_data_dc[9].second;
CHECK_EQUAL(compare_data[0], data[0]); CHECK(compare_data[0] == data[0]);
CHECK_EQUAL(compare_data[1], data[1]); CHECK(compare_data[1] == data[1]);
CHECK_EQUAL(compare_data[2], data[2]); CHECK(compare_data[2] == data[2]);
CHECK_EQUAL(compare_data[3], data[3]); CHECK(compare_data[3] == data[3]);
CHECK_EQUAL(compare_data[4], data[4]); CHECK(compare_data[4] == data[4]);
CHECK_EQUAL(compare_data[5], data[5]); CHECK(compare_data[5] == data[5]);
CHECK_EQUAL(compare_data[6], data[6]); CHECK(compare_data[6] == data[6]);
CHECK_EQUAL(compare_data[7], data[7]); CHECK(compare_data[7] == data[7]);
CHECK_EQUAL(compare_data[8], data[8]); CHECK(compare_data[8] == data[8]);
CHECK_EQUAL(compare_data[9], data[9]); CHECK(compare_data[9] == data[9]);
} }
//************************************************************************* //*************************************************************************
@ -559,16 +559,16 @@ namespace
Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); Compare_DataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.at(0), compare_data.at(0)); CHECK(data.at(0) == compare_data.at(0));
CHECK_EQUAL(data.at(1), compare_data.at(1)); CHECK(data.at(1) == compare_data.at(1));
CHECK_EQUAL(data.at(2), compare_data.at(2)); CHECK(data.at(2) == compare_data.at(2));
CHECK_EQUAL(data.at(3), compare_data.at(3)); CHECK(data.at(3) == compare_data.at(3));
CHECK_EQUAL(data.at(4), compare_data.at(4)); CHECK(data.at(4) == compare_data.at(4));
CHECK_EQUAL(data.at(5), compare_data.at(5)); CHECK(data.at(5) == compare_data.at(5));
CHECK_EQUAL(data.at(6), compare_data.at(6)); CHECK(data.at(6) == compare_data.at(6));
CHECK_EQUAL(data.at(7), compare_data.at(7)); CHECK(data.at(7) == compare_data.at(7));
CHECK_EQUAL(data.at(8), compare_data.at(8)); CHECK(data.at(8) == compare_data.at(8));
CHECK_EQUAL(data.at(9), compare_data.at(9)); CHECK(data.at(9) == compare_data.at(9));
} }
//************************************************************************* //*************************************************************************
@ -588,16 +588,16 @@ namespace
const Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); const Compare_DataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.at(0), compare_data.at(0)); CHECK(data.at(0) == compare_data.at(0));
CHECK_EQUAL(data.at(1), compare_data.at(1)); CHECK(data.at(1) == compare_data.at(1));
CHECK_EQUAL(data.at(2), compare_data.at(2)); CHECK(data.at(2) == compare_data.at(2));
CHECK_EQUAL(data.at(3), compare_data.at(3)); CHECK(data.at(3) == compare_data.at(3));
CHECK_EQUAL(data.at(4), compare_data.at(4)); CHECK(data.at(4) == compare_data.at(4));
CHECK_EQUAL(data.at(5), compare_data.at(5)); CHECK(data.at(5) == compare_data.at(5));
CHECK_EQUAL(data.at(6), compare_data.at(6)); CHECK(data.at(6) == compare_data.at(6));
CHECK_EQUAL(data.at(7), compare_data.at(7)); CHECK(data.at(7) == compare_data.at(7));
CHECK_EQUAL(data.at(8), compare_data.at(8)); CHECK(data.at(8) == compare_data.at(8));
CHECK_EQUAL(data.at(9), compare_data.at(9)); CHECK(data.at(9) == compare_data.at(9));
} }
//************************************************************************* //*************************************************************************
@ -743,7 +743,7 @@ namespace
CHECK(dr.first->first == cr.first->first); CHECK(dr.first->first == cr.first->first);
CHECK(dr.second == cr.second); CHECK(dr.second == cr.second);
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size() == data.size());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -973,7 +973,7 @@ namespace
size_t count_compare = compare_data.erase(5); size_t count_compare = compare_data.erase(5);
size_t count = data.erase(5); size_t count = data.erase(5);
CHECK_EQUAL(count_compare, count); CHECK(count_compare == count);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -1039,13 +1039,13 @@ namespace
DataNDC data(compare_data.begin(), compare_data.end()); DataNDC data(compare_data.begin(), compare_data.end());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
// Do it again to check that clear() didn't screw up the internals. // Do it again to check that clear() didn't screw up the internals.
data.assign(compare_data.begin(), compare_data.end()); data.assign(compare_data.begin(), compare_data.end());
CHECK_EQUAL(data.size(), compare_data.size()); CHECK(data.size() == compare_data.size());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -1053,13 +1053,13 @@ namespace
{ {
DataInt data(int_data.begin(), int_data.end()); DataInt data(int_data.begin(), int_data.end());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
// Do it again to check that clear() didn't screw up the internals. // Do it again to check that clear() didn't screw up the internals.
data.assign(int_data.begin(), int_data.end()); data.assign(int_data.begin(), int_data.end());
CHECK_EQUAL(data.size(), int_data.size()); CHECK(data.size() == int_data.size());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -1124,7 +1124,7 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(3); DataNDC::iterator it = data.find(3);
CHECK_EQUAL(N3, it->second); CHECK(N3 == it->second);
} }
//************************************************************************* //*************************************************************************
@ -1133,10 +1133,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(-1); DataNDC::iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -1145,7 +1145,7 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(3); DataNDC::const_iterator it = data.find(3);
CHECK_EQUAL(N3, it->second); CHECK(N3 == it->second);
} }
//************************************************************************* //*************************************************************************
@ -1154,10 +1154,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(-1); DataNDC::const_iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -1169,7 +1169,7 @@ namespace
Compare_DataNDC::iterator i_compare = compare_data.lower_bound(5); Compare_DataNDC::iterator i_compare = compare_data.lower_bound(5);
DataNDC::iterator i_data = data.lower_bound(5); DataNDC::iterator i_data = data.lower_bound(5);
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare), std::distance(data.begin(), i_data)); CHECK(std::distance(compare_data.begin(), i_compare) == std::distance(data.begin(), i_data));
} }
//************************************************************************* //*************************************************************************
@ -1181,7 +1181,7 @@ namespace
Compare_DataNDC::iterator i_compare = compare_data.upper_bound(5); Compare_DataNDC::iterator i_compare = compare_data.upper_bound(5);
DataNDC::iterator i_data = data.upper_bound(5); DataNDC::iterator i_data = data.upper_bound(5);
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare), std::distance(data.begin(), i_data)); CHECK(std::distance(compare_data.begin(), i_compare) == std::distance(data.begin(), i_data));
} }
//************************************************************************* //*************************************************************************
@ -1193,8 +1193,8 @@ namespace
ETL_OR_STD::pair<Compare_DataNDC::iterator, Compare_DataNDC::iterator> i_compare = compare_data.equal_range(5); ETL_OR_STD::pair<Compare_DataNDC::iterator, Compare_DataNDC::iterator> i_compare = compare_data.equal_range(5);
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data = data.equal_range(5); ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data = data.equal_range(5);
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK(std::distance(compare_data.begin(), i_compare.first) == std::distance(data.begin(), i_data.first));
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); CHECK(std::distance(compare_data.begin(), i_compare.second) == std::distance(data.begin(), i_data.second));
} }
//************************************************************************* //*************************************************************************
@ -1208,12 +1208,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(-1); i_data = data.equal_range(-1);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(99); i_data = data.equal_range(99);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -286,10 +286,10 @@ namespace
{ {
DataDC data; DataDC data;
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
CHECK(data.empty()); CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE); CHECK(data.capacity() == SIZE);
CHECK_EQUAL(data.max_size(), SIZE); CHECK(data.max_size() == SIZE);
CHECK(data.begin() == data.end()); CHECK(data.begin() == data.end());
} }
@ -299,11 +299,11 @@ namespace
int current_count = NDC::get_instance_count(); int current_count = NDC::get_instance_count();
DataNDC* pdata = new DataNDC(initial_data.begin(), initial_data.end()); DataNDC* pdata = new DataNDC(initial_data.begin(), initial_data.end());
CHECK_EQUAL(int(current_count + initial_data.size()), NDC::get_instance_count()); CHECK(int(current_count + initial_data.size()) == NDC::get_instance_count());
IDataNDC* pidata = pdata; IDataNDC* pidata = pdata;
delete pidata; delete pidata;
CHECK_EQUAL(current_count, NDC::get_instance_count()); CHECK(current_count == NDC::get_instance_count());
} }
//************************************************************************* //*************************************************************************
@ -331,7 +331,7 @@ namespace
DataNDC data = { ElementNDC(0, N0), ElementNDC(1, N1), ElementNDC(2, N2), ElementNDC(3, N3), ElementNDC(4, N4) }; DataNDC data = { ElementNDC(0, N0), ElementNDC(1, N1), ElementNDC(2, N2), ElementNDC(3, N3), ElementNDC(4, N4) };
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size() == data.size());
CHECK(!data.empty()); CHECK(!data.empty());
bool isEqual = std::equal(data.begin(), bool isEqual = std::equal(data.begin(),
@ -367,16 +367,16 @@ namespace
DataM data2(std::move(data1)); DataM data2(std::move(data1));
CHECK_EQUAL(5U, data1.size()); // Move does not clear the source. CHECK(5U == data1.size()); // Move does not clear the source.
CHECK_EQUAL(5U, data2.size()); CHECK(5U == data2.size());
DataM::const_iterator itr = data2.begin(); DataM::const_iterator itr = data2.begin();
CHECK_EQUAL("1", (*itr++).second.value); CHECK("1" == (*itr++).second.value);
CHECK_EQUAL("2a", (*itr++).second.value); CHECK("2a" == (*itr++).second.value);
CHECK_EQUAL("2b", (*itr++).second.value); CHECK("2b" == (*itr++).second.value);
CHECK_EQUAL("3", (*itr++).second.value); CHECK("3" == (*itr++).second.value);
CHECK_EQUAL("4", (*itr++).second.value); CHECK("4" == (*itr++).second.value);
} }
//************************************************************************* //*************************************************************************
@ -433,8 +433,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -443,8 +443,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -545,7 +545,7 @@ namespace
data.insert(ETL_OR_STD::make_pair(2, N2)); data.insert(ETL_OR_STD::make_pair(2, N2));
compare_data.insert(ETL_OR_STD::make_pair(2, N2)); compare_data.insert(ETL_OR_STD::make_pair(2, N2));
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size() == data.size());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -619,7 +619,7 @@ namespace
data.emplace(ETL_OR_STD::make_pair(2, D1("2"))); data.emplace(ETL_OR_STD::make_pair(2, D1("2")));
compare.emplace(ETL_OR_STD::make_pair(2, D1("2"))); compare.emplace(ETL_OR_STD::make_pair(2, D1("2")));
CHECK_EQUAL(compare.size(), data.size()); CHECK(compare.size() == data.size());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -653,7 +653,7 @@ namespace
data.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); data.emplace(ETL_OR_STD::make_pair(2, D2("2", "3")));
compare.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); compare.emplace(ETL_OR_STD::make_pair(2, D2("2", "3")));
CHECK_EQUAL(compare.size(), data.size()); CHECK(compare.size() == data.size());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -687,7 +687,7 @@ namespace
data.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); data.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4")));
compare.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); compare.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4")));
CHECK_EQUAL(compare.size(), data.size()); CHECK(compare.size() == data.size());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -721,7 +721,7 @@ namespace
data.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); data.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5")));
compare.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); compare.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5")));
CHECK_EQUAL(compare.size(), data.size()); CHECK(compare.size() == data.size());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -739,7 +739,7 @@ namespace
size_t count_compare = compare_data.erase(5); size_t count_compare = compare_data.erase(5);
size_t count = data.erase(5); size_t count = data.erase(5);
CHECK_EQUAL(count_compare, count); CHECK(count_compare == count);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -805,13 +805,13 @@ namespace
DataNDC data(compare_data.begin(), compare_data.end()); DataNDC data(compare_data.begin(), compare_data.end());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
// Do it again to check that clear() didn't screw up the internals. // Do it again to check that clear() didn't screw up the internals.
data.assign(compare_data.begin(), compare_data.end()); data.assign(compare_data.begin(), compare_data.end());
CHECK_EQUAL(data.size(), compare_data.size()); CHECK(data.size() == compare_data.size());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -820,13 +820,13 @@ namespace
DataInt data(int_data.begin(), int_data.end()); DataInt data(int_data.begin(), int_data.end());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
// Do it again to check that clear() didn't screw up the internals. // Do it again to check that clear() didn't screw up the internals.
data.assign(int_data.begin(), int_data.end()); data.assign(int_data.begin(), int_data.end());
CHECK_EQUAL(data.size(), int_data.size()); CHECK(data.size() == int_data.size());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -891,10 +891,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(3); DataNDC::iterator it = data.find(3);
CHECK_EQUAL(N3, it->second); CHECK(N3 == it->second);
it = data.find(19); it = data.find(19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -903,10 +903,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(-1); DataNDC::iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -915,10 +915,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(3); DataNDC::const_iterator it = data.find(3);
CHECK_EQUAL(N3, it->second); CHECK(N3 == it->second);
it = data.find(19); it = data.find(19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -927,10 +927,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(-1); DataNDC::const_iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -942,7 +942,7 @@ namespace
Compare_DataNDC::iterator i_compare = compare_data.lower_bound(5); Compare_DataNDC::iterator i_compare = compare_data.lower_bound(5);
DataNDC::iterator i_data = data.lower_bound(5); DataNDC::iterator i_data = data.lower_bound(5);
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare), std::distance(data.begin(), i_data)); CHECK(std::distance(compare_data.begin(), i_compare) == std::distance(data.begin(), i_data));
} }
//************************************************************************* //*************************************************************************
@ -954,7 +954,7 @@ namespace
Compare_DataNDC::iterator i_compare = compare_data.upper_bound(5); Compare_DataNDC::iterator i_compare = compare_data.upper_bound(5);
DataNDC::iterator i_data = data.upper_bound(5); DataNDC::iterator i_data = data.upper_bound(5);
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare), std::distance(data.begin(), i_data)); CHECK(std::distance(compare_data.begin(), i_compare) == std::distance(data.begin(), i_data));
} }
//************************************************************************* //*************************************************************************
@ -966,8 +966,8 @@ namespace
ETL_OR_STD::pair<Compare_DataNDC::iterator, Compare_DataNDC::iterator> i_compare = compare_data.equal_range(5); ETL_OR_STD::pair<Compare_DataNDC::iterator, Compare_DataNDC::iterator> i_compare = compare_data.equal_range(5);
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data = data.equal_range(5); ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data = data.equal_range(5);
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK(std::distance(compare_data.begin(), i_compare.first) == std::distance(data.begin(), i_data.first));
CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); CHECK(std::distance(compare_data.begin(), i_compare.second) == std::distance(data.begin(), i_data.second));
} }
//************************************************************************* //*************************************************************************
@ -978,12 +978,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(-1); i_data = data.equal_range(-1);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(99); i_data = data.equal_range(99);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************
@ -1023,27 +1023,27 @@ namespace
compare_range = compare_data.equal_range(0); compare_range = compare_data.equal_range(0);
test_range = data.equal_range(0); test_range = data.equal_range(0);
CHECK_EQUAL(std::distance(compare_range.first, compare_range.second), std::distance(test_range.first, test_range.second)); CHECK(std::distance(compare_range.first, compare_range.second) == std::distance(test_range.first, test_range.second));
compare_range = compare_data.equal_range(1); compare_range = compare_data.equal_range(1);
test_range = data.equal_range(1); test_range = data.equal_range(1);
CHECK_EQUAL(std::distance(compare_range.first, compare_range.second), std::distance(test_range.first, test_range.second)); CHECK(std::distance(compare_range.first, compare_range.second) == std::distance(test_range.first, test_range.second));
compare_range = compare_data.equal_range(2); compare_range = compare_data.equal_range(2);
test_range = data.equal_range(2); test_range = data.equal_range(2);
CHECK_EQUAL(std::distance(compare_range.first, compare_range.second), std::distance(test_range.first, test_range.second)); CHECK(std::distance(compare_range.first, compare_range.second) == std::distance(test_range.first, test_range.second));
compare_range = compare_data.equal_range(3); compare_range = compare_data.equal_range(3);
test_range = data.equal_range(3); test_range = data.equal_range(3);
CHECK_EQUAL(std::distance(compare_range.first, compare_range.second), std::distance(test_range.first, test_range.second)); CHECK(std::distance(compare_range.first, compare_range.second) == std::distance(test_range.first, test_range.second));
compare_range = compare_data.equal_range(4); compare_range = compare_data.equal_range(4);
test_range = data.equal_range(4); test_range = data.equal_range(4);
CHECK_EQUAL(std::distance(compare_range.first, compare_range.second), std::distance(test_range.first, test_range.second)); CHECK(std::distance(compare_range.first, compare_range.second) == std::distance(test_range.first, test_range.second));
compare_range = compare_data.equal_range(5); compare_range = compare_data.equal_range(5);
test_range = data.equal_range(5); test_range = data.equal_range(5);
CHECK_EQUAL(std::distance(compare_range.first, compare_range.second), std::distance(test_range.first, test_range.second)); CHECK(std::distance(compare_range.first, compare_range.second) == std::distance(test_range.first, test_range.second));
} }
//************************************************************************* //*************************************************************************
@ -1052,12 +1052,12 @@ namespace
Compare_DataNDC compare_data(multi_data.begin(), multi_data.end()); Compare_DataNDC compare_data(multi_data.begin(), multi_data.end());
DataNDC data(multi_data.begin(), multi_data.end()); DataNDC data(multi_data.begin(), multi_data.end());
CHECK_EQUAL(compare_data.count(0), data.count(0)); CHECK(compare_data.count(0) == data.count(0));
CHECK_EQUAL(compare_data.count(1), data.count(1)); CHECK(compare_data.count(1) == data.count(1));
CHECK_EQUAL(compare_data.count(2), data.count(2)); CHECK(compare_data.count(2) == data.count(2));
CHECK_EQUAL(compare_data.count(3), data.count(3)); CHECK(compare_data.count(3) == data.count(3));
CHECK_EQUAL(compare_data.count(4), data.count(4)); CHECK(compare_data.count(4) == data.count(4));
CHECK_EQUAL(compare_data.count(5), data.count(5)); CHECK(compare_data.count(5) == data.count(5));
} }
}; };
} }

View File

@ -398,8 +398,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -408,8 +408,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -859,7 +859,7 @@ namespace
CHECK_EQUAL(N3, *it); CHECK_EQUAL(N3, *it);
it = data.find(N19); it = data.find(N19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -868,10 +868,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(NX); DataNDC::iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -883,7 +883,7 @@ namespace
CHECK_EQUAL(N3, *it); CHECK_EQUAL(N3, *it);
it = data.find(N19); it = data.find(N19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -892,10 +892,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(NX); DataNDC::const_iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -943,12 +943,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(NX); i_data = data.equal_range(NX);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(NY); i_data = data.equal_range(NY);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -406,8 +406,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -416,8 +416,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(data); const DataNDC constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -844,10 +844,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(NX); DataNDC::iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -865,10 +865,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(NX); DataNDC::const_iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -916,12 +916,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(NX); i_data = data.equal_range(NX);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(NY); i_data = data.equal_range(NY);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -218,10 +218,10 @@ namespace
{ {
Data data; Data data;
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
CHECK(data.empty()); CHECK(data.empty());
CHECK_EQUAL(data.capacity(), MAX_SIZE); CHECK(data.capacity() == MAX_SIZE);
CHECK_EQUAL(data.max_size(), MAX_SIZE); CHECK(data.max_size() == MAX_SIZE);
CHECK(data.begin() == data.end()); CHECK(data.begin() == data.end());
} }
@ -232,7 +232,7 @@ namespace
Data data1(compare_data.begin(), compare_data.end()); Data data1(compare_data.begin(), compare_data.end());
Data data2(data1); Data data2(data1);
CHECK_EQUAL(initial_data.size(), data1.size()); CHECK(initial_data.size() == data1.size());
CHECK(data1.size() == data2.size()); CHECK(data1.size() == data2.size());
bool isEqual = false; bool isEqual = false;
@ -266,10 +266,10 @@ namespace
CHECK(!data1.empty()); // Move does not clear the source. CHECK(!data1.empty()); // Move does not clear the source.
CHECK_EQUAL(1, data2.at("1").value); CHECK(1 == data2.at("1").value);
CHECK_EQUAL(2, data2.at("2").value); CHECK(2 == data2.at("2").value);
CHECK_EQUAL(3, data2.at("3").value); CHECK(3 == data2.at("3").value);
CHECK_EQUAL(4, data2.at("4").value); CHECK(4 == data2.at("4").value);
} }
//************************************************************************* //*************************************************************************
@ -305,7 +305,7 @@ namespace
Data data = { Data::value_type(std::string("0"), 0), Data::value_type(std::string("1"), 1), Data data = { Data::value_type(std::string("0"), 0), Data::value_type(std::string("1"), 1),
Data::value_type(std::string("2"), 2), Data::value_type(std::string("3"), 3) }; Data::value_type(std::string("2"), 2), Data::value_type(std::string("3"), 3) };
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size() == data.size());
CHECK(!data.empty()); CHECK(!data.empty());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -381,10 +381,10 @@ namespace
data2 = std::move(data1); data2 = std::move(data1);
CHECK_EQUAL(1, data2.at("1").value); CHECK(1 == data2.at("1").value);
CHECK_EQUAL(2, data2.at("2").value); CHECK(2 == data2.at("2").value);
CHECK_EQUAL(3, data2.at("3").value); CHECK(3 == data2.at("3").value);
CHECK_EQUAL(4, data2.at("4").value); CHECK(4 == data2.at("4").value);
} }
//************************************************************************* //*************************************************************************
@ -393,8 +393,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -403,8 +403,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -433,16 +433,16 @@ namespace
Data data(compare_data.begin(), compare_data.end()); Data data(compare_data.begin(), compare_data.end());
CHECK_EQUAL(data["0"], compare_data["0"]); CHECK(data["0"] == compare_data["0"]);
CHECK_EQUAL(data["1"], compare_data["1"]); CHECK(data["1"] == compare_data["1"]);
CHECK_EQUAL(data["2"], compare_data["2"]); CHECK(data["2"] == compare_data["2"]);
CHECK_EQUAL(data["3"], compare_data["3"]); CHECK(data["3"] == compare_data["3"]);
CHECK_EQUAL(data["4"], compare_data["4"]); CHECK(data["4"] == compare_data["4"]);
CHECK_EQUAL(data["5"], compare_data["5"]); CHECK(data["5"] == compare_data["5"]);
CHECK_EQUAL(data["6"], compare_data["6"]); CHECK(data["6"] == compare_data["6"]);
CHECK_EQUAL(data["7"], compare_data["7"]); CHECK(data["7"] == compare_data["7"]);
CHECK_EQUAL(data["8"], compare_data["8"]); CHECK(data["8"] == compare_data["8"]);
CHECK_EQUAL(data["9"], compare_data["9"]); CHECK(data["9"] == compare_data["9"]);
} }
//************************************************************************* //*************************************************************************
@ -457,7 +457,7 @@ namespace
data["0"] = 1; data["0"] = 1;
compare_data["0"] = 1; compare_data["0"] = 1;
CHECK_EQUAL(data["0"], compare_data["0"]); CHECK(data["0"] == compare_data["0"]);
} }
//************************************************************************* //*************************************************************************
@ -466,16 +466,16 @@ namespace
Compare_Data compare_data(initial_data.begin(), initial_data.end()); Compare_Data compare_data(initial_data.begin(), initial_data.end());
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.at("0"), compare_data.at("0")); CHECK(data.at("0") == compare_data.at("0"));
CHECK_EQUAL(data.at("1"), compare_data.at("1")); CHECK(data.at("1") == compare_data.at("1"));
CHECK_EQUAL(data.at("2"), compare_data.at("2")); CHECK(data.at("2") == compare_data.at("2"));
CHECK_EQUAL(data.at("3"), compare_data.at("3")); CHECK(data.at("3") == compare_data.at("3"));
CHECK_EQUAL(data.at("4"), compare_data.at("4")); CHECK(data.at("4") == compare_data.at("4"));
CHECK_EQUAL(data.at("5"), compare_data.at("5")); CHECK(data.at("5") == compare_data.at("5"));
CHECK_EQUAL(data.at("6"), compare_data.at("6")); CHECK(data.at("6") == compare_data.at("6"));
CHECK_EQUAL(data.at("7"), compare_data.at("7")); CHECK(data.at("7") == compare_data.at("7"));
CHECK_EQUAL(data.at("8"), compare_data.at("8")); CHECK(data.at("8") == compare_data.at("8"));
CHECK_EQUAL(data.at("9"), compare_data.at("9")); CHECK(data.at("9") == compare_data.at("9"));
} }
//************************************************************************* //*************************************************************************
@ -495,16 +495,16 @@ namespace
const Compare_Data compare_data(initial_data.begin(), initial_data.end()); const Compare_Data compare_data(initial_data.begin(), initial_data.end());
const Data data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.at("0"), compare_data.at("0")); CHECK(data.at("0") == compare_data.at("0"));
CHECK_EQUAL(data.at("1"), compare_data.at("1")); CHECK(data.at("1") == compare_data.at("1"));
CHECK_EQUAL(data.at("2"), compare_data.at("2")); CHECK(data.at("2") == compare_data.at("2"));
CHECK_EQUAL(data.at("3"), compare_data.at("3")); CHECK(data.at("3") == compare_data.at("3"));
CHECK_EQUAL(data.at("4"), compare_data.at("4")); CHECK(data.at("4") == compare_data.at("4"));
CHECK_EQUAL(data.at("5"), compare_data.at("5")); CHECK(data.at("5") == compare_data.at("5"));
CHECK_EQUAL(data.at("6"), compare_data.at("6")); CHECK(data.at("6") == compare_data.at("6"));
CHECK_EQUAL(data.at("7"), compare_data.at("7")); CHECK(data.at("7") == compare_data.at("7"));
CHECK_EQUAL(data.at("8"), compare_data.at("8")); CHECK(data.at("8") == compare_data.at("8"));
CHECK_EQUAL(data.at("9"), compare_data.at("9")); CHECK(data.at("9") == compare_data.at("9"));
} }
//************************************************************************* //*************************************************************************
@ -543,16 +543,16 @@ namespace
compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data_result.first->first, compare_result.first->first); CHECK(data_result.first->first == compare_result.first->first);
CHECK_EQUAL(data_result.second, compare_result.second); CHECK(data_result.second == compare_result.second);
// Try adding a duplicate (should return iterator pointing to duplicate) // Try adding a duplicate (should return iterator pointing to duplicate)
data_result = data.insert(Data::value_type(std::string("0"), 0)); data_result = data.insert(Data::value_type(std::string("0"), 0));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data_result.first->first, compare_result.first->first); CHECK(data_result.first->first == compare_result.first->first);
CHECK_EQUAL(data_result.second, compare_result.second); CHECK(data_result.second == compare_result.second);
// Check that elements in map are the same // Check that elements in map are the same
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -619,10 +619,10 @@ namespace
CHECK(!bool(d2)); CHECK(!bool(d2));
CHECK(!bool(d3)); CHECK(!bool(d3));
CHECK_EQUAL(1, data.at("1").value); CHECK(1 == data.at("1").value);
CHECK_EQUAL(2, data.at("2").value); CHECK(2 == data.at("2").value);
CHECK_EQUAL(3, data.at("3").value); CHECK(3 == data.at("3").value);
CHECK_EQUAL(4, data.at("4").value); CHECK(4 == data.at("4").value);
} }
//************************************************************************* //*************************************************************************
@ -662,8 +662,8 @@ namespace
compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data_result.first->first, compare_result.first->first); CHECK(data_result.first->first == compare_result.first->first);
CHECK_EQUAL(data_result.second, compare_result.second); CHECK(data_result.second == compare_result.second);
// Check that elements in map are the same // Check that elements in map are the same
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -693,8 +693,8 @@ namespace
compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data_result.first->first, compare_result.first->first); CHECK(data_result.first->first == compare_result.first->first);
CHECK_EQUAL(data_result.second, compare_result.second); CHECK(data_result.second == compare_result.second);
// Check that elements in map are the same // Check that elements in map are the same
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -776,12 +776,12 @@ namespace
Compare_Data::iterator compare_data_lb = compare_data.lower_bound("2"); Compare_Data::iterator compare_data_lb = compare_data.lower_bound("2");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(data_lb->first, compare_data_lb->first); CHECK(data_lb->first == compare_data_lb->first);
CHECK_EQUAL(data_lb->second, compare_data_lb->second); CHECK(data_lb->second == compare_data_lb->second);
CHECK_EQUAL(data_result.first->first, compare_result.first->first); CHECK(data_result.first->first == compare_result.first->first);
CHECK_EQUAL(data_result.first->second, compare_result.first->second); CHECK(data_result.first->second == compare_result.first->second);
CHECK_EQUAL(data_result.second->first, compare_result.second->first); CHECK(data_result.second->first == compare_result.second->first);
CHECK_EQUAL(data_result.second->second, compare_result.second->second); CHECK(data_result.second->second == compare_result.second->second);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -802,10 +802,10 @@ namespace
compare_data.equal_range("2"); compare_data.equal_range("2");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(data_result.first->first, compare_result.first->first); CHECK(data_result.first->first == compare_result.first->first);
CHECK_EQUAL(data_result.first->second, compare_result.first->second); CHECK(data_result.first->second == compare_result.first->second);
CHECK_EQUAL(data_result.second->first, compare_result.second->first); CHECK(data_result.second->first == compare_result.second->first);
CHECK_EQUAL(data_result.second->second, compare_result.second->second); CHECK(data_result.second->second == compare_result.second->second);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -867,7 +867,7 @@ namespace
Compare_Data::const_iterator i_compare1 = compare_data.erase(i_compare); Compare_Data::const_iterator i_compare1 = compare_data.erase(i_compare);
Data::const_iterator i_data1 = data.erase(i_data); Data::const_iterator i_data1 = data.erase(i_data);
CHECK_EQUAL(i_compare1->second, i_data1->second); CHECK(i_compare1->second == i_data1->second);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -938,7 +938,7 @@ namespace
Data data(compare_data.begin(), compare_data.end()); Data data(compare_data.begin(), compare_data.end());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -946,9 +946,9 @@ namespace
{ {
const Data data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.count("3"), size_t(1)); CHECK(data.count("3") == size_t(1));
CHECK_EQUAL(data.count("A"), size_t(0)); CHECK(data.count("A") == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -1013,13 +1013,13 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
Data::iterator it = data.find("3"); Data::iterator it = data.find("3");
CHECK_EQUAL(3, it->second); CHECK(3 == it->second);
it = data.find("A"); it = data.find("A");
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find("!"); it = data.find("!");
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -1028,13 +1028,13 @@ namespace
const Data data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end());
Data::const_iterator it = data.find("3"); Data::const_iterator it = data.find("3");
CHECK_EQUAL(3, it->second); CHECK(3 == it->second);
it = data.find("A"); it = data.find("A");
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find("!"); it = data.find("!");
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -1071,28 +1071,28 @@ namespace
Compare_Data::iterator i_compare = compare_data.lower_bound("8"); Compare_Data::iterator i_compare = compare_data.lower_bound("8");
Data::iterator i_data = data.lower_bound("8"); Data::iterator i_data = data.lower_bound("8");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1104,28 +1104,28 @@ namespace
Compare_Data::const_iterator i_compare = compare_data.lower_bound("4"); Compare_Data::const_iterator i_compare = compare_data.lower_bound("4");
Data::const_iterator i_data = data.lower_bound("4"); Data::const_iterator i_data = data.lower_bound("4");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1137,28 +1137,28 @@ namespace
Compare_Data::iterator i_compare = compare_data.upper_bound("2"); Compare_Data::iterator i_compare = compare_data.upper_bound("2");
Data::iterator i_data = data.upper_bound("2"); Data::iterator i_data = data.upper_bound("2");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1170,28 +1170,28 @@ namespace
Compare_Data::const_iterator i_compare = compare_data.upper_bound("7"); Compare_Data::const_iterator i_compare = compare_data.upper_bound("7");
Data::const_iterator i_data = data.upper_bound("7"); Data::const_iterator i_data = data.upper_bound("7");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1246,14 +1246,14 @@ namespace
std::vector<ETL_OR_STD::pair<std::string, int> > compare_data_elements(compare.begin(), compare.end()); std::vector<ETL_OR_STD::pair<std::string, int> > compare_data_elements(compare.begin(), compare.end());
CHECK(data_elements == compare_data_elements); CHECK(data_elements == compare_data_elements);
CHECK_EQUAL(data_elements.size(), MAX_SIZE); CHECK(data_elements.size() == MAX_SIZE);
for(std::vector<ETL_OR_STD::pair<std::string, int> >::iterator it = tab.begin() ; it != tab.end() ; ++it) for(std::vector<ETL_OR_STD::pair<std::string, int> >::iterator it = tab.begin() ; it != tab.end() ; ++it)
{ {
std::string i = it->first; std::string i = it->first;
//lower_bound //lower_bound
CHECK_EQUAL(compare.lower_bound(i) == compare.end(), data.lower_bound(i) == data.end()); CHECK((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end()));
//if both end, or none //if both end, or none
if((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end())) if((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end()))
{ {
@ -1266,12 +1266,12 @@ namespace
ETL_OR_STD::pair<Compare_Data::const_iterator, Compare_Data::const_iterator> stlret = compare.equal_range(i); ETL_OR_STD::pair<Compare_Data::const_iterator, Compare_Data::const_iterator> stlret = compare.equal_range(i);
ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> etlret = data.equal_range(i); ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> etlret = data.equal_range(i);
CHECK_EQUAL(stlret.first == compare.end(), etlret.first == data.end()); CHECK((stlret.first == compare.end()) == (etlret.first == data.end()));
if((stlret.first != compare.end()) && (etlret.first != data.end())) if((stlret.first != compare.end()) && (etlret.first != data.end()))
{ {
CHECK((*stlret.first) == (*etlret.first)); CHECK((*stlret.first) == (*etlret.first));
} }
CHECK_EQUAL(stlret.second == compare.end(), etlret.second == data.end()); CHECK((stlret.second == compare.end()) == (etlret.second == data.end()));
if((stlret.second != compare.end()) && (etlret.second != data.end())) if((stlret.second != compare.end()) && (etlret.second != data.end()))
{ {
CHECK((*stlret.second) == (*etlret.second)); CHECK((*stlret.second) == (*etlret.second));
@ -1279,7 +1279,7 @@ namespace
} }
//upper_bound //upper_bound
CHECK_EQUAL(compare.upper_bound(i) == compare.end(), data.upper_bound(i) == data.end()); CHECK((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end()));
//if both end, or none //if both end, or none
if((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end())) if((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end()))
{ {

View File

@ -220,10 +220,10 @@ namespace
{ {
Data data; Data data;
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
CHECK(data.empty()); CHECK(data.empty());
CHECK_EQUAL(data.capacity(), MAX_SIZE); CHECK(data.capacity() == MAX_SIZE);
CHECK_EQUAL(data.max_size(), MAX_SIZE); CHECK(data.max_size() == MAX_SIZE);
CHECK(data.begin() == data.end()); CHECK(data.begin() == data.end());
} }
@ -234,7 +234,7 @@ namespace
Data data1(compare_data.begin(), compare_data.end()); Data data1(compare_data.begin(), compare_data.end());
Data data2(data1); Data data2(data1);
CHECK_EQUAL(initial_data.size(), data1.size()); CHECK(initial_data.size() == data1.size());
CHECK(data1.size() == data2.size()); CHECK(data1.size() == data2.size());
bool isEqual = false; bool isEqual = false;
@ -268,10 +268,10 @@ namespace
CHECK(!data1.empty()); // Move does not clear the source. CHECK(!data1.empty()); // Move does not clear the source.
CHECK_EQUAL(1, data2.find("1")->second.value); CHECK(1 == data2.find("1")->second.value);
CHECK_EQUAL(2, data2.find("2")->second.value); CHECK(2 == data2.find("2")->second.value);
CHECK_EQUAL(3, data2.find("3")->second.value); CHECK(3 == data2.find("3")->second.value);
CHECK_EQUAL(4, data2.find("4")->second.value); CHECK(4 == data2.find("4")->second.value);
} }
//************************************************************************* //*************************************************************************
@ -304,7 +304,7 @@ namespace
Data data = { Data::value_type(std::string("0"), 0), Data::value_type(std::string("1"), 1), Data data = { Data::value_type(std::string("0"), 0), Data::value_type(std::string("1"), 1),
Data::value_type(std::string("2"), 2), Data::value_type(std::string("3"), 3) }; Data::value_type(std::string("2"), 2), Data::value_type(std::string("3"), 3) };
CHECK_EQUAL(compare_data.size(), data.size()); CHECK(compare_data.size() == data.size());
CHECK(!data.empty()); CHECK(!data.empty());
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -380,10 +380,10 @@ namespace
data2 = std::move(data1); data2 = std::move(data1);
CHECK_EQUAL(1, data2.find("1")->second.value); CHECK(1 == data2.find("1")->second.value);
CHECK_EQUAL(2, data2.find("2")->second.value); CHECK(2 == data2.find("2")->second.value);
CHECK_EQUAL(3, data2.find("3")->second.value); CHECK(3 == data2.find("3")->second.value);
CHECK_EQUAL(4, data2.find("4")->second.value); CHECK(4 == data2.find("4")->second.value);
} }
//************************************************************************* //*************************************************************************
@ -392,8 +392,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -402,8 +402,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -453,52 +453,52 @@ namespace
compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 1)); compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 1));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
data_result = data.insert(Data::value_type(std::string("1"), 1)); data_result = data.insert(Data::value_type(std::string("1"), 1));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("1"), 1)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("1"), 1));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
data_result = data.insert(Data::value_type(std::string("2"), 2)); data_result = data.insert(Data::value_type(std::string("2"), 2));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
data_result = data.insert(Data::value_type(std::string("3"), 3)); data_result = data.insert(Data::value_type(std::string("3"), 3));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("3"), 3)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("3"), 3));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
// Adding this next 2 will trigger a 3 node rotate RL on insert // Adding this next 2 will trigger a 3 node rotate RL on insert
data_result = data.insert(Data::value_type(std::string("2"), 3)); data_result = data.insert(Data::value_type(std::string("2"), 3));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 3)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 3));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
// Adding this next 4 will trigger a 2 node rotate left on insert // Adding this next 4 will trigger a 2 node rotate left on insert
data_result = data.insert(Data::value_type(std::string("4"), 4)); data_result = data.insert(Data::value_type(std::string("4"), 4));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("4"), 4)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("4"), 4));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
data_result = data.insert(Data::value_type(std::string("0"), 0)); data_result = data.insert(Data::value_type(std::string("0"), 0));
compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
// Check that elements in map are the same // Check that elements in map are the same
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -519,8 +519,8 @@ namespace
compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
// Check that elements in map are the same // Check that elements in map are the same
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -550,8 +550,8 @@ namespace
compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 0)); compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 0));
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(compare_result->first, data_result->first); CHECK(compare_result->first == data_result->first);
CHECK_EQUAL(compare_result->second, data_result->second); CHECK(compare_result->second == data_result->second);
// Check that elements in map are the same // Check that elements in map are the same
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
@ -632,10 +632,10 @@ namespace
compare_data.equal_range("1"); compare_data.equal_range("1");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(compare_result.first->first, data_result.first->first); CHECK(compare_result.first->first == data_result.first->first);
CHECK_EQUAL(compare_result.first->second, data_result.first->second); CHECK(compare_result.first->second == data_result.first->second);
CHECK_EQUAL(compare_result.second->first, data_result.second->first); CHECK(compare_result.second->first == data_result.second->first);
CHECK_EQUAL(compare_result.second->second, data_result.second->second); CHECK(compare_result.second->second == data_result.second->second);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -657,10 +657,10 @@ namespace
compare_data.equal_range("2"); compare_data.equal_range("2");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(compare_result.first->first, data_result.first->first); CHECK(compare_result.first->first == data_result.first->first);
CHECK_EQUAL(compare_result.first->second, data_result.first->second); CHECK(compare_result.first->second == data_result.first->second);
CHECK_EQUAL(compare_result.second->first, data_result.second->first); CHECK(compare_result.second->first == data_result.second->first);
CHECK_EQUAL(compare_result.second->second, data_result.second->second); CHECK(compare_result.second->second == data_result.second->second);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -679,21 +679,21 @@ namespace
size_t data_count = data.erase("2"); size_t data_count = data.erase("2");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(compare_count, data_count); CHECK(compare_count == data_count);
// Erase another value // Erase another value
compare_count = compare_data.erase("1"); compare_count = compare_data.erase("1");
data_count = data.erase("1"); data_count = data.erase("1");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(compare_count, data_count); CHECK(compare_count == data_count);
// Erase another value // Erase another value
compare_count = compare_data.erase("3"); compare_count = compare_data.erase("3");
data_count = data.erase("3"); data_count = data.erase("3");
// Check that both return the same return results // Check that both return the same return results
CHECK_EQUAL(compare_count, data_count); CHECK(compare_count == data_count);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -736,7 +736,7 @@ namespace
Compare_Data::const_iterator i_compare1 = compare_data.erase(i_compare); Compare_Data::const_iterator i_compare1 = compare_data.erase(i_compare);
Data::const_iterator i_data1 = data.erase(i_data); Data::const_iterator i_data1 = data.erase(i_data);
CHECK_EQUAL(i_compare1->second, i_data1->second); CHECK(i_compare1->second == i_data1->second);
bool isEqual = Check_Equal(data.begin(), bool isEqual = Check_Equal(data.begin(),
data.end(), data.end(),
@ -795,7 +795,7 @@ namespace
Data data(compare_data.begin(), compare_data.end()); Data data(compare_data.begin(), compare_data.end());
data.clear(); data.clear();
CHECK_EQUAL(data.size(), size_t(0)); CHECK(data.size() == size_t(0));
} }
//************************************************************************* //*************************************************************************
@ -804,13 +804,13 @@ namespace
const Data data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end());
const Compare_Data compare_data(initial_data.begin(), initial_data.end()); const Compare_Data compare_data(initial_data.begin(), initial_data.end());
CHECK_EQUAL(compare_data.count("."), data.count(".")); CHECK(compare_data.count(".") == data.count("."));
CHECK_EQUAL(compare_data.count("0"), data.count("0")); CHECK(compare_data.count("0") == data.count("0"));
CHECK_EQUAL(compare_data.count("1"), data.count("1")); CHECK(compare_data.count("1") == data.count("1"));
CHECK_EQUAL(compare_data.count("2"), data.count("2")); CHECK(compare_data.count("2") == data.count("2"));
CHECK_EQUAL(compare_data.count("3"), data.count("3")); CHECK(compare_data.count("3") == data.count("3"));
CHECK_EQUAL(compare_data.count("4"), data.count("4")); CHECK(compare_data.count("4") == data.count("4"));
CHECK_EQUAL(compare_data.count("A"), data.count("A")); CHECK(compare_data.count("A") == data.count("A"));
} }
//************************************************************************* //*************************************************************************
@ -879,43 +879,43 @@ namespace
Compare_Data::iterator i_compare = compare_data.find("0"); Compare_Data::iterator i_compare = compare_data.find("0");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("1"); i_data = data.find("1");
i_compare = compare_data.find("1"); i_compare = compare_data.find("1");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("2"); i_data = data.find("2");
i_compare = compare_data.find("2"); i_compare = compare_data.find("2");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("3"); i_data = data.find("3");
i_compare = compare_data.find("3"); i_compare = compare_data.find("3");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("."); i_data = data.find(".");
i_compare = compare_data.find("."); i_compare = compare_data.find(".");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.find("A"); i_data = data.find("A");
i_compare = compare_data.find("A"); i_compare = compare_data.find("A");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
} }
//************************************************************************* //*************************************************************************
@ -928,43 +928,43 @@ namespace
Compare_Data::const_iterator i_compare = compare_data.find("0"); Compare_Data::const_iterator i_compare = compare_data.find("0");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("1"); i_data = data.find("1");
i_compare = compare_data.find("1"); i_compare = compare_data.find("1");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("2"); i_data = data.find("2");
i_compare = compare_data.find("2"); i_compare = compare_data.find("2");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("3"); i_data = data.find("3");
i_compare = compare_data.find("3"); i_compare = compare_data.find("3");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(i_compare->first, i_data->first); CHECK(i_compare->first == i_data->first);
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_data = data.find("."); i_data = data.find(".");
i_compare = compare_data.find("."); i_compare = compare_data.find(".");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.find("A"); i_data = data.find("A");
i_compare = compare_data.find("A"); i_compare = compare_data.find("A");
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
} }
//************************************************************************* //*************************************************************************
@ -1001,28 +1001,28 @@ namespace
Compare_Data::iterator i_compare = compare_data.lower_bound("2"); Compare_Data::iterator i_compare = compare_data.lower_bound("2");
Data::iterator i_data = data.lower_bound("2"); Data::iterator i_data = data.lower_bound("2");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1034,28 +1034,28 @@ namespace
Compare_Data::const_iterator i_compare = compare_data.lower_bound("4"); Compare_Data::const_iterator i_compare = compare_data.lower_bound("4");
Data::const_iterator i_data = data.lower_bound("4"); Data::const_iterator i_data = data.lower_bound("4");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.lower_bound("."); i_compare = compare_data.lower_bound(".");
i_data = data.lower_bound("."); i_data = data.lower_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.lower_bound("A"); i_compare = compare_data.lower_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound("A"); i_data = data.lower_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1067,28 +1067,28 @@ namespace
Compare_Data::iterator i_compare = compare_data.upper_bound("1"); Compare_Data::iterator i_compare = compare_data.upper_bound("1");
Data::iterator i_data = data.upper_bound("1"); Data::iterator i_data = data.upper_bound("1");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1100,28 +1100,28 @@ namespace
Compare_Data::const_iterator i_compare = compare_data.upper_bound("3"); Compare_Data::const_iterator i_compare = compare_data.upper_bound("3");
Data::const_iterator i_data = data.upper_bound("3"); Data::const_iterator i_data = data.upper_bound("3");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
#else #else
i_compare = compare_data.upper_bound("."); i_compare = compare_data.upper_bound(".");
i_data = data.upper_bound("."); i_data = data.upper_bound(".");
CHECK_EQUAL(i_compare->second, i_data->second); CHECK(i_compare->second == i_data->second);
i_compare = compare_data.upper_bound("A"); i_compare = compare_data.upper_bound("A");
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound("A"); i_data = data.upper_bound("A");
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
#endif #endif
} }
@ -1176,14 +1176,14 @@ namespace
std::vector<ETL_OR_STD::pair<std::string, int> > compare_data_elements(compare.begin(), compare.end()); std::vector<ETL_OR_STD::pair<std::string, int> > compare_data_elements(compare.begin(), compare.end());
CHECK(data_elements == compare_data_elements); CHECK(data_elements == compare_data_elements);
CHECK_EQUAL(data_elements.size(), MAX_SIZE); CHECK(data_elements.size() == MAX_SIZE);
for(std::vector<ETL_OR_STD::pair<std::string, int> >::iterator it = tab.begin() ; it != tab.end() ; ++it) for(std::vector<ETL_OR_STD::pair<std::string, int> >::iterator it = tab.begin() ; it != tab.end() ; ++it)
{ {
std::string i = it->first; std::string i = it->first;
//lower_bound //lower_bound
CHECK_EQUAL(compare.lower_bound(i) == compare.end(), data.lower_bound(i) == data.end()); CHECK((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end()));
//if both end, or none //if both end, or none
if((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end())) if((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end()))
{ {
@ -1196,12 +1196,12 @@ namespace
ETL_OR_STD::pair<Compare_Data::const_iterator, Compare_Data::const_iterator> stlret = compare.equal_range(i); ETL_OR_STD::pair<Compare_Data::const_iterator, Compare_Data::const_iterator> stlret = compare.equal_range(i);
ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> etlret = data.equal_range(i); ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> etlret = data.equal_range(i);
CHECK_EQUAL(stlret.first == compare.end(), etlret.first == data.end()); CHECK((stlret.first == compare.end()) == (etlret.first == data.end()));
if((stlret.first != compare.end()) && (etlret.first != data.end())) if((stlret.first != compare.end()) && (etlret.first != data.end()))
{ {
CHECK((*stlret.first) == (*etlret.first)); CHECK((*stlret.first) == (*etlret.first));
} }
CHECK_EQUAL(stlret.second == compare.end(), etlret.second == data.end()); CHECK((stlret.second == compare.end()) == (etlret.second == data.end()));
if((stlret.second != compare.end()) && (etlret.second != data.end())) if((stlret.second != compare.end()) && (etlret.second != data.end()))
{ {
CHECK((*stlret.second) == (*etlret.second)); CHECK((*stlret.second) == (*etlret.second));
@ -1209,7 +1209,7 @@ namespace
} }
//upper_bound //upper_bound
CHECK_EQUAL(compare.upper_bound(i) == compare.end(), data.upper_bound(i) == data.end()); CHECK((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end()));
//if both end, or none //if both end, or none
if((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end())) if((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end()))
{ {

View File

@ -397,8 +397,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -407,8 +407,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -911,15 +911,15 @@ namespace
i_compare = compare_data.find(-1); i_compare = compare_data.find(-1);
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.find(99); i_data = data.find(99);
i_compare = compare_data.find(99); i_compare = compare_data.find(99);
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
} }
//************************************************************************* //*************************************************************************
@ -956,15 +956,15 @@ namespace
i_compare = compare_data.find(-1); i_compare = compare_data.find(-1);
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.find(99); i_data = data.find(99);
i_compare = compare_data.find(99); i_compare = compare_data.find(99);
// Check that both return successful return results // Check that both return successful return results
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
} }
//************************************************************************* //*************************************************************************
@ -1005,14 +1005,14 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound(99); i_compare = compare_data.lower_bound(99);
i_data = data.lower_bound(99); i_data = data.lower_bound(99);
CHECK_EQUAL(*i_compare, *i_data); CHECK(*i_compare == *i_data);
#else #else
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
@ -1038,14 +1038,14 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound(99); i_compare = compare_data.lower_bound(99);
i_data = data.lower_bound(99); i_data = data.lower_bound(99);
CHECK_EQUAL(*i_compare, *i_data); CHECK(*i_compare == *i_data);
#else #else
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
@ -1071,14 +1071,14 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound(-1); i_compare = compare_data.upper_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound(-1); i_data = data.upper_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound(99); i_compare = compare_data.upper_bound(99);
i_data = data.upper_bound(99); i_data = data.upper_bound(99);
CHECK_EQUAL(*i_compare, *i_data); CHECK(*i_compare == *i_data);
#else #else
i_compare = compare_data.upper_bound(-1); i_compare = compare_data.upper_bound(-1);
i_data = data.upper_bound(-1); i_data = data.upper_bound(-1);
@ -1104,14 +1104,14 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound(-1); i_compare = compare_data.upper_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound(-1); i_data = data.upper_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound(99); i_compare = compare_data.upper_bound(99);
i_data = data.upper_bound(99); i_data = data.upper_bound(99);
CHECK_EQUAL(*i_compare, *i_data); CHECK(*i_compare == *i_data);
#else #else
i_compare = compare_data.upper_bound(-1); i_compare = compare_data.upper_bound(-1);
i_data = data.upper_bound(-1); i_data = data.upper_bound(-1);

View File

@ -115,7 +115,7 @@ namespace
hash_t compare = Pearson_Compare(data); hash_t compare = Pearson_Compare(data);
hash_t hash = etl::pearson<HASH_SIZE>(data.begin(), data.end()); hash_t hash = etl::pearson<HASH_SIZE>(data.begin(), data.end());
CHECK_EQUAL(compare, hash); CHECK(compare == hash);
} }
//************************************************************************* //*************************************************************************
@ -133,7 +133,7 @@ namespace
hash_t compare = Pearson_Compare(data); hash_t compare = Pearson_Compare(data);
hash_t hash = pearson_calculator; hash_t hash = pearson_calculator;
CHECK_EQUAL(compare, hash); CHECK(compare == hash);
} }
//************************************************************************* //*************************************************************************
@ -148,7 +148,7 @@ namespace
hash_t compare = Pearson_Compare(data); hash_t compare = Pearson_Compare(data);
hash_t hash = pearson_calculator.value(); hash_t hash = pearson_calculator.value();
CHECK_EQUAL(compare, hash); CHECK(compare == hash);
} }
//************************************************************************* //*************************************************************************
@ -160,10 +160,10 @@ namespace
hash_t hash1 = etl::pearson<HASH_SIZE>(data1.begin(), data1.end()); hash_t hash1 = etl::pearson<HASH_SIZE>(data1.begin(), data1.end());
hash_t hash2 = etl::pearson<HASH_SIZE>((uint8_t*)&data2[0], (uint8_t*)(&data2[0] + data2.size())); hash_t hash2 = etl::pearson<HASH_SIZE>((uint8_t*)&data2[0], (uint8_t*)(&data2[0] + data2.size()));
CHECK_EQUAL(hash1, hash2); CHECK(hash1 == hash2);
hash_t hash3 = etl::pearson<HASH_SIZE>(data3.rbegin(), data3.rend()); hash_t hash3 = etl::pearson<HASH_SIZE>(data3.rbegin(), data3.rend());
CHECK_EQUAL(hash1, hash3); CHECK(hash1 == hash3);
} }
}; };
} }

View File

@ -230,8 +230,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -240,8 +240,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -681,10 +681,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(-1); DataNDC::iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -702,10 +702,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(-1); DataNDC::const_iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -756,12 +756,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(-1); i_data = data.equal_range(-1);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(99); i_data = data.equal_range(99);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -188,8 +188,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -198,8 +198,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -500,7 +500,7 @@ namespace
CHECK_EQUAL(N3, it->second); CHECK_EQUAL(N3, it->second);
it = data.find(19); it = data.find(19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -509,10 +509,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(-1); DataNDC::iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -524,7 +524,7 @@ namespace
CHECK_EQUAL(N3, it->second); CHECK_EQUAL(N3, it->second);
it = data.find(19); it = data.find(19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -533,10 +533,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(-1); DataNDC::const_iterator it = data.find(-1);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(10); it = data.find(10);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -584,12 +584,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(-1); i_data = data.equal_range(-1);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(99); i_data = data.equal_range(99);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -174,8 +174,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -184,8 +184,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -479,7 +479,7 @@ namespace
CHECK_EQUAL(N3, *it); CHECK_EQUAL(N3, *it);
it = data.find(N19); it = data.find(N19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -488,10 +488,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(NX); DataNDC::iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -503,7 +503,7 @@ namespace
CHECK_EQUAL(N3, *it); CHECK_EQUAL(N3, *it);
it = data.find(N19); it = data.find(N19);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -512,10 +512,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(NX); DataNDC::const_iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -563,12 +563,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(NX); i_data = data.equal_range(NX);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(NY); i_data = data.equal_range(NY);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -186,8 +186,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -196,8 +196,8 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
const DataNDC constData(initial_data.begin(), initial_data.end()); const DataNDC constData(initial_data.begin(), initial_data.end());
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -493,10 +493,10 @@ namespace
DataNDC data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::iterator it = data.find(NX); DataNDC::iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -514,10 +514,10 @@ namespace
const DataNDC data(initial_data.begin(), initial_data.end()); const DataNDC data(initial_data.begin(), initial_data.end());
DataNDC::const_iterator it = data.find(NX); DataNDC::const_iterator it = data.find(NX);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
it = data.find(NY); it = data.find(NY);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -565,12 +565,12 @@ namespace
ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data; ETL_OR_STD::pair<DataNDC::iterator, DataNDC::iterator> i_data;
i_data = data.equal_range(NX); i_data = data.equal_range(NX);
CHECK_EQUAL(data.begin(), i_data.first); CHECK(data.begin() == i_data.first);
CHECK_EQUAL(data.begin(), i_data.second); CHECK(data.begin() == i_data.second);
i_data = data.equal_range(NY); i_data = data.equal_range(NY);
CHECK_EQUAL(data.end(), i_data.first); CHECK(data.end() == i_data.first);
CHECK_EQUAL(data.end(), i_data.second); CHECK(data.end() == i_data.second);
} }
//************************************************************************* //*************************************************************************

View File

@ -415,8 +415,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.begin(), std::begin(data)); CHECK(data.begin() == std::begin(data));
CHECK_EQUAL(constData.begin(), std::begin(constData)); CHECK(constData.begin() == std::begin(constData));
} }
//************************************************************************* //*************************************************************************
@ -425,8 +425,8 @@ namespace
Data data(initial_data.begin(), initial_data.end()); Data data(initial_data.begin(), initial_data.end());
const Data constData(data); const Data constData(data);
CHECK_EQUAL(data.end(), std::end(data)); CHECK(data.end() == std::end(data));
CHECK_EQUAL(constData.end(), std::end(constData)); CHECK(constData.end() == std::end(constData));
} }
//************************************************************************* //*************************************************************************
@ -933,7 +933,7 @@ namespace
CHECK_EQUAL(3, *it); CHECK_EQUAL(3, *it);
it = data.find(11); it = data.find(11);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -945,7 +945,7 @@ namespace
CHECK_EQUAL(3, *it); CHECK_EQUAL(3, *it);
it = data.find(11); it = data.find(11);
CHECK_EQUAL(data.end(), it); CHECK(data.end() == it);
} }
//************************************************************************* //*************************************************************************
@ -986,14 +986,14 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound(11); i_compare = compare_data.lower_bound(11);
i_data = data.lower_bound(11); i_data = data.lower_bound(11);
CHECK_EQUAL(*i_compare, *i_data); CHECK(*i_compare == *i_data);
#else #else
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
@ -1019,10 +1019,10 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.lower_bound(-1); i_compare = compare_data.lower_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.lower_bound(-1); i_data = data.lower_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.lower_bound(11); i_compare = compare_data.lower_bound(11);
i_data = data.lower_bound(11); i_data = data.lower_bound(11);
@ -1052,10 +1052,10 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound(-1); i_compare = compare_data.upper_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound(-1); i_data = data.upper_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound(11); i_compare = compare_data.upper_bound(11);
i_data = data.upper_bound(11); i_data = data.upper_bound(11);
@ -1085,10 +1085,10 @@ namespace
#ifdef TEST_GREATER_THAN #ifdef TEST_GREATER_THAN
i_compare = compare_data.upper_bound(-1); i_compare = compare_data.upper_bound(-1);
CHECK_EQUAL(compare_data.end(), i_compare); CHECK(compare_data.end() == i_compare);
i_data = data.upper_bound(-1); i_data = data.upper_bound(-1);
CHECK_EQUAL(data.end(), i_data); CHECK(data.end() == i_data);
i_compare = compare_data.upper_bound(11); i_compare = compare_data.upper_bound(11);
i_data = data.upper_bound(11); i_data = data.upper_bound(11);

View File

@ -67,8 +67,8 @@ namespace
{ {
View view; View view;
CHECK_EQUAL(0U, view.size()); CHECK(0U == view.size());
CHECK_EQUAL(0U, view.max_size()); CHECK(0U == view.max_size());
CHECK(view.empty()); CHECK(view.empty());
} }
@ -77,8 +77,8 @@ namespace
{ {
View view(pctext, pctext + strlen(pctext)); View view(pctext, pctext + strlen(pctext));
CHECK_EQUAL(text.size(), view.size()); CHECK(text.size() == view.size());
CHECK_EQUAL(text.size(), view.max_size()); CHECK(text.size() == view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin()); bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual); CHECK(isEqual);
@ -89,8 +89,8 @@ namespace
{ {
View view(etltext); View view(etltext);
CHECK_EQUAL(etltext.size(), view.size()); CHECK(etltext.size() == view.size());
CHECK_EQUAL(etltext.size(), view.max_size()); CHECK(etltext.size() == view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), etltext.begin()); bool isEqual = std::equal(view.begin(), view.end(), etltext.begin());
CHECK(isEqual); CHECK(isEqual);
@ -101,8 +101,8 @@ namespace
{ {
View view(pctext, strlen(pctext)); View view(pctext, strlen(pctext));
CHECK_EQUAL(text.size(), view.size()); CHECK(text.size() == view.size());
CHECK_EQUAL(text.size(), view.max_size()); CHECK(text.size() == view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin()); bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual); CHECK(isEqual);
@ -113,8 +113,8 @@ namespace
{ {
View view(pctext); View view(pctext);
CHECK_EQUAL(text.size(), view.size()); CHECK(text.size() == view.size());
CHECK_EQUAL(text.size(), view.max_size()); CHECK(text.size() == view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin()); bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual); CHECK(isEqual);
@ -125,8 +125,8 @@ namespace
{ {
View view("Hello World"); View view("Hello World");
CHECK_EQUAL(text.size(), view.size()); CHECK(text.size() == view.size());
CHECK_EQUAL(text.size(), view.max_size()); CHECK(text.size() == view.max_size());
bool isEqual = std::equal(view.begin(), view.end(), text.begin()); bool isEqual = std::equal(view.begin(), view.end(), text.begin());
CHECK(isEqual); CHECK(isEqual);
@ -140,8 +140,8 @@ namespace
view2 = view1; view2 = view1;
CHECK_EQUAL(view1.size(), view2.size()); CHECK(view1.size() == view2.size());
CHECK_EQUAL(view1.max_size(), view2.max_size()); CHECK(view1.max_size() == view2.max_size());
bool isEqual; bool isEqual;
@ -156,8 +156,8 @@ namespace
view.assign(text.c_str(), text.size()); view.assign(text.c_str(), text.size());
CHECK_EQUAL(text.size(), view.size()); CHECK(text.size() == view.size());
CHECK_EQUAL(text.size(), view.max_size()); CHECK(text.size() == view.max_size());
bool isEqual; bool isEqual;
@ -170,10 +170,10 @@ namespace
{ {
View view(text.c_str(), text.size()); View view(text.c_str(), text.size());
CHECK_EQUAL(view.begin(), view.cbegin()); CHECK(view.begin() == view.cbegin());
CHECK_EQUAL(view.rbegin().base(), view.crbegin().base()); CHECK(view.rbegin().base() == view.crbegin().base());
CHECK_EQUAL(view.end(), view.cend()); CHECK(view.end() == view.cend());
CHECK_EQUAL(view.rend().base(), view.crend().base()); CHECK(view.rend().base() == view.crend().base());
} }
//************************************************************************* //*************************************************************************
@ -181,8 +181,8 @@ namespace
{ {
View view(text.c_str(), text.size()); View view(text.c_str(), text.size());
CHECK_EQUAL(text.front(), view.front()); CHECK(text.front() == view.front());
CHECK_EQUAL(text.back(), view.back()); CHECK(text.back() == view.back());
} }
//************************************************************************* //*************************************************************************
@ -190,7 +190,7 @@ namespace
{ {
View view(text.c_str(), text.size()); View view(text.c_str(), text.size());
CHECK_EQUAL(text.data(), view.data()); CHECK(text.data() == view.data());
} }
//************************************************************************* //*************************************************************************
@ -200,7 +200,7 @@ namespace
for (size_t i = 0; i < text.size(); ++i) for (size_t i = 0; i < text.size(); ++i)
{ {
CHECK_EQUAL(text[i], view[i]); CHECK(text[i] == view[i]);
} }
} }
@ -211,7 +211,7 @@ namespace
for (size_t i = 0; i < text.size(); ++i) for (size_t i = 0; i < text.size(); ++i)
{ {
CHECK_EQUAL(text[i], view.at(i)); CHECK(text[i] == view.at(i));
} }
} }
@ -296,8 +296,8 @@ namespace
std::swap(view1, view2); std::swap(view1, view2);
CHECK_EQUAL(text.size(), view1.size()); CHECK(text.size() == view1.size());
CHECK_EQUAL(text_smaller.size(), view2.size()); CHECK(text_smaller.size() == view2.size());
bool isEqual; bool isEqual;
@ -340,35 +340,35 @@ namespace
// Full text. // Full text.
destination.fill(0); destination.fill(0);
count = view.copy(destination.data(), text.size(), 0); count = view.copy(destination.data(), text.size(), 0);
CHECK_EQUAL(text.size(), count); CHECK(text.size() == count);
CHECK_EQUAL(text.size(), strlen(destination.data())); CHECK(text.size() == strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data(), destination.data(), text.size()); CHECK_ARRAY_EQUAL(text.data(), destination.data(), text.size());
// From position 2, count OK. // From position 2, count OK.
destination.fill(0); destination.fill(0);
count = view.copy(destination.data(), text.size() - 2, 2); count = view.copy(destination.data(), text.size() - 2, 2);
CHECK_EQUAL(text.size() - 2, count); CHECK(text.size() - 2 == count);
CHECK_EQUAL(text.size() - 2, strlen(destination.data())); CHECK(text.size() - 2 == strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 2); CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 2);
// From position 2, count too large. // From position 2, count too large.
destination.fill(0); destination.fill(0);
count = view.copy(destination.data(), text.size(), 2); count = view.copy(destination.data(), text.size(), 2);
CHECK_EQUAL(text.size() - 2, count); CHECK(text.size() - 2 == count);
CHECK_EQUAL(text.size() - 2, strlen(destination.data())); CHECK(text.size() - 2 == strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 2); CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 2);
// Position too large. // Position too large.
destination.fill(0); destination.fill(0);
count = view.copy(destination.data(), text.size(), 11); count = view.copy(destination.data(), text.size(), 11);
CHECK_EQUAL(0U, count); CHECK(0U == count);
CHECK_ARRAY_EQUAL(blank.data(), destination.data(), text.size()); CHECK_ARRAY_EQUAL(blank.data(), destination.data(), text.size());
// From position 2, short range. // From position 2, short range.
destination.fill(0); destination.fill(0);
count = view.copy(destination.data(), text.size() - 4, 2); count = view.copy(destination.data(), text.size() - 4, 2);
CHECK_EQUAL(text.size() - 4, count); CHECK(text.size() - 4 == count);
CHECK_EQUAL(text.size() - 4, strlen(destination.data())); CHECK(text.size() - 4 == strlen(destination.data()));
CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 4); CHECK_ARRAY_EQUAL(text.data() + 2, destination.data(), text.size() - 4);
} }
@ -383,19 +383,19 @@ namespace
// Whole string. // Whole string.
sub = view1.substr(0, text.size()); sub = view1.substr(0, text.size());
CHECK_EQUAL(view1, sub); CHECK(view1 == sub);
// From from +2 to -2. // From from +2 to -2.
sub = view1.substr(2, text.size() - 2); sub = view1.substr(2, text.size() - 2);
CHECK_EQUAL(view2, sub); CHECK(view2 == sub);
// Position too large. // Position too large.
sub = view1.substr(text.size(), 2); sub = view1.substr(text.size(), 2);
CHECK_EQUAL(view3, sub); CHECK(view3 == sub);
// Count too large. // Count too large.
sub = view1.substr(2, text.size()); sub = view1.substr(2, text.size());
CHECK_EQUAL(view4, sub); CHECK(view4 == sub);
} }
//************************************************************************* //*************************************************************************
@ -405,11 +405,11 @@ namespace
View view_smaller(text_smaller.c_str()); View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str()); View view_shorter(text_shorter.c_str());
CHECK_EQUAL(0, view.compare(view)); CHECK(0 == view.compare(view));
CHECK_EQUAL(-1, view_smaller.compare(view)); CHECK(-1 == view_smaller.compare(view));
CHECK_EQUAL(-1, view_shorter.compare(view)); CHECK(-1 == view_shorter.compare(view));
CHECK_EQUAL(1, view.compare(view_smaller)); CHECK(1 == view.compare(view_smaller));
CHECK_EQUAL(1, view.compare(view_shorter)); CHECK(1 == view.compare(view_shorter));
} }
//************************************************************************* //*************************************************************************
@ -428,10 +428,10 @@ namespace
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx"); std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str()); View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view)); CHECK(0 == view_long.compare(2, view.size(), view));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view)); CHECK(-1 == view_smaller_long.compare(2, view.size(), view));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller)); CHECK(1 == view_long.compare(2, view.size(), view_smaller));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter)); CHECK(1 == view_long.compare(2, view.size(), view_shorter));
} }
//************************************************************************* //*************************************************************************
@ -448,11 +448,11 @@ namespace
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx"); std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str()); View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view_long, 2, view.size())); CHECK(0 == view_long.compare(2, view.size(), view_long, 2, view.size()));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view_long, 2, view.size())); CHECK(-1 == view_smaller_long.compare(2, view.size(), view_long, 2, view.size()));
CHECK_EQUAL(-1, view_shorter_long.compare(2, text_shorter.size(), view_long, 2, view.size())); CHECK(-1 == view_shorter_long.compare(2, text_shorter.size(), view_long, 2, view.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller_long, 2, view.size())); CHECK(1 == view_long.compare(2, view.size(), view_smaller_long, 2, view.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter_long, 2, text_shorter.size())); CHECK(1 == view_long.compare(2, view.size(), view_shorter_long, 2, text_shorter.size()));
} }
//************************************************************************* //*************************************************************************
@ -462,11 +462,11 @@ namespace
View view_smaller(text_smaller.c_str()); View view_smaller(text_smaller.c_str());
View view_shorter(text_shorter.c_str()); View view_shorter(text_shorter.c_str());
CHECK_EQUAL(0, view.compare(view.data())); CHECK(0 == view.compare(view.data()));
CHECK_EQUAL(-1, view_smaller.compare(view.data())); CHECK(-1 == view_smaller.compare(view.data()));
CHECK_EQUAL(1, view.compare(view_smaller.data())); CHECK(1 == view.compare(view_smaller.data()));
CHECK_EQUAL(-1, view_shorter.compare(view.data())); CHECK(-1 == view_shorter.compare(view.data()));
CHECK_EQUAL(1, view.compare(view_shorter.data())); CHECK(1 == view.compare(view_shorter.data()));
} }
//************************************************************************* //*************************************************************************
@ -485,11 +485,11 @@ namespace
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx"); std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str()); View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view.data())); CHECK(0 == view_long.compare(2, view.size(), view.data()));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view_long.data())); CHECK(-1 == view_smaller_long.compare(2, view.size(), view_long.data()));
CHECK_EQUAL(-1, view_shorter_long.compare(2, text_shorter.size(), view_long.data())); CHECK(-1 == view_shorter_long.compare(2, text_shorter.size(), view_long.data()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller.data())); CHECK(1 == view_long.compare(2, view.size(), view_smaller.data()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter.data())); CHECK(1 == view_long.compare(2, view.size(), view_shorter.data()));
} }
//************************************************************************* //*************************************************************************
@ -508,11 +508,11 @@ namespace
std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx"); std::string text_shorter_long = std::string("xx") + text_shorter + std::string("xx");
View view_shorter_long(text_shorter_long.c_str()); View view_shorter_long(text_shorter_long.c_str());
CHECK_EQUAL(0, view_long.compare(2, view.size(), view.data(), view.size())); CHECK(0 == view_long.compare(2, view.size(), view.data(), view.size()));
CHECK_EQUAL(-1, view_smaller_long.compare(2, view.size(), view_long.data(), view_long.size())); CHECK(-1 == view_smaller_long.compare(2, view.size(), view_long.data(), view_long.size()));
CHECK_EQUAL(-1, view_shorter_long.compare(2, text_shorter.size(), view_long.data(), view_long.size())); CHECK(-1 == view_shorter_long.compare(2, text_shorter.size(), view_long.data(), view_long.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_smaller.data(), view_smaller.size())); CHECK(1 == view_long.compare(2, view.size(), view_smaller.data(), view_smaller.size()));
CHECK_EQUAL(1, view_long.compare(2, view.size(), view_shorter.data(), view_shorter.size())); CHECK(1 == view_long.compare(2, view.size(), view_shorter.data(), view_shorter.size()));
} }
//************************************************************************* //*************************************************************************
@ -571,34 +571,34 @@ namespace
View v4(s4); View v4(s4);
View v5(s5); View v5(s5);
CHECK_EQUAL(0U, view.find(v1)); CHECK(0U == view.find(v1));
CHECK_EQUAL(2U, view.find(v2)); CHECK(2U == view.find(v2));
CHECK_EQUAL(2U, view.find(v2, 2)); CHECK(2U == view.find(v2, 2));
CHECK_EQUAL(6U, view.find(v3)); CHECK(6U == view.find(v3));
CHECK_EQUAL(View::npos, view.find(v3, 7)); CHECK(View::npos == view.find(v3, 7));
CHECK_EQUAL(View::npos, view.find(v4)); CHECK(View::npos == view.find(v4));
CHECK_EQUAL(View::npos, view.find(v5)); CHECK(View::npos == view.find(v5));
CHECK_EQUAL(0U, view.find('H')); CHECK(0U == view.find('H'));
CHECK_EQUAL(2U, view.find('l')); CHECK(2U == view.find('l'));
CHECK_EQUAL(2U, view.find('l', 2)); CHECK(2U == view.find('l', 2));
CHECK_EQUAL(View::npos, view.find('X')); CHECK(View::npos == view.find('X'));
CHECK_EQUAL(0U, view.find(s1)); CHECK(0U == view.find(s1));
CHECK_EQUAL(2U, view.find(s2)); CHECK(2U == view.find(s2));
CHECK_EQUAL(2U, view.find(s2, 2)); CHECK(2U == view.find(s2, 2));
CHECK_EQUAL(6U, view.find(s3)); CHECK(6U == view.find(s3));
CHECK_EQUAL(View::npos, view.find(s3, 7)); CHECK(View::npos == view.find(s3, 7));
CHECK_EQUAL(View::npos, view.find(s4)); CHECK(View::npos == view.find(s4));
CHECK_EQUAL(View::npos, view.find(s5)); CHECK(View::npos == view.find(s5));
CHECK_EQUAL(0U, view.find(s1, 0, 3)); CHECK(0U == view.find(s1, 0, 3));
CHECK_EQUAL(2U, view.find(s2, 0, 3)); CHECK(2U == view.find(s2, 0, 3));
CHECK_EQUAL(2U, view.find(s2, 2, 3)); CHECK(2U == view.find(s2, 2, 3));
CHECK_EQUAL(6U, view.find(s3, 0, 3)); CHECK(6U == view.find(s3, 0, 3));
CHECK_EQUAL(View::npos, view.find(s3, 7, 3)); CHECK(View::npos == view.find(s3, 7, 3));
CHECK_EQUAL(View::npos, view.find(s4, 0, 3)); CHECK(View::npos == view.find(s4, 0, 3));
CHECK_EQUAL(View::npos, view.find(s5, 0, 15)); CHECK(View::npos == view.find(s5, 0, 15));
} }
//************************************************************************* //*************************************************************************
@ -615,22 +615,22 @@ namespace
View v3(s3); View v3(s3);
View v4(s4); View v4(s4);
CHECK_EQUAL(8U, view.rfind(v1)); CHECK(8U == view.rfind(v1));
CHECK_EQUAL(6U, view.rfind(v2)); CHECK(6U == view.rfind(v2));
CHECK_EQUAL(2U, view.rfind(v2, 5)); CHECK(2U == view.rfind(v2, 5));
CHECK_EQUAL(View::npos, view.rfind(v4)); CHECK(View::npos == view.rfind(v4));
CHECK_EQUAL(8U, view.rfind('a')); CHECK(8U == view.rfind('a'));
CHECK_EQUAL(6U, view.rfind('c')); CHECK(6U == view.rfind('c'));
CHECK_EQUAL(2U, view.rfind('c', 5)); CHECK(2U == view.rfind('c', 5));
CHECK_EQUAL(8U, view.rfind(s1)); CHECK(8U == view.rfind(s1));
CHECK_EQUAL(6U, view.rfind(s2)); CHECK(6U == view.rfind(s2));
CHECK_EQUAL(2U, view.rfind(s2, 5)); CHECK(2U == view.rfind(s2, 5));
CHECK_EQUAL(View::npos, view.rfind(s4)); CHECK(View::npos == view.rfind(s4));
CHECK_EQUAL(1U, view.rfind(s3, 5, 2)); CHECK(1U == view.rfind(s3, 5, 2));
CHECK_EQUAL(View::npos, view.rfind(s4, 0, 11)); CHECK(View::npos == view.rfind(s4, 0, 11));
} }
//************************************************************************* //*************************************************************************
@ -649,40 +649,40 @@ namespace
View v4(s4); View v4(s4);
View v5(s5); View v5(s5);
CHECK_EQUAL(2U, view.find_first_of(v1)); CHECK(2U == view.find_first_of(v1));
CHECK_EQUAL(4U, view.find_first_of(v2)); CHECK(4U == view.find_first_of(v2));
CHECK_EQUAL(6U, view.find_first_of(v3)); CHECK(6U == view.find_first_of(v3));
CHECK_EQUAL(2U, view.find_first_of(v4)); CHECK(2U == view.find_first_of(v4));
CHECK_EQUAL(View::npos, view.find_first_of(v5)); CHECK(View::npos == view.find_first_of(v5));
CHECK_EQUAL(3U, view.find_first_of(v1, 3)); CHECK(3U == view.find_first_of(v1, 3));
CHECK_EQUAL(4U, view.find_first_of(v2, 2)); CHECK(4U == view.find_first_of(v2, 2));
CHECK_EQUAL(View::npos, view.find_first_of(v3, 7)); CHECK(View::npos == view.find_first_of(v3, 7));
CHECK_EQUAL(6U, view.find_first_of(v4, 5)); CHECK(6U == view.find_first_of(v4, 5));
CHECK_EQUAL(View::npos, view.find_first_of(v5, 2)); CHECK(View::npos == view.find_first_of(v5, 2));
CHECK_EQUAL(2U, view.find_first_of('l')); CHECK(2U == view.find_first_of('l'));
CHECK_EQUAL(4U, view.find_first_of('o')); CHECK(4U == view.find_first_of('o'));
CHECK_EQUAL(6U, view.find_first_of('W')); CHECK(6U == view.find_first_of('W'));
CHECK_EQUAL(View::npos, view.find_first_of('w')); CHECK(View::npos == view.find_first_of('w'));
CHECK_EQUAL(2U, view.find_first_of(s1)); CHECK(2U == view.find_first_of(s1));
CHECK_EQUAL(4U, view.find_first_of(s2)); CHECK(4U == view.find_first_of(s2));
CHECK_EQUAL(6U, view.find_first_of(s3)); CHECK(6U == view.find_first_of(s3));
CHECK_EQUAL(2U, view.find_first_of(s4)); CHECK(2U == view.find_first_of(s4));
CHECK_EQUAL(View::npos, view.find_first_of(s5)); CHECK(View::npos == view.find_first_of(s5));
CHECK_EQUAL(3U, view.find_first_of(s1, 3)); CHECK(3U == view.find_first_of(s1, 3));
CHECK_EQUAL(4U, view.find_first_of(s2, 2)); CHECK(4U == view.find_first_of(s2, 2));
CHECK_EQUAL(View::npos, view.find_first_of(s3, 7)); CHECK(View::npos == view.find_first_of(s3, 7));
CHECK_EQUAL(6U, view.find_first_of(s4, 5)); CHECK(6U == view.find_first_of(s4, 5));
CHECK_EQUAL(View::npos, view.find_first_of(s5, 2)); CHECK(View::npos == view.find_first_of(s5, 2));
CHECK_EQUAL(3U, view.find_first_of(s1, 3, 1)); CHECK(3U == view.find_first_of(s1, 3, 1));
CHECK_EQUAL(4U, view.find_first_of(s2, 2, 1)); CHECK(4U == view.find_first_of(s2, 2, 1));
CHECK_EQUAL(View::npos, view.find_first_of(s3, 7, 1)); CHECK(View::npos == view.find_first_of(s3, 7, 1));
CHECK_EQUAL(4U, view.find_first_of(s4, 0, 2)); CHECK(4U == view.find_first_of(s4, 0, 2));
CHECK_EQUAL(View::npos, view.find_first_of(s5, 2, 3)); CHECK(View::npos == view.find_first_of(s5, 2, 3));
} }
//************************************************************************* //*************************************************************************
@ -701,40 +701,40 @@ namespace
View v4(s4); View v4(s4);
View v5(s5); View v5(s5);
CHECK_EQUAL(9U, view.find_last_of(v1)); CHECK(9U == view.find_last_of(v1));
CHECK_EQUAL(7U, view.find_last_of(v2)); CHECK(7U == view.find_last_of(v2));
CHECK_EQUAL(6U, view.find_last_of(v3)); CHECK(6U == view.find_last_of(v3));
CHECK_EQUAL(9U, view.find_last_of(v4)); CHECK(9U == view.find_last_of(v4));
CHECK_EQUAL(View::npos, view.find_last_of(v5)); CHECK(View::npos == view.find_last_of(v5));
CHECK_EQUAL(3U, view.find_last_of(v1, 3)); CHECK(3U == view.find_last_of(v1, 3));
CHECK_EQUAL(View::npos, view.find_last_of(v2, 2)); CHECK(View::npos == view.find_last_of(v2, 2));
CHECK_EQUAL(6U, view.find_last_of(v3, 7)); CHECK(6U == view.find_last_of(v3, 7));
CHECK_EQUAL(4U, view.find_last_of(v4, 5)); CHECK(4U == view.find_last_of(v4, 5));
CHECK_EQUAL(View::npos, view.find_last_of(v5, 2)); CHECK(View::npos == view.find_last_of(v5, 2));
CHECK_EQUAL(9U, view.find_last_of('l')); CHECK(9U == view.find_last_of('l'));
CHECK_EQUAL(7U, view.find_last_of('o')); CHECK(7U == view.find_last_of('o'));
CHECK_EQUAL(6U, view.find_last_of('W')); CHECK(6U == view.find_last_of('W'));
CHECK_EQUAL(View::npos, view.find_last_of('w')); CHECK(View::npos == view.find_last_of('w'));
CHECK_EQUAL(9U, view.find_last_of(s1)); CHECK(9U == view.find_last_of(s1));
CHECK_EQUAL(7U, view.find_last_of(s2)); CHECK(7U == view.find_last_of(s2));
CHECK_EQUAL(6U, view.find_last_of(s3)); CHECK(6U == view.find_last_of(s3));
CHECK_EQUAL(9U, view.find_last_of(s4)); CHECK(9U == view.find_last_of(s4));
CHECK_EQUAL(View::npos, view.find_last_of(s5)); CHECK(View::npos == view.find_last_of(s5));
CHECK_EQUAL(3U, view.find_last_of(s1, 3)); CHECK(3U == view.find_last_of(s1, 3));
CHECK_EQUAL(View::npos, view.find_last_of(s2, 2)); CHECK(View::npos == view.find_last_of(s2, 2));
CHECK_EQUAL(6U, view.find_last_of(s3, 7)); CHECK(6U == view.find_last_of(s3, 7));
CHECK_EQUAL(4U, view.find_last_of(s4, 5)); CHECK(4U == view.find_last_of(s4, 5));
CHECK_EQUAL(View::npos, view.find_last_of(s5, 2)); CHECK(View::npos == view.find_last_of(s5, 2));
CHECK_EQUAL(3U, view.find_last_of(s1, 3, 1)); CHECK(3U == view.find_last_of(s1, 3, 1));
CHECK_EQUAL(View::npos, view.find_last_of(s2, 2, 1)); CHECK(View::npos == view.find_last_of(s2, 2, 1));
CHECK_EQUAL(6U, view.find_last_of(s3, 7, 1)); CHECK(6U == view.find_last_of(s3, 7, 1));
CHECK_EQUAL(4U, view.find_last_of(s4, 5, 2)); CHECK(4U == view.find_last_of(s4, 5, 2));
CHECK_EQUAL(View::npos, view.find_last_of(s5, 2, 3)); CHECK(View::npos == view.find_last_of(s5, 2, 3));
} }
//************************************************************************* //*************************************************************************
@ -755,43 +755,43 @@ namespace
View v5(s5); View v5(s5);
View v6(s6); View v6(s6);
CHECK_EQUAL(1U, view.find_first_not_of(v1)); CHECK(1U == view.find_first_not_of(v1));
CHECK_EQUAL(2U, view.find_first_not_of(v2)); CHECK(2U == view.find_first_not_of(v2));
CHECK_EQUAL(4U, view.find_first_not_of(v3)); CHECK(4U == view.find_first_not_of(v3));
CHECK_EQUAL(6U, view.find_first_not_of(v4)); CHECK(6U == view.find_first_not_of(v4));
CHECK_EQUAL(0U, view.find_first_not_of(v5)); CHECK(0U == view.find_first_not_of(v5));
CHECK_EQUAL(View::npos, view.find_first_not_of(v6)); CHECK(View::npos == view.find_first_not_of(v6));
CHECK_EQUAL(3U, view.find_first_not_of(v1, 3)); CHECK(3U == view.find_first_not_of(v1, 3));
CHECK_EQUAL(2U, view.find_first_not_of(v2, 2)); CHECK(2U == view.find_first_not_of(v2, 2));
CHECK_EQUAL(7U, view.find_first_not_of(v3, 7)); CHECK(7U == view.find_first_not_of(v3, 7));
CHECK_EQUAL(6U, view.find_first_not_of(v4, 5)); CHECK(6U == view.find_first_not_of(v4, 5));
CHECK_EQUAL(2U, view.find_first_not_of(v5, 2)); CHECK(2U == view.find_first_not_of(v5, 2));
CHECK_EQUAL(View::npos, view.find_first_not_of(v6, 0)); CHECK(View::npos == view.find_first_not_of(v6, 0));
CHECK_EQUAL(1U, view.find_first_not_of('H')); CHECK(1U == view.find_first_not_of('H'));
CHECK_EQUAL(0U, view.find_first_not_of('e')); CHECK(0U == view.find_first_not_of('e'));
CHECK_EQUAL(1U, view.find_first_not_of(s1)); CHECK(1U == view.find_first_not_of(s1));
CHECK_EQUAL(2U, view.find_first_not_of(s2)); CHECK(2U == view.find_first_not_of(s2));
CHECK_EQUAL(4U, view.find_first_not_of(s3)); CHECK(4U == view.find_first_not_of(s3));
CHECK_EQUAL(6U, view.find_first_not_of(s4)); CHECK(6U == view.find_first_not_of(s4));
CHECK_EQUAL(0U, view.find_first_not_of(s5)); CHECK(0U == view.find_first_not_of(s5));
CHECK_EQUAL(View::npos, view.find_first_not_of(s6)); CHECK(View::npos == view.find_first_not_of(s6));
CHECK_EQUAL(3U, view.find_first_not_of(s1, 3)); CHECK(3U == view.find_first_not_of(s1, 3));
CHECK_EQUAL(2U, view.find_first_not_of(s2, 2)); CHECK(2U == view.find_first_not_of(s2, 2));
CHECK_EQUAL(7U, view.find_first_not_of(s3, 7)); CHECK(7U == view.find_first_not_of(s3, 7));
CHECK_EQUAL(6U, view.find_first_not_of(s4, 5)); CHECK(6U == view.find_first_not_of(s4, 5));
CHECK_EQUAL(2U, view.find_first_not_of(s5, 2)); CHECK(2U == view.find_first_not_of(s5, 2));
CHECK_EQUAL(View::npos, view.find_first_not_of(s6, 0)); CHECK(View::npos == view.find_first_not_of(s6, 0));
CHECK_EQUAL(3U, view.find_first_not_of(s1, 3, 1)); CHECK(3U == view.find_first_not_of(s1, 3, 1));
CHECK_EQUAL(2U, view.find_first_not_of(s2, 2, 1)); CHECK(2U == view.find_first_not_of(s2, 2, 1));
CHECK_EQUAL(7U, view.find_first_not_of(s3, 7, 1)); CHECK(7U == view.find_first_not_of(s3, 7, 1));
CHECK_EQUAL(6U, view.find_first_not_of(s4, 5, 2)); CHECK(6U == view.find_first_not_of(s4, 5, 2));
CHECK_EQUAL(2U, view.find_first_not_of(s5, 2, 3)); CHECK(2U == view.find_first_not_of(s5, 2, 3));
CHECK_EQUAL(View::npos, view.find_first_not_of(s6, 0, 8)); CHECK(View::npos == view.find_first_not_of(s6, 0, 8));
} }
//************************************************************************* //*************************************************************************
@ -812,43 +812,43 @@ namespace
View v5(s5); View v5(s5);
View v6(s6); View v6(s6);
CHECK_EQUAL(9U, view.find_last_not_of(v1)); CHECK(9U == view.find_last_not_of(v1));
CHECK_EQUAL(8U, view.find_last_not_of(v2)); CHECK(8U == view.find_last_not_of(v2));
CHECK_EQUAL(7U, view.find_last_not_of(v3)); CHECK(7U == view.find_last_not_of(v3));
CHECK_EQUAL(5U, view.find_last_not_of(v4)); CHECK(5U == view.find_last_not_of(v4));
CHECK_EQUAL(10U, view.find_last_not_of(v5)); CHECK(10U == view.find_last_not_of(v5));
CHECK_EQUAL(View::npos, view.find_last_not_of(v6)); CHECK(View::npos == view.find_last_not_of(v6));
CHECK_EQUAL(9U, view.find_last_not_of(v1, 10)); CHECK(9U == view.find_last_not_of(v1, 10));
CHECK_EQUAL(8U, view.find_last_not_of(v2, 9)); CHECK(8U == view.find_last_not_of(v2, 9));
CHECK_EQUAL(7U, view.find_last_not_of(v3, 8)); CHECK(7U == view.find_last_not_of(v3, 8));
CHECK_EQUAL(5U, view.find_last_not_of(v4, 8)); CHECK(5U == view.find_last_not_of(v4, 8));
CHECK_EQUAL(8U, view.find_last_not_of(v5, 8)); CHECK(8U == view.find_last_not_of(v5, 8));
CHECK_EQUAL(View::npos, view.find_last_not_of(v6, 10)); CHECK(View::npos == view.find_last_not_of(v6, 10));
CHECK_EQUAL(9U, view.find_last_not_of('d')); CHECK(9U == view.find_last_not_of('d'));
CHECK_EQUAL(10U, view.find_last_not_of('l')); CHECK(10U == view.find_last_not_of('l'));
CHECK_EQUAL(9U, view.find_last_not_of(s1)); CHECK(9U == view.find_last_not_of(s1));
CHECK_EQUAL(8U, view.find_last_not_of(s2)); CHECK(8U == view.find_last_not_of(s2));
CHECK_EQUAL(7U, view.find_last_not_of(s3)); CHECK(7U == view.find_last_not_of(s3));
CHECK_EQUAL(5U, view.find_last_not_of(s4)); CHECK(5U == view.find_last_not_of(s4));
CHECK_EQUAL(10U, view.find_last_not_of(s5)); CHECK(10U == view.find_last_not_of(s5));
CHECK_EQUAL(View::npos, view.find_last_not_of(s6)); CHECK(View::npos == view.find_last_not_of(s6));
CHECK_EQUAL(9U, view.find_last_not_of(s1, 10)); CHECK(9U == view.find_last_not_of(s1, 10));
CHECK_EQUAL(8U, view.find_last_not_of(s2, 9)); CHECK(8U == view.find_last_not_of(s2, 9));
CHECK_EQUAL(7U, view.find_last_not_of(s3, 8)); CHECK(7U == view.find_last_not_of(s3, 8));
CHECK_EQUAL(5U, view.find_last_not_of(s4, 8)); CHECK(5U == view.find_last_not_of(s4, 8));
CHECK_EQUAL(8U, view.find_last_not_of(s5, 8)); CHECK(8U == view.find_last_not_of(s5, 8));
CHECK_EQUAL(View::npos, view.find_last_not_of(s6, 10)); CHECK(View::npos == view.find_last_not_of(s6, 10));
CHECK_EQUAL(9U, view.find_last_not_of(s1, 10, 1)); CHECK(9U == view.find_last_not_of(s1, 10, 1));
CHECK_EQUAL(9U, view.find_last_not_of(s2, 9, 1)); CHECK(9U == view.find_last_not_of(s2, 9, 1));
CHECK_EQUAL(8U, view.find_last_not_of(s3, 9, 2)); CHECK(8U == view.find_last_not_of(s3, 9, 2));
CHECK_EQUAL(7U, view.find_last_not_of(s4, 8, 3)); CHECK(7U == view.find_last_not_of(s4, 8, 3));
CHECK_EQUAL(8U, view.find_last_not_of(s5, 8, 5)); CHECK(8U == view.find_last_not_of(s5, 8, 5));
CHECK_EQUAL(View::npos, view.find_last_not_of(s6, 10, 8)); CHECK(View::npos == view.find_last_not_of(s6, 10, 8));
} }
//************************************************************************* //*************************************************************************
@ -874,10 +874,10 @@ namespace
U16View u16view(u16text.data()); U16View u16view(u16text.data());
U32View u32view(u32text.data()); U32View u32view(u32text.data());
CHECK_EQUAL(etl::hash<Text>()(text), etl::hash<View>()(view)); CHECK(etl::hash<Text>()(text) == etl::hash<View>()(view));
CHECK_EQUAL(etl::hash<WText>()(wtext), etl::hash<WView>()(wview)); CHECK(etl::hash<WText>()(wtext) == etl::hash<WView>()(wview));
CHECK_EQUAL(etl::hash<U16Text>()(u16text), etl::hash<U16View>()(u16view)); CHECK(etl::hash<U16Text>()(u16text) == etl::hash<U16View>()(u16view));
CHECK_EQUAL(etl::hash<U32Text>()(u32text), etl::hash<U32View>()(u32view)); CHECK(etl::hash<U32Text>()(u32text) == etl::hash<U32View>()(u32view));
} }
}; };
} }

View File

@ -60,25 +60,25 @@ namespace
{ {
etl::string<20> str; etl::string<20> str;
CHECK_EQUAL(etl::string<20>(STR("0")), etl::to_string(uint8_t(0), str)); CHECK(etl::string<20>(STR("0")) == etl::to_string(uint8_t(0), str));
CHECK_EQUAL(etl::string<20>(STR("0")), etl::to_string(uint16_t(0), str)); CHECK(etl::string<20>(STR("0")) == etl::to_string(uint16_t(0), str));
CHECK_EQUAL(etl::string<20>(STR("0")), etl::to_string(uint32_t(0), str)); CHECK(etl::string<20>(STR("0")) == etl::to_string(uint32_t(0), str));
CHECK_EQUAL(etl::string<20>(STR("0")), etl::to_string(uint64_t(0), str)); CHECK(etl::string<20>(STR("0")) == etl::to_string(uint64_t(0), str));
CHECK_EQUAL(etl::string<20>(STR("128")), etl::to_string(uint8_t(128), str)); CHECK(etl::string<20>(STR("128")) == etl::to_string(uint8_t(128), str));
CHECK_EQUAL(etl::string<20>(STR("32768")), etl::to_string(uint16_t(32768), str)); CHECK(etl::string<20>(STR("32768")) == etl::to_string(uint16_t(32768), str));
CHECK_EQUAL(etl::string<20>(STR("2147483648")), etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str));
CHECK_EQUAL(etl::string<20>(STR("9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str)); CHECK(etl::string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str));
CHECK_EQUAL(etl::string<20>(STR("127")), etl::to_string(int8_t(127), str)); CHECK(etl::string<20>(STR("127")) == etl::to_string(int8_t(127), str));
CHECK_EQUAL(etl::string<20>(STR("32767")), etl::to_string(int16_t(32767), str)); CHECK(etl::string<20>(STR("32767")) == etl::to_string(int16_t(32767), str));
CHECK_EQUAL(etl::string<20>(STR("2147483647")), etl::to_string(int32_t(2147483647ll), str)); CHECK(etl::string<20>(STR("2147483647")) == etl::to_string(int32_t(2147483647ll), str));
CHECK_EQUAL(etl::string<20>(STR("9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str)); CHECK(etl::string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str));
CHECK_EQUAL(etl::string<20>(STR("-128")), etl::to_string(int8_t(-128), str)); CHECK(etl::string<20>(STR("-128")) == etl::to_string(int8_t(-128), str));
CHECK_EQUAL(etl::string<20>(STR("-32768")), etl::to_string(int16_t(-32768), str)); CHECK(etl::string<20>(STR("-32768")) == etl::to_string(int16_t(-32768), str));
CHECK_EQUAL(etl::string<20>(STR("-2147483648")), etl::to_string(int32_t(-2147483648ll), str)); CHECK(etl::string<20>(STR("-2147483648")) == etl::to_string(int32_t(-2147483648ll), str));
CHECK_EQUAL(etl::string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str)); CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str));
} }
//************************************************************************* //*************************************************************************
@ -86,25 +86,25 @@ namespace
{ {
etl::string<120> str; etl::string<120> str;
CHECK_EQUAL(etl::string<120>(STR("0")), etl::to_string(uint8_t(0), str, true)); CHECK(etl::string<120>(STR("0")) == etl::to_string(uint8_t(0), str, true));
CHECK_EQUAL(etl::string<120>(STR("00")), etl::to_string(uint16_t(0), str, true)); CHECK(etl::string<120>(STR("00")) == etl::to_string(uint16_t(0), str, true));
CHECK_EQUAL(etl::string<120>(STR("000")), etl::to_string(uint32_t(0), str, true)); CHECK(etl::string<120>(STR("000")) == etl::to_string(uint32_t(0), str, true));
CHECK_EQUAL(etl::string<120>(STR("0000")), etl::to_string(uint64_t(0), str, true)); CHECK(etl::string<120>(STR("0000")) == etl::to_string(uint64_t(0), str, true));
CHECK_EQUAL(etl::string<120>(STR("0000128")), etl::to_string(uint8_t(128), str, true)); CHECK(etl::string<120>(STR("0000128")) == etl::to_string(uint8_t(128), str, true));
CHECK_EQUAL(etl::string<120>(STR("000012832768")), etl::to_string(uint16_t(32768), str, true)); CHECK(etl::string<120>(STR("000012832768")) == etl::to_string(uint16_t(32768), str, true));
CHECK_EQUAL(etl::string<120>(STR("0000128327682147483648")), etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true));
CHECK_EQUAL(etl::string<120>(STR("00001283276821474836489223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, true)); CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true));
CHECK_EQUAL(etl::string<120>(STR("00001283276821474836489223372036854775808127")), etl::to_string(int8_t(127), str, true)); CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(127), str, true));
CHECK_EQUAL(etl::string<120>(STR("0000128327682147483648922337203685477580812732767")), etl::to_string(int16_t(32767), str, true)); CHECK(etl::string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(32767), str, true));
CHECK_EQUAL(etl::string<120>(STR("00001283276821474836489223372036854775808127327672147483647")), etl::to_string(int32_t(2147483647ll), str, true)); CHECK(etl::string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(2147483647ll), str, true));
CHECK_EQUAL(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, true)); CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, true));
CHECK_EQUAL(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")), etl::to_string(int8_t(-128), str, true)); CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(-128), str, true));
CHECK_EQUAL(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")), etl::to_string(int16_t(-32768), str, true)); CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(-32768), str, true));
CHECK_EQUAL(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")), etl::to_string(int32_t(-2147483648ll), str, true)); CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, true));
CHECK_EQUAL(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, true)); CHECK(etl::string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, true));
} }
//************************************************************************* //*************************************************************************
@ -116,25 +116,25 @@ namespace
etl::to_string(uint8_t(0), str, format); etl::to_string(uint8_t(0), str, format);
CHECK_EQUAL(etl::string<20>(STR("###################0")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::string<20>(STR("###################0")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("###################0")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::string<20>(STR("###################0")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("###################0")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::string<20>(STR("###################0")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("###################0")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::string<20>(STR("###################0")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("#################128")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::string<20>(STR("#################128")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::string<20>(STR("###############32768")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::string<20>(STR("###############32768")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::string<20>(STR("##########2147483648")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::string<20>(STR("#9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::string<20>(STR("#################127")), etl::to_string(int8_t(127), str, format)); CHECK(etl::string<20>(STR("#################127")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::string<20>(STR("###############32767")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::string<20>(STR("###############32767")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::string<20>(STR("##########2147483647")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::string<20>(STR("##########2147483647")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::string<20>(STR("#9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::string<20>(STR("################-128")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::string<20>(STR("################-128")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::string<20>(STR("##############-32768")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::string<20>(STR("##############-32768")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::string<20>(STR("#########-2147483648")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -144,25 +144,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')).left(); Format format = Format().base(10).width(20).fill(STR('#')).left();
CHECK_EQUAL(etl::string<20>(STR("0###################")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::string<20>(STR("0###################")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("0###################")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::string<20>(STR("0###################")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("0###################")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::string<20>(STR("0###################")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("0###################")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::string<20>(STR("0###################")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::string<20>(STR("128#################")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::string<20>(STR("128#################")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::string<20>(STR("32768###############")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::string<20>(STR("32768###############")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::string<20>(STR("2147483648##########")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::string<20>(STR("9223372036854775808#")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::string<20>(STR("127#################")), etl::to_string(int8_t(127), str, format)); CHECK(etl::string<20>(STR("127#################")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::string<20>(STR("32767###############")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::string<20>(STR("32767###############")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::string<20>(STR("2147483647##########")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::string<20>(STR("2147483647##########")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::string<20>(STR("9223372036854775807#")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::string<20>(STR("-128################")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::string<20>(STR("-128################")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::string<20>(STR("-32768##############")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::string<20>(STR("-32768##############")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::string<20>(STR("-2147483648#########")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -170,25 +170,25 @@ namespace
{ {
etl::string<64> str; etl::string<64> str;
CHECK_EQUAL(etl::string<64>(STR("00000000")), etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::string<64>(STR("00000000")) == etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("0000000000000000")), etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::string<64>(STR("0000000000000000")) == etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("00000000000000000000000000000000")), etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::string<64>(STR("00000000000000000000000000000000")) == etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("10000000")), etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::string<64>(STR("10000000")) == etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("1000000000000000")), etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::string<64>(STR("1000000000000000")) == etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("10000000000000000000000000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("01111111")), etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::string<64>(STR("01111111")) == etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("0111111111111111")), etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::string<64>(STR("0111111111111111")) == etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("01111111111111111111111111111111")), etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("10000000")), etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::string<64>(STR("10000000")) == etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("1000000000000000")), etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::string<64>(STR("1000000000000000")) == etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("10000000000000000000000000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -196,25 +196,25 @@ namespace
{ {
etl::string<22> str; etl::string<22> str;
CHECK_EQUAL(etl::string<22>(STR("000")), etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::string<22>(STR("000")) == etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("000000")), etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::string<22>(STR("000000")) == etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("00000000000")), etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::string<22>(STR("00000000000")) == etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("0000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::string<22>(STR("0000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("200")), etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::string<22>(STR("200")) == etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("100000")), etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::string<22>(STR("100000")) == etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("20000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("1000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("177")), etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::string<22>(STR("177")) == etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("077777")), etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::string<22>(STR("077777")) == etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("17777777777")), etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::string<22>(STR("17777777777")) == etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("0777777777777777777777")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("200")), etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::string<22>(STR("200")) == etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("100000")), etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::string<22>(STR("100000")) == etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("20000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::string<22>(STR("20000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::string<22>(STR("1000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -222,25 +222,25 @@ namespace
{ {
etl::string<16> str; etl::string<16> str;
CHECK_EQUAL(etl::string<16>(STR("00")), etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::string<16>(STR("00")) == etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("0000")), etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::string<16>(STR("0000")) == etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("00000000")), etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::string<16>(STR("00000000")) == etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("0000000000000000")), etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::string<16>(STR("0000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("80")), etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::string<16>(STR("80")) == etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("8000")), etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::string<16>(STR("8000")) == etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("80000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("8000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("7f")), etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::string<16>(STR("7f")) == etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("7fff")), etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::string<16>(STR("7fff")) == etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("7fffffff")), etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::string<16>(STR("7fffffff")) == etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("7fffffffffffffff")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("80")), etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::string<16>(STR("80")) == etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("8000")), etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::string<16>(STR("8000")) == etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("80000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::string<16>(STR("80000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::string<16>(STR("8000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::string<16>(STR("8000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -248,10 +248,10 @@ namespace
{ {
etl::string<17> str; etl::string<17> str;
CHECK_EQUAL(etl::string<17>(STR("11110001001000000")), etl::to_string(123456, str, Format().binary())); CHECK(etl::string<17>(STR("11110001001000000")) == etl::to_string(123456, str, Format().binary()));
CHECK_EQUAL(etl::string<17>(STR("361100")), etl::to_string(123456, str, Format().octal())); CHECK(etl::string<17>(STR("361100")) == etl::to_string(123456, str, Format().octal()));
CHECK_EQUAL(etl::string<17>(STR("123456")), etl::to_string(123456, str, Format().decimal())); CHECK(etl::string<17>(STR("123456")) == etl::to_string(123456, str, Format().decimal()));
CHECK_EQUAL(etl::string<17>(STR("1e240")), etl::to_string(123456, str, Format().hex())); CHECK(etl::string<17>(STR("1e240")) == etl::to_string(123456, str, Format().hex()));
} }
//************************************************************************* //*************************************************************************
@ -259,23 +259,23 @@ namespace
{ {
etl::string<20> str; etl::string<20> str;
CHECK_EQUAL(etl::string<20>(STR(" 0.000000")), etl::to_string(0.0, str, Format().precision(6).width(10).right())); CHECK(etl::string<20>(STR(" 0.000000")) == etl::to_string(0.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::string<20>(STR("0.000000 ")), etl::to_string(0.0, str, Format().precision(6).width(10).left())); CHECK(etl::string<20>(STR("0.000000 ")) == etl::to_string(0.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::string<20>(STR(" 0.000001")), etl::to_string(0.000001, str, Format().precision(6).width(10).right())); CHECK(etl::string<20>(STR(" 0.000001")) == etl::to_string(0.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::string<20>(STR("0.000001 ")), etl::to_string(0.000001, str, Format().precision(6).width(10).left())); CHECK(etl::string<20>(STR("0.000001 ")) == etl::to_string(0.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::string<20>(STR(" 1.000000")), etl::to_string(1.0, str, Format().precision(6).width(10).right())); CHECK(etl::string<20>(STR(" 1.000000")) == etl::to_string(1.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::string<20>(STR("1.000000 ")), etl::to_string(1.0, str, Format().precision(6).width(10).left())); CHECK(etl::string<20>(STR("1.000000 ")) == etl::to_string(1.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::string<20>(STR(" 1.000001")), etl::to_string(1.000001, str, Format().precision(6).width(10).right())); CHECK(etl::string<20>(STR(" 1.000001")) == etl::to_string(1.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::string<20>(STR("1.000001 ")), etl::to_string(1.000001, str, Format().precision(6).width(10).left())); CHECK(etl::string<20>(STR("1.000001 ")) == etl::to_string(1.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::string<20>(STR(" 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right())); CHECK(etl::string<20>(STR(" 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::string<20>(STR("12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left())); CHECK(etl::string<20>(STR("12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::string<20>(STR(" -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right())); CHECK(etl::string<20>(STR(" -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right()));
CHECK_EQUAL(etl::string<20>(STR("-12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left())); CHECK(etl::string<20>(STR("-12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left()));
} }
//************************************************************************* //*************************************************************************
@ -284,16 +284,16 @@ namespace
etl::string<20> str; etl::string<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true)); CHECK(etl::string<20>(STR("Result 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result 12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true)); CHECK(etl::string<20>(STR("Result 12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true)); CHECK(etl::string<20>(STR("Result -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result -12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true)); CHECK(etl::string<20>(STR("Result -12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true));
} }
//************************************************************************* //*************************************************************************
@ -301,16 +301,16 @@ namespace
{ {
etl::string<20> str; etl::string<20> str;
CHECK_EQUAL(etl::string<20>(STR("0.00001")), etl::to_string(0.000009, str, Format().precision(5).width(7).right())); CHECK(etl::string<20>(STR("0.00001")) == etl::to_string(0.000009, str, Format().precision(5).width(7).right()));
CHECK_EQUAL(etl::string<20>(STR("0.0001")), etl::to_string(0.000099, str, Format().precision(4).width(6).right())); CHECK(etl::string<20>(STR("0.0001")) == etl::to_string(0.000099, str, Format().precision(4).width(6).right()));
CHECK_EQUAL(etl::string<20>(STR("0.001")), etl::to_string(0.000999, str, Format().precision(3).width(5).right())); CHECK(etl::string<20>(STR("0.001")) == etl::to_string(0.000999, str, Format().precision(3).width(5).right()));
CHECK_EQUAL(etl::string<20>(STR("0.01")), etl::to_string(0.009999, str, Format().precision(2).width(4).right())); CHECK(etl::string<20>(STR("0.01")) == etl::to_string(0.009999, str, Format().precision(2).width(4).right()));
CHECK_EQUAL(etl::string<20>(STR("0.1")), etl::to_string(0.099999, str, Format().precision(1).width(3).right())); CHECK(etl::string<20>(STR("0.1")) == etl::to_string(0.099999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::string<20>(STR("1.0")), etl::to_string(0.999999, str, Format().precision(1).width(3).right())); CHECK(etl::string<20>(STR("1.0")) == etl::to_string(0.999999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::string<20>(STR("1")), etl::to_string(0.999999, str, Format().precision(0).width(1).right())); CHECK(etl::string<20>(STR("1")) == etl::to_string(0.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::string<20>(STR("2")), etl::to_string(1.999999, str, Format().precision(0).width(1).right())); CHECK(etl::string<20>(STR("2")) == etl::to_string(1.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::string<20>(STR("10.0")), etl::to_string(9.999999, str, Format().precision(1).width(4).right())); CHECK(etl::string<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right()));
CHECK_EQUAL(etl::string<20>(STR("20.0")), etl::to_string(19.999999, str, Format().precision(1).width(4).right())); CHECK(etl::string<20>(STR("20.0")) == etl::to_string(19.999999, str, Format().precision(1).width(4).right()));
} }
//************************************************************************* //*************************************************************************
@ -318,15 +318,15 @@ namespace
{ {
etl::string<20> str; etl::string<20> str;
CHECK_EQUAL(etl::string<20>(STR(" 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::string<20>(STR(" 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::string<20>(STR(" 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::string<20>(STR(" 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::string<20>(STR("0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::string<20>(STR("0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::string<20>(STR("1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::string<20>(STR("1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::string<20>(STR(" false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::string<20>(STR(" false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::string<20>(STR(" true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::string<20>(STR(" true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::string<20>(STR("false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::string<20>(STR("false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true)));
CHECK_EQUAL(etl::string<20>(STR("true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::string<20>(STR("true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true)));
} }
//************************************************************************* //*************************************************************************
@ -335,28 +335,28 @@ namespace
etl::string<20> str; etl::string<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::string<20>(STR("Result 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::string<20>(STR("Result 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result 0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::string<20>(STR("Result 0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result 1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::string<20>(STR("Result 1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::string<20>(STR("Result false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::string<20>(STR("Result true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::string<20>(STR("Result false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::string<20>(STR("Result true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::string<20>(STR("Result true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
} }
//************************************************************************* //*************************************************************************
@ -374,7 +374,7 @@ namespace
etl::string<20> compare(temp.begin(), temp.end()); etl::string<20> compare(temp.begin(), temp.end());
to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0'))); to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0')));
CHECK_EQUAL(compare, str); CHECK(compare == str);
oss.clear(); oss.clear();
oss.str(STR("")); oss.str(STR(""));
@ -385,7 +385,7 @@ namespace
compare.assign(temp.begin(), temp.end()); compare.assign(temp.begin(), temp.end());
to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0'))); to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')));
CHECK_EQUAL(compare, str); CHECK(compare == str);
} }
//************************************************************************* //*************************************************************************
@ -405,7 +405,7 @@ namespace
str.assign(STR("Result ")); str.assign(STR("Result "));
to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0')), true); to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0')), true);
CHECK_EQUAL(compare, str); CHECK(compare == str);
oss.clear(); oss.clear();
oss.str(STR("")); oss.str(STR(""));
@ -418,7 +418,7 @@ namespace
str.assign(STR("Result ")); str.assign(STR("Result "));
to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')), true); to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')), true);
CHECK_EQUAL(compare, str); CHECK(compare == str);
} }
}; };
} }

View File

@ -56,25 +56,25 @@ namespace
{ {
etl::u16string<20> str; etl::u16string<20> str;
CHECK_EQUAL(etl::u16string<20>(STR("0")), etl::to_string(uint8_t(0), str)); CHECK(etl::u16string<20>(STR("0")) == etl::to_string(uint8_t(0), str));
CHECK_EQUAL(etl::u16string<20>(STR("0")), etl::to_string(uint16_t(0), str)); CHECK(etl::u16string<20>(STR("0")) == etl::to_string(uint16_t(0), str));
CHECK_EQUAL(etl::u16string<20>(STR("0")), etl::to_string(uint32_t(0), str)); CHECK(etl::u16string<20>(STR("0")) == etl::to_string(uint32_t(0), str));
CHECK_EQUAL(etl::u16string<20>(STR("0")), etl::to_string(uint64_t(0), str)); CHECK(etl::u16string<20>(STR("0")) == etl::to_string(uint64_t(0), str));
CHECK_EQUAL(etl::u16string<20>(STR("128")), etl::to_string(uint8_t(128), str)); CHECK(etl::u16string<20>(STR("128")) == etl::to_string(uint8_t(128), str));
CHECK_EQUAL(etl::u16string<20>(STR("32768")), etl::to_string(uint16_t(32768), str)); CHECK(etl::u16string<20>(STR("32768")) == etl::to_string(uint16_t(32768), str));
CHECK_EQUAL(etl::u16string<20>(STR("2147483648")), etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::u16string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str));
CHECK_EQUAL(etl::u16string<20>(STR("9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str)); CHECK(etl::u16string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str));
CHECK_EQUAL(etl::u16string<20>(STR("127")), etl::to_string(int8_t(127), str)); CHECK(etl::u16string<20>(STR("127")) == etl::to_string(int8_t(127), str));
CHECK_EQUAL(etl::u16string<20>(STR("32767")), etl::to_string(int16_t(32767), str)); CHECK(etl::u16string<20>(STR("32767")) == etl::to_string(int16_t(32767), str));
CHECK_EQUAL(etl::u16string<20>(STR("2147483647")), etl::to_string(int32_t(2147483647ll), str)); CHECK(etl::u16string<20>(STR("2147483647")) == etl::to_string(int32_t(2147483647ll), str));
CHECK_EQUAL(etl::u16string<20>(STR("9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str)); CHECK(etl::u16string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str));
CHECK_EQUAL(etl::u16string<20>(STR("-128")), etl::to_string(int8_t(-128), str)); CHECK(etl::u16string<20>(STR("-128")) == etl::to_string(int8_t(-128), str));
CHECK_EQUAL(etl::u16string<20>(STR("-32768")), etl::to_string(int16_t(-32768), str)); CHECK(etl::u16string<20>(STR("-32768")) == etl::to_string(int16_t(-32768), str));
CHECK_EQUAL(etl::u16string<20>(STR("-2147483648")), etl::to_string(int32_t(-2147483648ll), str)); CHECK(etl::u16string<20>(STR("-2147483648")) == etl::to_string(int32_t(-2147483648ll), str));
CHECK_EQUAL(etl::u16string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str)); CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str));
} }
//************************************************************************* //*************************************************************************
@ -82,25 +82,25 @@ namespace
{ {
etl::u16string<120> str; etl::u16string<120> str;
CHECK_EQUAL(etl::u16string<120>(STR("0")), etl::to_string(uint8_t(0), str, true)); CHECK(etl::u16string<120>(STR("0")) == etl::to_string(uint8_t(0), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("00")), etl::to_string(uint16_t(0), str, true)); CHECK(etl::u16string<120>(STR("00")) == etl::to_string(uint16_t(0), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000")), etl::to_string(uint32_t(0), str, true)); CHECK(etl::u16string<120>(STR("000")) == etl::to_string(uint32_t(0), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("0000")), etl::to_string(uint64_t(0), str, true)); CHECK(etl::u16string<120>(STR("0000")) == etl::to_string(uint64_t(0), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("0000128")), etl::to_string(uint8_t(128), str, true)); CHECK(etl::u16string<120>(STR("0000128")) == etl::to_string(uint8_t(128), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000012832768")), etl::to_string(uint16_t(32768), str, true)); CHECK(etl::u16string<120>(STR("000012832768")) == etl::to_string(uint16_t(32768), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("0000128327682147483648")), etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::u16string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("00001283276821474836489223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, true)); CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("00001283276821474836489223372036854775808127")), etl::to_string(int8_t(127), str, true)); CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(127), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("0000128327682147483648922337203685477580812732767")), etl::to_string(int16_t(32767), str, true)); CHECK(etl::u16string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(32767), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("00001283276821474836489223372036854775808127327672147483647")), etl::to_string(int32_t(2147483647ll), str, true)); CHECK(etl::u16string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(2147483647ll), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, true)); CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")), etl::to_string(int8_t(-128), str, true)); CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(-128), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")), etl::to_string(int16_t(-32768), str, true)); CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(-32768), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")), etl::to_string(int32_t(-2147483648ll), str, true)); CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, true));
CHECK_EQUAL(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, true)); CHECK(etl::u16string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, true));
} }
//************************************************************************* //*************************************************************************
@ -110,25 +110,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')); Format format = Format().base(10).width(20).fill(STR('#'));
CHECK_EQUAL(etl::u16string<20>(STR("###################0")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::u16string<20>(STR("###################0")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("###################0")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::u16string<20>(STR("###################0")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("###################0")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::u16string<20>(STR("###################0")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("###################0")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::u16string<20>(STR("###################0")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("#################128")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::u16string<20>(STR("#################128")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("###############32768")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::u16string<20>(STR("###############32768")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("##########2147483648")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u16string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("#9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::u16string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("#################127")), etl::to_string(int8_t(127), str, format)); CHECK(etl::u16string<20>(STR("#################127")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("###############32767")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::u16string<20>(STR("###############32767")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("##########2147483647")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::u16string<20>(STR("##########2147483647")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("#9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::u16string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("################-128")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::u16string<20>(STR("################-128")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("##############-32768")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::u16string<20>(STR("##############-32768")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("#########-2147483648")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::u16string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -138,25 +138,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')).left(); Format format = Format().base(10).width(20).fill(STR('#')).left();
CHECK_EQUAL(etl::u16string<20>(STR("0###################")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::u16string<20>(STR("0###################")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("0###################")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::u16string<20>(STR("0###################")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("0###################")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::u16string<20>(STR("0###################")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("0###################")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::u16string<20>(STR("0###################")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("128#################")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::u16string<20>(STR("128#################")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("32768###############")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::u16string<20>(STR("32768###############")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("2147483648##########")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u16string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("9223372036854775808#")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::u16string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("127#################")), etl::to_string(int8_t(127), str, format)); CHECK(etl::u16string<20>(STR("127#################")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("32767###############")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::u16string<20>(STR("32767###############")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("2147483647##########")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::u16string<20>(STR("2147483647##########")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("9223372036854775807#")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::u16string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("-128################")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::u16string<20>(STR("-128################")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("-32768##############")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::u16string<20>(STR("-32768##############")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("-2147483648#########")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::u16string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::u16string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::u16string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -164,25 +164,25 @@ namespace
{ {
etl::u16string<64> str; etl::u16string<64> str;
CHECK_EQUAL(etl::u16string<64>(STR("00000000")), etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u16string<64>(STR("00000000")) == etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("0000000000000000")), etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u16string<64>(STR("0000000000000000")) == etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("00000000000000000000000000000000")), etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u16string<64>(STR("00000000000000000000000000000000")) == etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u16string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("10000000")), etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u16string<64>(STR("10000000")) == etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("1000000000000000")), etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u16string<64>(STR("1000000000000000")) == etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("10000000000000000000000000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u16string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("01111111")), etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u16string<64>(STR("01111111")) == etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("0111111111111111")), etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u16string<64>(STR("0111111111111111")) == etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("01111111111111111111111111111111")), etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u16string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u16string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("10000000")), etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u16string<64>(STR("10000000")) == etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("1000000000000000")), etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u16string<64>(STR("1000000000000000")) == etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("10000000000000000000000000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u16string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u16string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -190,25 +190,25 @@ namespace
{ {
etl::u16string<22> str; etl::u16string<22> str;
CHECK_EQUAL(etl::u16string<22>(STR("000")), etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u16string<22>(STR("000")) == etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("000000")), etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u16string<22>(STR("000000")) == etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("00000000000")), etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u16string<22>(STR("00000000000")) == etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("0000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u16string<22>(STR("0000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("200")), etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u16string<22>(STR("200")) == etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("100000")), etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u16string<22>(STR("100000")) == etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("20000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u16string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("1000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u16string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("177")), etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u16string<22>(STR("177")) == etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("077777")), etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u16string<22>(STR("077777")) == etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("17777777777")), etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u16string<22>(STR("17777777777")) == etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("0777777777777777777777")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u16string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("200")), etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u16string<22>(STR("200")) == etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("100000")), etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u16string<22>(STR("100000")) == etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("20000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u16string<22>(STR("20000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<22>(STR("1000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u16string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -216,25 +216,25 @@ namespace
{ {
etl::u16string<16> str; etl::u16string<16> str;
CHECK_EQUAL(etl::u16string<16>(STR("00")), etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u16string<16>(STR("00")) == etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("0000")), etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u16string<16>(STR("0000")) == etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("00000000")), etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u16string<16>(STR("00000000")) == etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("0000000000000000")), etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u16string<16>(STR("0000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("80")), etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u16string<16>(STR("80")) == etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("8000")), etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u16string<16>(STR("8000")) == etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("80000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u16string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("8000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u16string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("7f")), etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u16string<16>(STR("7f")) == etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("7fff")), etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u16string<16>(STR("7fff")) == etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("7fffffff")), etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u16string<16>(STR("7fffffff")) == etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("7fffffffffffffff")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u16string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("80")), etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u16string<16>(STR("80")) == etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("8000")), etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u16string<16>(STR("8000")) == etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("80000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u16string<16>(STR("80000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u16string<16>(STR("8000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u16string<16>(STR("8000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -242,10 +242,10 @@ namespace
{ {
etl::u16string<17> str; etl::u16string<17> str;
CHECK_EQUAL(etl::u16string<17>(STR("11110001001000000")), etl::to_string(123456, str, Format().binary())); CHECK(etl::u16string<17>(STR("11110001001000000")) == etl::to_string(123456, str, Format().binary()));
CHECK_EQUAL(etl::u16string<17>(STR("361100")), etl::to_string(123456, str, Format().octal())); CHECK(etl::u16string<17>(STR("361100")) == etl::to_string(123456, str, Format().octal()));
CHECK_EQUAL(etl::u16string<17>(STR("123456")), etl::to_string(123456, str, Format().decimal())); CHECK(etl::u16string<17>(STR("123456")) == etl::to_string(123456, str, Format().decimal()));
CHECK_EQUAL(etl::u16string<17>(STR("1e240")), etl::to_string(123456, str, Format().hex())); CHECK(etl::u16string<17>(STR("1e240")) == etl::to_string(123456, str, Format().hex()));
} }
//************************************************************************* //*************************************************************************
@ -253,23 +253,23 @@ namespace
{ {
etl::u16string<20> str; etl::u16string<20> str;
CHECK_EQUAL(etl::u16string<20>(STR(" 0.000000")), etl::to_string(0.0, str, Format().precision(6).width(10).right())); CHECK(etl::u16string<20>(STR(" 0.000000")) == etl::to_string(0.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u16string<20>(STR("0.000000 ")), etl::to_string(0.0, str, Format().precision(6).width(10).left())); CHECK(etl::u16string<20>(STR("0.000000 ")) == etl::to_string(0.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u16string<20>(STR(" 0.000001")), etl::to_string(0.000001, str, Format().precision(6).width(10).right())); CHECK(etl::u16string<20>(STR(" 0.000001")) == etl::to_string(0.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u16string<20>(STR("0.000001 ")), etl::to_string(0.000001, str, Format().precision(6).width(10).left())); CHECK(etl::u16string<20>(STR("0.000001 ")) == etl::to_string(0.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u16string<20>(STR(" 1.000000")), etl::to_string(1.0, str, Format().precision(6).width(10).right())); CHECK(etl::u16string<20>(STR(" 1.000000")) == etl::to_string(1.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u16string<20>(STR("1.000000 ")), etl::to_string(1.0, str, Format().precision(6).width(10).left())); CHECK(etl::u16string<20>(STR("1.000000 ")) == etl::to_string(1.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u16string<20>(STR(" 1.000001")), etl::to_string(1.000001, str, Format().precision(6).width(10).right())); CHECK(etl::u16string<20>(STR(" 1.000001")) == etl::to_string(1.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u16string<20>(STR("1.000001 ")), etl::to_string(1.000001, str, Format().precision(6).width(10).left())); CHECK(etl::u16string<20>(STR("1.000001 ")) == etl::to_string(1.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u16string<20>(STR(" 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right())); CHECK(etl::u16string<20>(STR(" 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u16string<20>(STR("12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left())); CHECK(etl::u16string<20>(STR("12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u16string<20>(STR(" -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right())); CHECK(etl::u16string<20>(STR(" -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right()));
CHECK_EQUAL(etl::u16string<20>(STR("-12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left())); CHECK(etl::u16string<20>(STR("-12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left()));
} }
//************************************************************************* //*************************************************************************
@ -278,16 +278,16 @@ namespace
etl::u16string<20> str; etl::u16string<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true)); CHECK(etl::u16string<20>(STR("Result 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result 12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true)); CHECK(etl::u16string<20>(STR("Result 12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true)); CHECK(etl::u16string<20>(STR("Result -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result -12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true)); CHECK(etl::u16string<20>(STR("Result -12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true));
} }
//************************************************************************* //*************************************************************************
@ -295,16 +295,16 @@ namespace
{ {
etl::u16string<20> str; etl::u16string<20> str;
CHECK_EQUAL(etl::u16string<20>(STR("0.00001")), etl::to_string(0.000009, str, Format().precision(5).width(7).right())); CHECK(etl::u16string<20>(STR("0.00001")) == etl::to_string(0.000009, str, Format().precision(5).width(7).right()));
CHECK_EQUAL(etl::u16string<20>(STR("0.0001")), etl::to_string(0.000099, str, Format().precision(4).width(6).right())); CHECK(etl::u16string<20>(STR("0.0001")) == etl::to_string(0.000099, str, Format().precision(4).width(6).right()));
CHECK_EQUAL(etl::u16string<20>(STR("0.001")), etl::to_string(0.000999, str, Format().precision(3).width(5).right())); CHECK(etl::u16string<20>(STR("0.001")) == etl::to_string(0.000999, str, Format().precision(3).width(5).right()));
CHECK_EQUAL(etl::u16string<20>(STR("0.01")), etl::to_string(0.009999, str, Format().precision(2).width(4).right())); CHECK(etl::u16string<20>(STR("0.01")) == etl::to_string(0.009999, str, Format().precision(2).width(4).right()));
CHECK_EQUAL(etl::u16string<20>(STR("0.1")), etl::to_string(0.099999, str, Format().precision(1).width(3).right())); CHECK(etl::u16string<20>(STR("0.1")) == etl::to_string(0.099999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::u16string<20>(STR("1.0")), etl::to_string(0.999999, str, Format().precision(1).width(3).right())); CHECK(etl::u16string<20>(STR("1.0")) == etl::to_string(0.999999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::u16string<20>(STR("1")), etl::to_string(0.999999, str, Format().precision(0).width(1).right())); CHECK(etl::u16string<20>(STR("1")) == etl::to_string(0.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::u16string<20>(STR("2")), etl::to_string(1.999999, str, Format().precision(0).width(1).right())); CHECK(etl::u16string<20>(STR("2")) == etl::to_string(1.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::u16string<20>(STR("10.0")), etl::to_string(9.999999, str, Format().precision(1).width(4).right())); CHECK(etl::u16string<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right()));
CHECK_EQUAL(etl::u16string<20>(STR("20.0")), etl::to_string(19.999999, str, Format().precision(1).width(4).right())); CHECK(etl::u16string<20>(STR("20.0")) == etl::to_string(19.999999, str, Format().precision(1).width(4).right()));
} }
//************************************************************************* //*************************************************************************
@ -312,15 +312,15 @@ namespace
{ {
etl::u16string<20> str; etl::u16string<20> str;
CHECK_EQUAL(etl::u16string<20>(STR(" 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::u16string<20>(STR(" 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::u16string<20>(STR(" 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::u16string<20>(STR(" 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::u16string<20>(STR("0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::u16string<20>(STR("0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::u16string<20>(STR("1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::u16string<20>(STR("1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::u16string<20>(STR(" false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::u16string<20>(STR(" false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::u16string<20>(STR(" true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::u16string<20>(STR(" true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::u16string<20>(STR("false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::u16string<20>(STR("false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true)));
CHECK_EQUAL(etl::u16string<20>(STR("true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::u16string<20>(STR("true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true)));
} }
//************************************************************************* //*************************************************************************
@ -329,28 +329,28 @@ namespace
etl::u16string<20> str; etl::u16string<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::u16string<20>(STR("Result 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::u16string<20>(STR("Result 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result 0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::u16string<20>(STR("Result 0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result 1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::u16string<20>(STR("Result 1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::u16string<20>(STR("Result false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::u16string<20>(STR("Result true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::u16string<20>(STR("Result false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u16string<20>(STR("Result true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::u16string<20>(STR("Result true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
} }
}; };
} }

View File

@ -58,25 +58,25 @@ namespace
{ {
etl::u32string<20> str; etl::u32string<20> str;
CHECK_EQUAL(etl::u32string<20>(STR("0")), etl::to_string(uint8_t(0), str)); CHECK(etl::u32string<20>(STR("0")) == etl::to_string(uint8_t(0), str));
CHECK_EQUAL(etl::u32string<20>(STR("0")), etl::to_string(uint16_t(0), str)); CHECK(etl::u32string<20>(STR("0")) == etl::to_string(uint16_t(0), str));
CHECK_EQUAL(etl::u32string<20>(STR("0")), etl::to_string(uint32_t(0), str)); CHECK(etl::u32string<20>(STR("0")) == etl::to_string(uint32_t(0), str));
CHECK_EQUAL(etl::u32string<20>(STR("0")), etl::to_string(uint64_t(0), str)); CHECK(etl::u32string<20>(STR("0")) == etl::to_string(uint64_t(0), str));
CHECK_EQUAL(etl::u32string<20>(STR("128")), etl::to_string(uint8_t(128), str)); CHECK(etl::u32string<20>(STR("128")) == etl::to_string(uint8_t(128), str));
CHECK_EQUAL(etl::u32string<20>(STR("32768")), etl::to_string(uint16_t(32768), str)); CHECK(etl::u32string<20>(STR("32768")) == etl::to_string(uint16_t(32768), str));
CHECK_EQUAL(etl::u32string<20>(STR("2147483648")), etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::u32string<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str));
CHECK_EQUAL(etl::u32string<20>(STR("9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str)); CHECK(etl::u32string<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str));
CHECK_EQUAL(etl::u32string<20>(STR("127")), etl::to_string(int8_t(127), str)); CHECK(etl::u32string<20>(STR("127")) == etl::to_string(int8_t(127), str));
CHECK_EQUAL(etl::u32string<20>(STR("32767")), etl::to_string(int16_t(32767), str)); CHECK(etl::u32string<20>(STR("32767")) == etl::to_string(int16_t(32767), str));
CHECK_EQUAL(etl::u32string<20>(STR("2147483647")), etl::to_string(int32_t(2147483647ll), str)); CHECK(etl::u32string<20>(STR("2147483647")) == etl::to_string(int32_t(2147483647ll), str));
CHECK_EQUAL(etl::u32string<20>(STR("9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str)); CHECK(etl::u32string<20>(STR("9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str));
CHECK_EQUAL(etl::u32string<20>(STR("-128")), etl::to_string(int8_t(-128), str)); CHECK(etl::u32string<20>(STR("-128")) == etl::to_string(int8_t(-128), str));
CHECK_EQUAL(etl::u32string<20>(STR("-32768")), etl::to_string(int16_t(-32768), str)); CHECK(etl::u32string<20>(STR("-32768")) == etl::to_string(int16_t(-32768), str));
CHECK_EQUAL(etl::u32string<20>(STR("-2147483648")), etl::to_string(int32_t(-2147483648ll), str)); CHECK(etl::u32string<20>(STR("-2147483648")) == etl::to_string(int32_t(-2147483648ll), str));
CHECK_EQUAL(etl::u32string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str)); CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str));
} }
//************************************************************************* //*************************************************************************
@ -84,25 +84,25 @@ namespace
{ {
etl::u32string<120> str; etl::u32string<120> str;
CHECK_EQUAL(etl::u32string<120>(STR("0")), etl::to_string(uint8_t(0), str, true)); CHECK(etl::u32string<120>(STR("0")) == etl::to_string(uint8_t(0), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("00")), etl::to_string(uint16_t(0), str, true)); CHECK(etl::u32string<120>(STR("00")) == etl::to_string(uint16_t(0), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000")), etl::to_string(uint32_t(0), str, true)); CHECK(etl::u32string<120>(STR("000")) == etl::to_string(uint32_t(0), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("0000")), etl::to_string(uint64_t(0), str, true)); CHECK(etl::u32string<120>(STR("0000")) == etl::to_string(uint64_t(0), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("0000128")), etl::to_string(uint8_t(128), str, true)); CHECK(etl::u32string<120>(STR("0000128")) == etl::to_string(uint8_t(128), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000012832768")), etl::to_string(uint16_t(32768), str, true)); CHECK(etl::u32string<120>(STR("000012832768")) == etl::to_string(uint16_t(32768), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("0000128327682147483648")), etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::u32string<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("00001283276821474836489223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, true)); CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("00001283276821474836489223372036854775808127")), etl::to_string(int8_t(127), str, true)); CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(127), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("0000128327682147483648922337203685477580812732767")), etl::to_string(int16_t(32767), str, true)); CHECK(etl::u32string<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(32767), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("00001283276821474836489223372036854775808127327672147483647")), etl::to_string(int32_t(2147483647ll), str, true)); CHECK(etl::u32string<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(2147483647ll), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, true)); CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")), etl::to_string(int8_t(-128), str, true)); CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(-128), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")), etl::to_string(int16_t(-32768), str, true)); CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(-32768), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")), etl::to_string(int32_t(-2147483648ll), str, true)); CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, true));
CHECK_EQUAL(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, true)); CHECK(etl::u32string<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, true));
} }
//************************************************************************* //*************************************************************************
@ -112,25 +112,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')); Format format = Format().base(10).width(20).fill(STR('#'));
CHECK_EQUAL(etl::u32string<20>(STR("###################0")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::u32string<20>(STR("###################0")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("###################0")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::u32string<20>(STR("###################0")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("###################0")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::u32string<20>(STR("###################0")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("###################0")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::u32string<20>(STR("###################0")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("#################128")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::u32string<20>(STR("#################128")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("###############32768")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::u32string<20>(STR("###############32768")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("##########2147483648")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u32string<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("#9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::u32string<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("#################127")), etl::to_string(int8_t(127), str, format)); CHECK(etl::u32string<20>(STR("#################127")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("###############32767")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::u32string<20>(STR("###############32767")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("##########2147483647")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::u32string<20>(STR("##########2147483647")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("#9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::u32string<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("################-128")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::u32string<20>(STR("################-128")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("##############-32768")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::u32string<20>(STR("##############-32768")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("#########-2147483648")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::u32string<20>(STR("#########-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -140,25 +140,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')).left(); Format format = Format().base(10).width(20).fill(STR('#')).left();
CHECK_EQUAL(etl::u32string<20>(STR("0###################")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::u32string<20>(STR("0###################")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("0###################")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::u32string<20>(STR("0###################")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("0###################")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::u32string<20>(STR("0###################")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("0###################")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::u32string<20>(STR("0###################")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("128#################")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::u32string<20>(STR("128#################")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("32768###############")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::u32string<20>(STR("32768###############")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("2147483648##########")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::u32string<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("9223372036854775808#")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::u32string<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("127#################")), etl::to_string(int8_t(127), str, format)); CHECK(etl::u32string<20>(STR("127#################")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("32767###############")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::u32string<20>(STR("32767###############")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("2147483647##########")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::u32string<20>(STR("2147483647##########")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("9223372036854775807#")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::u32string<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("-128################")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::u32string<20>(STR("-128################")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("-32768##############")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::u32string<20>(STR("-32768##############")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("-2147483648#########")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::u32string<20>(STR("-2147483648#########")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::u32string<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::u32string<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -166,25 +166,25 @@ namespace
{ {
etl::u32string<64> str; etl::u32string<64> str;
CHECK_EQUAL(etl::u32string<64>(STR("00000000")), etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u32string<64>(STR("00000000")) == etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("0000000000000000")), etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u32string<64>(STR("0000000000000000")) == etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("00000000000000000000000000000000")), etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u32string<64>(STR("00000000000000000000000000000000")) == etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u32string<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("10000000")), etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u32string<64>(STR("10000000")) == etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("1000000000000000")), etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u32string<64>(STR("1000000000000000")) == etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("10000000000000000000000000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u32string<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("01111111")), etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u32string<64>(STR("01111111")) == etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("0111111111111111")), etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u32string<64>(STR("0111111111111111")) == etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("01111111111111111111111111111111")), etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u32string<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u32string<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("10000000")), etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::u32string<64>(STR("10000000")) == etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("1000000000000000")), etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::u32string<64>(STR("1000000000000000")) == etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("10000000000000000000000000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::u32string<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::u32string<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -192,25 +192,25 @@ namespace
{ {
etl::u32string<22> str; etl::u32string<22> str;
CHECK_EQUAL(etl::u32string<22>(STR("000")), etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u32string<22>(STR("000")) == etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("000000")), etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u32string<22>(STR("000000")) == etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("00000000000")), etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u32string<22>(STR("00000000000")) == etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("0000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u32string<22>(STR("0000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("200")), etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u32string<22>(STR("200")) == etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("100000")), etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u32string<22>(STR("100000")) == etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("20000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u32string<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("1000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u32string<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("177")), etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u32string<22>(STR("177")) == etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("077777")), etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u32string<22>(STR("077777")) == etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("17777777777")), etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u32string<22>(STR("17777777777")) == etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("0777777777777777777777")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u32string<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("200")), etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::u32string<22>(STR("200")) == etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("100000")), etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::u32string<22>(STR("100000")) == etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("20000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::u32string<22>(STR("20000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<22>(STR("1000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::u32string<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -218,25 +218,25 @@ namespace
{ {
etl::u32string<16> str; etl::u32string<16> str;
CHECK_EQUAL(etl::u32string<16>(STR("00")), etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u32string<16>(STR("00")) == etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("0000")), etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u32string<16>(STR("0000")) == etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("00000000")), etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u32string<16>(STR("00000000")) == etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("0000000000000000")), etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u32string<16>(STR("0000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("80")), etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u32string<16>(STR("80")) == etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("8000")), etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u32string<16>(STR("8000")) == etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("80000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u32string<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("8000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u32string<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("7f")), etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u32string<16>(STR("7f")) == etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("7fff")), etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u32string<16>(STR("7fff")) == etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("7fffffff")), etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u32string<16>(STR("7fffffff")) == etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("7fffffffffffffff")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u32string<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("80")), etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::u32string<16>(STR("80")) == etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("8000")), etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::u32string<16>(STR("8000")) == etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("80000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::u32string<16>(STR("80000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::u32string<16>(STR("8000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::u32string<16>(STR("8000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0'))));
} }
@ -245,10 +245,10 @@ namespace
{ {
etl::u32string<17> str; etl::u32string<17> str;
CHECK_EQUAL(etl::u32string<17>(STR("11110001001000000")), etl::to_string(123456, str, Format().binary())); CHECK(etl::u32string<17>(STR("11110001001000000")) == etl::to_string(123456, str, Format().binary()));
CHECK_EQUAL(etl::u32string<17>(STR("361100")), etl::to_string(123456, str, Format().octal())); CHECK(etl::u32string<17>(STR("361100")) == etl::to_string(123456, str, Format().octal()));
CHECK_EQUAL(etl::u32string<17>(STR("123456")), etl::to_string(123456, str, Format().decimal())); CHECK(etl::u32string<17>(STR("123456")) == etl::to_string(123456, str, Format().decimal()));
CHECK_EQUAL(etl::u32string<17>(STR("1e240")), etl::to_string(123456, str, Format().hex())); CHECK(etl::u32string<17>(STR("1e240")) == etl::to_string(123456, str, Format().hex()));
} }
//************************************************************************* //*************************************************************************
@ -256,23 +256,23 @@ namespace
{ {
etl::u32string<20> str; etl::u32string<20> str;
CHECK_EQUAL(etl::u32string<20>(STR(" 0.000000")), etl::to_string(0.0, str, Format().precision(6).width(10).right())); CHECK(etl::u32string<20>(STR(" 0.000000")) == etl::to_string(0.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u32string<20>(STR("0.000000 ")), etl::to_string(0.0, str, Format().precision(6).width(10).left())); CHECK(etl::u32string<20>(STR("0.000000 ")) == etl::to_string(0.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u32string<20>(STR(" 0.000001")), etl::to_string(0.000001, str, Format().precision(6).width(10).right())); CHECK(etl::u32string<20>(STR(" 0.000001")) == etl::to_string(0.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u32string<20>(STR("0.000001 ")), etl::to_string(0.000001, str, Format().precision(6).width(10).left())); CHECK(etl::u32string<20>(STR("0.000001 ")) == etl::to_string(0.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u32string<20>(STR(" 1.000000")), etl::to_string(1.0, str, Format().precision(6).width(10).right())); CHECK(etl::u32string<20>(STR(" 1.000000")) == etl::to_string(1.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u32string<20>(STR("1.000000 ")), etl::to_string(1.0, str, Format().precision(6).width(10).left())); CHECK(etl::u32string<20>(STR("1.000000 ")) == etl::to_string(1.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u32string<20>(STR(" 1.000001")), etl::to_string(1.000001, str, Format().precision(6).width(10).right())); CHECK(etl::u32string<20>(STR(" 1.000001")) == etl::to_string(1.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u32string<20>(STR("1.000001 ")), etl::to_string(1.000001, str, Format().precision(6).width(10).left())); CHECK(etl::u32string<20>(STR("1.000001 ")) == etl::to_string(1.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u32string<20>(STR(" 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right())); CHECK(etl::u32string<20>(STR(" 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::u32string<20>(STR("12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left())); CHECK(etl::u32string<20>(STR("12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::u32string<20>(STR(" -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right())); CHECK(etl::u32string<20>(STR(" -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right()));
CHECK_EQUAL(etl::u32string<20>(STR("-12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left())); CHECK(etl::u32string<20>(STR("-12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left()));
} }
//************************************************************************* //*************************************************************************
@ -281,16 +281,16 @@ namespace
etl::u32string<20> str; etl::u32string<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true)); CHECK(etl::u32string<20>(STR("Result 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result 12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true)); CHECK(etl::u32string<20>(STR("Result 12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true)); CHECK(etl::u32string<20>(STR("Result -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result -12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true)); CHECK(etl::u32string<20>(STR("Result -12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true));
} }
//************************************************************************* //*************************************************************************
@ -298,17 +298,17 @@ namespace
{ {
etl::u32string<20> str; etl::u32string<20> str;
CHECK_EQUAL(etl::u32string<20>(STR("0.00001")), etl::to_string(0.000009, str, Format().precision(5).width(7).right())); CHECK(etl::u32string<20>(STR("0.00001")) == etl::to_string(0.000009, str, Format().precision(5).width(7).right()));
CHECK_EQUAL(etl::u32string<20>(STR("0.0001")), etl::to_string(0.000099, str, Format().precision(4).width(6).right())); CHECK(etl::u32string<20>(STR("0.0001")) == etl::to_string(0.000099, str, Format().precision(4).width(6).right()));
CHECK_EQUAL(etl::u32string<20>(STR("0.001")), etl::to_string(0.000999, str, Format().precision(3).width(5).right())); CHECK(etl::u32string<20>(STR("0.001")) == etl::to_string(0.000999, str, Format().precision(3).width(5).right()));
CHECK_EQUAL(etl::u32string<20>(STR("0.01")), etl::to_string(0.009999, str, Format().precision(2).width(4).right())); CHECK(etl::u32string<20>(STR("0.01")) == etl::to_string(0.009999, str, Format().precision(2).width(4).right()));
CHECK_EQUAL(etl::u32string<20>(STR("0.1")), etl::to_string(0.099999, str, Format().precision(1).width(3).right())); CHECK(etl::u32string<20>(STR("0.1")) == etl::to_string(0.099999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::u32string<20>(STR("1.0")), etl::to_string(0.999999, str, Format().precision(1).width(3).right())); CHECK(etl::u32string<20>(STR("1.0")) == etl::to_string(0.999999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::u32string<20>(STR("1")), etl::to_string(0.999999, str, Format().precision(0).width(1).right())); CHECK(etl::u32string<20>(STR("1")) == etl::to_string(0.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::u32string<20>(STR("10.0")), etl::to_string(9.999999, str, Format().precision(1).width(4).right())); CHECK(etl::u32string<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right()));
CHECK_EQUAL(etl::u32string<20>(STR("2")), etl::to_string(1.999999, str, Format().precision(0).width(1).right())); CHECK(etl::u32string<20>(STR("2")) == etl::to_string(1.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::u32string<20>(STR("10.0")), etl::to_string(9.999999, str, Format().precision(1).width(4).right())); CHECK(etl::u32string<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right()));
CHECK_EQUAL(etl::u32string<20>(STR("20.0")), etl::to_string(19.999999, str, Format().precision(1).width(4).right())); CHECK(etl::u32string<20>(STR("20.0")) == etl::to_string(19.999999, str, Format().precision(1).width(4).right()));
} }
@ -317,15 +317,15 @@ namespace
{ {
etl::u32string<20> str; etl::u32string<20> str;
CHECK_EQUAL(etl::u32string<20>(STR(" 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::u32string<20>(STR(" 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::u32string<20>(STR(" 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::u32string<20>(STR(" 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::u32string<20>(STR("0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::u32string<20>(STR("0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::u32string<20>(STR("1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::u32string<20>(STR("1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::u32string<20>(STR(" false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::u32string<20>(STR(" false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::u32string<20>(STR(" true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::u32string<20>(STR(" true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::u32string<20>(STR("false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::u32string<20>(STR("false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true)));
CHECK_EQUAL(etl::u32string<20>(STR("true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::u32string<20>(STR("true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true)));
} }
//************************************************************************* //*************************************************************************
@ -334,28 +334,28 @@ namespace
etl::u32string<20> str; etl::u32string<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::u32string<20>(STR("Result 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::u32string<20>(STR("Result 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result 0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::u32string<20>(STR("Result 0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result 1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::u32string<20>(STR("Result 1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::u32string<20>(STR("Result false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::u32string<20>(STR("Result true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::u32string<20>(STR("Result false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::u32string<20>(STR("Result true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::u32string<20>(STR("Result true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
} }
}; };
} }

View File

@ -60,25 +60,25 @@ namespace
{ {
etl::wstring<20> str; etl::wstring<20> str;
CHECK_EQUAL(etl::wstring<20>(STR("0")), etl::to_string(uint8_t(0), str)); CHECK(etl::wstring<20>(STR("0")) == etl::to_string(uint8_t(0), str));
CHECK_EQUAL(etl::wstring<20>(STR("0")), etl::to_string(uint16_t(0), str)); CHECK(etl::wstring<20>(STR("0")) == etl::to_string(uint16_t(0), str));
CHECK_EQUAL(etl::wstring<20>(STR("0")), etl::to_string(uint32_t(0), str)); CHECK(etl::wstring<20>(STR("0")) == etl::to_string(uint32_t(0), str));
CHECK_EQUAL(etl::wstring<20>(STR("0")), etl::to_string(uint64_t(0), str)); CHECK(etl::wstring<20>(STR("0")) == etl::to_string(uint64_t(0), str));
CHECK_EQUAL(etl::wstring<20>(STR("128")), etl::to_string(uint8_t(128), str)); CHECK(etl::wstring<20>(STR("128")) == etl::to_string(uint8_t(128), str));
CHECK_EQUAL(etl::wstring<20>(STR("32768")), etl::to_string(uint16_t(32768), str)); CHECK(etl::wstring<20>(STR("32768")) == etl::to_string(uint16_t(32768), str));
CHECK_EQUAL(etl::wstring<20>(STR("2147483648")), etl::to_string(uint32_t(2147483648ul), str)); CHECK(etl::wstring<20>(STR("2147483648")) == etl::to_string(uint32_t(2147483648ul), str));
CHECK_EQUAL(etl::wstring<20>(STR("9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str)); CHECK(etl::wstring<20>(STR("9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str));
CHECK_EQUAL(etl::wstring<20>(STR("127")), etl::to_string(int8_t(127), str)); CHECK(etl::wstring<20>(STR("127")) == etl::to_string(int8_t(127), str));
CHECK_EQUAL(etl::wstring<20>(STR("32767")), etl::to_string(int16_t(32767), str)); CHECK(etl::wstring<20>(STR("32767")) == etl::to_string(int16_t(32767), str));
CHECK_EQUAL(etl::wstring<20>(STR("2147483647")), etl::to_string(int32_t(2147483647ll), str)); CHECK(etl::wstring<20>(STR("2147483647")) == etl::to_string(int32_t(2147483647ll), str));
CHECK_EQUAL(etl::wstring<20>(STR("9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str)); CHECK(etl::wstring<20>(STR("9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str));
CHECK_EQUAL(etl::wstring<20>(STR("-128")), etl::to_string(int8_t(-128), str)); CHECK(etl::wstring<20>(STR("-128")) == etl::to_string(int8_t(-128), str));
CHECK_EQUAL(etl::wstring<20>(STR("-32768")), etl::to_string(int16_t(-32768), str)); CHECK(etl::wstring<20>(STR("-32768")) == etl::to_string(int16_t(-32768), str));
CHECK_EQUAL(etl::wstring<20>(STR("-2147483648")), etl::to_string(int32_t(-2147483648ll), str)); CHECK(etl::wstring<20>(STR("-2147483648")) == etl::to_string(int32_t(-2147483648ll), str));
CHECK_EQUAL(etl::wstring<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str)); CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str));
} }
//************************************************************************* //*************************************************************************
@ -86,25 +86,25 @@ namespace
{ {
etl::wstring<120> str; etl::wstring<120> str;
CHECK_EQUAL(etl::wstring<120>(STR("0")), etl::to_string(uint8_t(0), str, true)); CHECK(etl::wstring<120>(STR("0")) == etl::to_string(uint8_t(0), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("00")), etl::to_string(uint16_t(0), str, true)); CHECK(etl::wstring<120>(STR("00")) == etl::to_string(uint16_t(0), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000")), etl::to_string(uint32_t(0), str, true)); CHECK(etl::wstring<120>(STR("000")) == etl::to_string(uint32_t(0), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("0000")), etl::to_string(uint64_t(0), str, true)); CHECK(etl::wstring<120>(STR("0000")) == etl::to_string(uint64_t(0), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("0000128")), etl::to_string(uint8_t(128), str, true)); CHECK(etl::wstring<120>(STR("0000128")) == etl::to_string(uint8_t(128), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000012832768")), etl::to_string(uint16_t(32768), str, true)); CHECK(etl::wstring<120>(STR("000012832768")) == etl::to_string(uint16_t(32768), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("0000128327682147483648")), etl::to_string(uint32_t(2147483648ul), str, true)); CHECK(etl::wstring<120>(STR("0000128327682147483648")) == etl::to_string(uint32_t(2147483648ul), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("00001283276821474836489223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, true)); CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("00001283276821474836489223372036854775808127")), etl::to_string(int8_t(127), str, true)); CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808127")) == etl::to_string(int8_t(127), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("0000128327682147483648922337203685477580812732767")), etl::to_string(int16_t(32767), str, true)); CHECK(etl::wstring<120>(STR("0000128327682147483648922337203685477580812732767")) == etl::to_string(int16_t(32767), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("00001283276821474836489223372036854775808127327672147483647")), etl::to_string(int32_t(2147483647ll), str, true)); CHECK(etl::wstring<120>(STR("00001283276821474836489223372036854775808127327672147483647")) == etl::to_string(int32_t(2147483647ll), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, true)); CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")), etl::to_string(int8_t(-128), str, true)); CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128")) == etl::to_string(int8_t(-128), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")), etl::to_string(int16_t(-32768), str, true)); CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768")) == etl::to_string(int16_t(-32768), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")), etl::to_string(int32_t(-2147483648ll), str, true)); CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, true));
CHECK_EQUAL(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, true)); CHECK(etl::wstring<120>(STR("000012832768214748364892233720368547758081273276721474836479223372036854775807-128-32768-2147483648-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, true));
} }
//************************************************************************* //*************************************************************************
@ -114,25 +114,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')); Format format = Format().base(10).width(20).fill(STR('#'));
CHECK_EQUAL(etl::wstring<20>(STR("###################0")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::wstring<20>(STR("###################0")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("###################0")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::wstring<20>(STR("###################0")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("###################0")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::wstring<20>(STR("###################0")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("###################0")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::wstring<20>(STR("###################0")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("#################128")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::wstring<20>(STR("#################128")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("###############32768")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::wstring<20>(STR("###############32768")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("##########2147483648")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::wstring<20>(STR("##########2147483648")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("#9223372036854775808")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::wstring<20>(STR("#9223372036854775808")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("#################127")), etl::to_string(int8_t(127), str, format)); CHECK(etl::wstring<20>(STR("#################127")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("###############32767")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::wstring<20>(STR("###############32767")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("##########2147483647")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::wstring<20>(STR("##########2147483647")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("#9223372036854775807")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::wstring<20>(STR("#9223372036854775807")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("################-128")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::wstring<20>(STR("################-128")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("##############-32768")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::wstring<20>(STR("##############-32768")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("#########-2147483648")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::wstring<20>(STR("#########-2147483648")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -142,25 +142,25 @@ namespace
Format format = Format().base(10).width(20).fill(STR('#')).left(); Format format = Format().base(10).width(20).fill(STR('#')).left();
CHECK_EQUAL(etl::wstring<20>(STR("0###################")), etl::to_string(uint8_t(0), str, format)); CHECK(etl::wstring<20>(STR("0###################")) == etl::to_string(uint8_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("0###################")), etl::to_string(uint16_t(0), str, format)); CHECK(etl::wstring<20>(STR("0###################")) == etl::to_string(uint16_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("0###################")), etl::to_string(uint32_t(0), str, format)); CHECK(etl::wstring<20>(STR("0###################")) == etl::to_string(uint32_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("0###################")), etl::to_string(uint64_t(0), str, format)); CHECK(etl::wstring<20>(STR("0###################")) == etl::to_string(uint64_t(0), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("128#################")), etl::to_string(uint8_t(128), str, format)); CHECK(etl::wstring<20>(STR("128#################")) == etl::to_string(uint8_t(128), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("32768###############")), etl::to_string(uint16_t(32768), str, format)); CHECK(etl::wstring<20>(STR("32768###############")) == etl::to_string(uint16_t(32768), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("2147483648##########")), etl::to_string(uint32_t(2147483648ul), str, format)); CHECK(etl::wstring<20>(STR("2147483648##########")) == etl::to_string(uint32_t(2147483648ul), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("9223372036854775808#")), etl::to_string(uint64_t(9223372036854775808ull), str, format)); CHECK(etl::wstring<20>(STR("9223372036854775808#")) == etl::to_string(uint64_t(9223372036854775808ull), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("127#################")), etl::to_string(int8_t(127), str, format)); CHECK(etl::wstring<20>(STR("127#################")) == etl::to_string(int8_t(127), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("32767###############")), etl::to_string(int16_t(32767), str, format)); CHECK(etl::wstring<20>(STR("32767###############")) == etl::to_string(int16_t(32767), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("2147483647##########")), etl::to_string(int32_t(2147483647ll), str, format)); CHECK(etl::wstring<20>(STR("2147483647##########")) == etl::to_string(int32_t(2147483647ll), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("9223372036854775807#")), etl::to_string(int64_t(9223372036854775807ll), str, format)); CHECK(etl::wstring<20>(STR("9223372036854775807#")) == etl::to_string(int64_t(9223372036854775807ll), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("-128################")), etl::to_string(int8_t(-128), str, format)); CHECK(etl::wstring<20>(STR("-128################")) == etl::to_string(int8_t(-128), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("-32768##############")), etl::to_string(int16_t(-32768), str, format)); CHECK(etl::wstring<20>(STR("-32768##############")) == etl::to_string(int16_t(-32768), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("-2147483648#########")), etl::to_string(int32_t(-2147483648ll), str, format)); CHECK(etl::wstring<20>(STR("-2147483648#########")) == etl::to_string(int32_t(-2147483648ll), str, format));
CHECK_EQUAL(etl::wstring<20>(STR("-9223372036854775808")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, format)); CHECK(etl::wstring<20>(STR("-9223372036854775808")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, format));
} }
//************************************************************************* //*************************************************************************
@ -168,25 +168,25 @@ namespace
{ {
etl::wstring<64> str; etl::wstring<64> str;
CHECK_EQUAL(etl::wstring<64>(STR("00000000")), etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::wstring<64>(STR("00000000")) == etl::to_string(uint8_t(0), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("0000000000000000")), etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::wstring<64>(STR("0000000000000000")) == etl::to_string(uint16_t(0), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("00000000000000000000000000000000")), etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::wstring<64>(STR("00000000000000000000000000000000")) == etl::to_string(uint32_t(0), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::wstring<64>(STR("0000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("10000000")), etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::wstring<64>(STR("10000000")) == etl::to_string(uint8_t(128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("1000000000000000")), etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::wstring<64>(STR("1000000000000000")) == etl::to_string(uint16_t(32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("10000000000000000000000000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::wstring<64>(STR("10000000000000000000000000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("01111111")), etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::wstring<64>(STR("01111111")) == etl::to_string(int8_t(127), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("0111111111111111")), etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::wstring<64>(STR("0111111111111111")) == etl::to_string(int16_t(32767), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("01111111111111111111111111111111")), etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::wstring<64>(STR("01111111111111111111111111111111")) == etl::to_string(int32_t(2147483647ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::wstring<64>(STR("0111111111111111111111111111111111111111111111111111111111111111")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(2).width(64).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("10000000")), etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0')))); CHECK(etl::wstring<64>(STR("10000000")) == etl::to_string(int8_t(-128), str, Format().base(2).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("1000000000000000")), etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0')))); CHECK(etl::wstring<64>(STR("1000000000000000")) == etl::to_string(int16_t(-32768), str, Format().base(2).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("10000000000000000000000000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0')))); CHECK(etl::wstring<64>(STR("10000000000000000000000000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(2).width(32).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0')))); CHECK(etl::wstring<64>(STR("1000000000000000000000000000000000000000000000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(2).width(64).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -194,25 +194,25 @@ namespace
{ {
etl::wstring<22> str; etl::wstring<22> str;
CHECK_EQUAL(etl::wstring<22>(STR("000")), etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::wstring<22>(STR("000")) == etl::to_string(uint8_t(0), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("000000")), etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::wstring<22>(STR("000000")) == etl::to_string(uint16_t(0), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("00000000000")), etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::wstring<22>(STR("00000000000")) == etl::to_string(uint32_t(0), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("0000000000000000000000")), etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::wstring<22>(STR("0000000000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("200")), etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::wstring<22>(STR("200")) == etl::to_string(uint8_t(128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("100000")), etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::wstring<22>(STR("100000")) == etl::to_string(uint16_t(32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("20000000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::wstring<22>(STR("20000000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("1000000000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::wstring<22>(STR("1000000000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("177")), etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::wstring<22>(STR("177")) == etl::to_string(int8_t(127), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("077777")), etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::wstring<22>(STR("077777")) == etl::to_string(int16_t(32767), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("17777777777")), etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::wstring<22>(STR("17777777777")) == etl::to_string(int32_t(2147483647ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("0777777777777777777777")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::wstring<22>(STR("0777777777777777777777")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(8).width(22).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("200")), etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0')))); CHECK(etl::wstring<22>(STR("200")) == etl::to_string(int8_t(-128), str, Format().base(8).width(3).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("100000")), etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0')))); CHECK(etl::wstring<22>(STR("100000")) == etl::to_string(int16_t(-32768), str, Format().base(8).width(6).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("20000000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0')))); CHECK(etl::wstring<22>(STR("20000000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(8).width(11).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<22>(STR("1000000000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0')))); CHECK(etl::wstring<22>(STR("1000000000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(8).width(22).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -220,25 +220,25 @@ namespace
{ {
etl::wstring<16> str; etl::wstring<16> str;
CHECK_EQUAL(etl::wstring<16>(STR("00")), etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::wstring<16>(STR("00")) == etl::to_string(uint8_t(0), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("0000")), etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::wstring<16>(STR("0000")) == etl::to_string(uint16_t(0), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("00000000")), etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::wstring<16>(STR("00000000")) == etl::to_string(uint32_t(0), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("0000000000000000")), etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::wstring<16>(STR("0000000000000000")) == etl::to_string(uint64_t(0), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("80")), etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::wstring<16>(STR("80")) == etl::to_string(uint8_t(128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("8000")), etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::wstring<16>(STR("8000")) == etl::to_string(uint16_t(32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("80000000")), etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::wstring<16>(STR("80000000")) == etl::to_string(uint32_t(2147483648ul), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("8000000000000000")), etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::wstring<16>(STR("8000000000000000")) == etl::to_string(uint64_t(9223372036854775808ull), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("7f")), etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::wstring<16>(STR("7f")) == etl::to_string(int8_t(127), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("7fff")), etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::wstring<16>(STR("7fff")) == etl::to_string(int16_t(32767), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("7fffffff")), etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::wstring<16>(STR("7fffffff")) == etl::to_string(int32_t(2147483647ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("7fffffffffffffff")), etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::wstring<16>(STR("7fffffffffffffff")) == etl::to_string(int64_t(9223372036854775807ll), str, Format().base(16).width(16).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("80")), etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0')))); CHECK(etl::wstring<16>(STR("80")) == etl::to_string(int8_t(-128), str, Format().base(16).width(2).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("8000")), etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0')))); CHECK(etl::wstring<16>(STR("8000")) == etl::to_string(int16_t(-32768), str, Format().base(16).width(4).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("80000000")), etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0')))); CHECK(etl::wstring<16>(STR("80000000")) == etl::to_string(int32_t(-2147483648ll), str, Format().base(16).width(8).fill(STR('0'))));
CHECK_EQUAL(etl::wstring<16>(STR("8000000000000000")), etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0')))); CHECK(etl::wstring<16>(STR("8000000000000000")) == etl::to_string(int64_t(-9223372036854775807ll - 1), str, Format().base(16).width(16).fill(STR('0'))));
} }
//************************************************************************* //*************************************************************************
@ -246,10 +246,10 @@ namespace
{ {
etl::wstring<17> str; etl::wstring<17> str;
CHECK_EQUAL(etl::wstring<17>(STR("11110001001000000")), etl::to_string(123456, str, Format().binary())); CHECK(etl::wstring<17>(STR("11110001001000000")) == etl::to_string(123456, str, Format().binary()));
CHECK_EQUAL(etl::wstring<17>(STR("361100")), etl::to_string(123456, str, Format().octal())); CHECK(etl::wstring<17>(STR("361100")) == etl::to_string(123456, str, Format().octal()));
CHECK_EQUAL(etl::wstring<17>(STR("123456")), etl::to_string(123456, str, Format().decimal())); CHECK(etl::wstring<17>(STR("123456")) == etl::to_string(123456, str, Format().decimal()));
CHECK_EQUAL(etl::wstring<17>(STR("1e240")), etl::to_string(123456, str, Format().hex())); CHECK(etl::wstring<17>(STR("1e240")) == etl::to_string(123456, str, Format().hex()));
} }
//************************************************************************* //*************************************************************************
@ -257,23 +257,23 @@ namespace
{ {
etl::wstring<20> str; etl::wstring<20> str;
CHECK_EQUAL(etl::wstring<20>(STR(" 0.000000")), etl::to_string(0.0, str, Format().precision(6).width(10).right())); CHECK(etl::wstring<20>(STR(" 0.000000")) == etl::to_string(0.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::wstring<20>(STR("0.000000 ")), etl::to_string(0.0, str, Format().precision(6).width(10).left())); CHECK(etl::wstring<20>(STR("0.000000 ")) == etl::to_string(0.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::wstring<20>(STR(" 0.000001")), etl::to_string(0.000001, str, Format().precision(6).width(10).right())); CHECK(etl::wstring<20>(STR(" 0.000001")) == etl::to_string(0.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::wstring<20>(STR("0.000001 ")), etl::to_string(0.000001, str, Format().precision(6).width(10).left())); CHECK(etl::wstring<20>(STR("0.000001 ")) == etl::to_string(0.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::wstring<20>(STR(" 1.000000")), etl::to_string(1.0, str, Format().precision(6).width(10).right())); CHECK(etl::wstring<20>(STR(" 1.000000")) == etl::to_string(1.0, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::wstring<20>(STR("1.000000 ")), etl::to_string(1.0, str, Format().precision(6).width(10).left())); CHECK(etl::wstring<20>(STR("1.000000 ")) == etl::to_string(1.0, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::wstring<20>(STR(" 1.000001")), etl::to_string(1.000001, str, Format().precision(6).width(10).right())); CHECK(etl::wstring<20>(STR(" 1.000001")) == etl::to_string(1.000001, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::wstring<20>(STR("1.000001 ")), etl::to_string(1.000001, str, Format().precision(6).width(10).left())); CHECK(etl::wstring<20>(STR("1.000001 ")) == etl::to_string(1.000001, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::wstring<20>(STR(" 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right())); CHECK(etl::wstring<20>(STR(" 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right()));
CHECK_EQUAL(etl::wstring<20>(STR("12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left())); CHECK(etl::wstring<20>(STR("12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left()));
CHECK_EQUAL(etl::wstring<20>(STR(" -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right())); CHECK(etl::wstring<20>(STR(" -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right()));
CHECK_EQUAL(etl::wstring<20>(STR("-12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left())); CHECK(etl::wstring<20>(STR("-12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left()));
} }
//************************************************************************* //*************************************************************************
@ -282,16 +282,16 @@ namespace
etl::wstring<20> str; etl::wstring<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result 12.345678")), etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true)); CHECK(etl::wstring<20>(STR("Result 12.345678")) == etl::to_string(12.345678, str, Format().precision(6).width(10).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result 12.345678 ")), etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true)); CHECK(etl::wstring<20>(STR("Result 12.345678 ")) == etl::to_string(12.345678, str, Format().precision(6).width(10).left(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result -12.345678")), etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true)); CHECK(etl::wstring<20>(STR("Result -12.345678")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).right(), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result -12.345678 ")), etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true)); CHECK(etl::wstring<20>(STR("Result -12.345678 ")) == etl::to_string(-12.345678, str, Format().precision(6).width(11).left(), true));
} }
//************************************************************************* //*************************************************************************
@ -299,17 +299,17 @@ namespace
{ {
etl::wstring<20> str; etl::wstring<20> str;
CHECK_EQUAL(etl::wstring<20>(STR("0.00001")), etl::to_string(0.000009, str, Format().precision(5).width(7).right())); CHECK(etl::wstring<20>(STR("0.00001")) == etl::to_string(0.000009, str, Format().precision(5).width(7).right()));
CHECK_EQUAL(etl::wstring<20>(STR("0.0001")), etl::to_string(0.000099, str, Format().precision(4).width(6).right())); CHECK(etl::wstring<20>(STR("0.0001")) == etl::to_string(0.000099, str, Format().precision(4).width(6).right()));
CHECK_EQUAL(etl::wstring<20>(STR("0.001")), etl::to_string(0.000999, str, Format().precision(3).width(5).right())); CHECK(etl::wstring<20>(STR("0.001")) == etl::to_string(0.000999, str, Format().precision(3).width(5).right()));
CHECK_EQUAL(etl::wstring<20>(STR("0.01")), etl::to_string(0.009999, str, Format().precision(2).width(4).right())); CHECK(etl::wstring<20>(STR("0.01")) == etl::to_string(0.009999, str, Format().precision(2).width(4).right()));
CHECK_EQUAL(etl::wstring<20>(STR("0.1")), etl::to_string(0.099999, str, Format().precision(1).width(3).right())); CHECK(etl::wstring<20>(STR("0.1")) == etl::to_string(0.099999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::wstring<20>(STR("1.0")), etl::to_string(0.999999, str, Format().precision(1).width(3).right())); CHECK(etl::wstring<20>(STR("1.0")) == etl::to_string(0.999999, str, Format().precision(1).width(3).right()));
CHECK_EQUAL(etl::wstring<20>(STR("1")), etl::to_string(0.999999, str, Format().precision(0).width(1).right())); CHECK(etl::wstring<20>(STR("1")) == etl::to_string(0.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::wstring<20>(STR("10.0")), etl::to_string(9.999999, str, Format().precision(1).width(4).right())); CHECK(etl::wstring<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right()));
CHECK_EQUAL(etl::wstring<20>(STR("2")), etl::to_string(1.999999, str, Format().precision(0).width(1).right())); CHECK(etl::wstring<20>(STR("2")) == etl::to_string(1.999999, str, Format().precision(0).width(1).right()));
CHECK_EQUAL(etl::wstring<20>(STR("10.0")), etl::to_string(9.999999, str, Format().precision(1).width(4).right())); CHECK(etl::wstring<20>(STR("10.0")) == etl::to_string(9.999999, str, Format().precision(1).width(4).right()));
CHECK_EQUAL(etl::wstring<20>(STR("20.0")), etl::to_string(19.999999, str, Format().precision(1).width(4).right())); CHECK(etl::wstring<20>(STR("20.0")) == etl::to_string(19.999999, str, Format().precision(1).width(4).right()));
} }
//************************************************************************* //*************************************************************************
@ -317,15 +317,15 @@ namespace
{ {
etl::wstring<20> str; etl::wstring<20> str;
CHECK_EQUAL(etl::wstring<20>(STR(" 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::wstring<20>(STR(" 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::wstring<20>(STR(" 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false))); CHECK(etl::wstring<20>(STR(" 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false)));
CHECK_EQUAL(etl::wstring<20>(STR("0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::wstring<20>(STR("0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::wstring<20>(STR("1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false))); CHECK(etl::wstring<20>(STR("1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false)));
CHECK_EQUAL(etl::wstring<20>(STR(" false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::wstring<20>(STR(" false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::wstring<20>(STR(" true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true))); CHECK(etl::wstring<20>(STR(" true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true)));
CHECK_EQUAL(etl::wstring<20>(STR("false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::wstring<20>(STR("false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true)));
CHECK_EQUAL(etl::wstring<20>(STR("true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true))); CHECK(etl::wstring<20>(STR("true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true)));
} }
//************************************************************************* //*************************************************************************
@ -334,28 +334,28 @@ namespace
etl::wstring<20> str; etl::wstring<20> str;
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result 0")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::wstring<20>(STR("Result 0")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result 1")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true)); CHECK(etl::wstring<20>(STR("Result 1")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result 0 ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::wstring<20>(STR("Result 0 ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result 1 ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true)); CHECK(etl::wstring<20>(STR("Result 1 ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(false), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result false")), to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::wstring<20>(STR("Result false")) == to_string(false, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result true")), to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true)); CHECK(etl::wstring<20>(STR("Result true")) == to_string(true, str, Format().precision(6).width(10).right().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result false ")), to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::wstring<20>(STR("Result false ")) == to_string(false, str, Format().precision(6).width(10).left().boolalpha(true), true));
str.assign(STR("Result ")); str.assign(STR("Result "));
CHECK_EQUAL(etl::wstring<20>(STR("Result true ")), to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true)); CHECK(etl::wstring<20>(STR("Result true ")) == to_string(true, str, Format().precision(6).width(10).left().boolalpha(true), true));
} }
//************************************************************************* //*************************************************************************
@ -373,7 +373,7 @@ namespace
etl::wstring<20> compare(temp.begin(), temp.end()); etl::wstring<20> compare(temp.begin(), temp.end());
to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0'))); to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0')));
CHECK_EQUAL(compare, str); CHECK(compare == str);
oss.clear(); oss.clear();
oss.str(STR("")); oss.str(STR(""));
@ -384,7 +384,7 @@ namespace
compare.assign(temp.begin(), temp.end()); compare.assign(temp.begin(), temp.end());
to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0'))); to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')));
CHECK_EQUAL(compare, str); CHECK(compare == str);
} }
//************************************************************************* //*************************************************************************
@ -404,7 +404,7 @@ namespace
str.assign(STR("Result ")); str.assign(STR("Result "));
to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0')), true); to_string(&cvi, str, Format().hex().width(10).right().fill(STR('0')), true);
CHECK_EQUAL(compare, str); CHECK(compare == str);
oss.clear(); oss.clear();
oss.str(STR("")); oss.str(STR(""));
@ -417,7 +417,7 @@ namespace
str.assign(STR("Result ")); str.assign(STR("Result "));
to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')), true); to_string(&cvi, str, Format().hex().width(10).left().fill(STR('0')), true);
CHECK_EQUAL(compare, str); CHECK(compare == str);
} }
}; };
} }