mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Fixed 'insert to empty container' bug for deque
This commit is contained in:
parent
e323f2267f
commit
06860eb840
@ -696,9 +696,6 @@ namespace etl
|
||||
|
||||
initialise();
|
||||
|
||||
_begin.index = 0;
|
||||
_end.index = 0;
|
||||
|
||||
while (n > 0)
|
||||
{
|
||||
create_element_back(value);
|
||||
@ -2087,12 +2084,7 @@ namespace etl
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty())
|
||||
{
|
||||
--_begin;
|
||||
}
|
||||
|
||||
_begin -= n - 1;
|
||||
_begin -= n;
|
||||
|
||||
iterator item = _begin;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ SOFTWARE.
|
||||
|
||||
#define ETL_VERSION_MAJOR 18
|
||||
#define ETL_VERSION_MINOR 0
|
||||
#define ETL_VERSION_PATCH 0
|
||||
#define ETL_VERSION_PATCH 1
|
||||
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Embedded Template Library",
|
||||
"version": "18.0.0",
|
||||
"version": "18.0.1",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library
|
||||
version=18.0.0
|
||||
version=18.0.1
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
===============================================================================
|
||||
18.0.1
|
||||
Fixed 'insert to empty container' bug in etl::deque.
|
||||
|
||||
===============================================================================
|
||||
18.0.0
|
||||
*************************
|
||||
|
||||
@ -94,6 +94,10 @@ namespace
|
||||
{
|
||||
DataDC data;
|
||||
|
||||
CHECK(data.empty());
|
||||
CHECK(!data.full());
|
||||
CHECK(data.begin() == data.end());
|
||||
CHECK_EQUAL(0U, data.size());
|
||||
CHECK_EQUAL(SIZE, data.max_size());
|
||||
}
|
||||
|
||||
@ -788,8 +792,6 @@ namespace
|
||||
CHECK(data.empty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_insert_to_empty)
|
||||
{
|
||||
@ -800,6 +802,7 @@ namespace
|
||||
|
||||
data.insert(data.begin(), valuesToInsert.begin(), valuesToInsert.end());
|
||||
|
||||
CHECK_EQUAL(insertCount, std::distance(data.begin(), data.end()));
|
||||
CHECK(data.size() == insertCount);
|
||||
CHECK(data[0] == value);
|
||||
CHECK(data[1] == value);
|
||||
@ -815,6 +818,7 @@ namespace
|
||||
Compare_Data::iterator cposition = compare_data.insert(compare_data.begin(), N14);
|
||||
DataNDC::iterator position = data.insert(data.begin(), N14);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -829,6 +833,7 @@ namespace
|
||||
Compare_Data::iterator cposition = compare_data.emplace(compare_data.begin(), N14.value);
|
||||
DataNDC::iterator position = data.emplace(data.begin(), N14.value);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -843,6 +848,7 @@ namespace
|
||||
Compare_Data::iterator cposition = compare_data.insert(compare_data.end(), N14);
|
||||
DataNDC::iterator position = data.insert(data.end(), N14);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -857,6 +863,7 @@ namespace
|
||||
Compare_Data::iterator cposition = compare_data.emplace(compare_data.end(), N14.value);
|
||||
DataNDC::iterator position = data.emplace(data.end(), N14.value);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -871,6 +878,7 @@ namespace
|
||||
Compare_Data::iterator cposition = compare_data.insert(compare_data.begin() + 3, N14);
|
||||
DataNDC::iterator position = data.insert(data.begin() + 3, N14);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -881,6 +889,7 @@ namespace
|
||||
cposition = compare_data.insert(compare_data.begin() + 4, N14);
|
||||
position = data.insert(data.begin() + 4, N14);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -895,6 +904,7 @@ namespace
|
||||
Compare_Data::iterator cposition = compare_data.emplace(compare_data.begin() + 3, N14.value);
|
||||
DataNDC::iterator position = data.emplace(data.begin() + 3, N14.value);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -905,6 +915,7 @@ namespace
|
||||
cposition = compare_data.emplace(compare_data.begin() + 4, N14.value);
|
||||
position = data.emplace(data.begin() + 4, N14.value);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
CHECK_EQUAL(std::distance(compare_data.begin(), cposition), std::distance(data.begin(), position));
|
||||
@ -961,6 +972,7 @@ namespace
|
||||
compare_data.insert(compare_data.begin() + offset, range.begin(), range.end());
|
||||
data.insert(data.begin() + offset, range.begin(), range.end());
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), std::distance(data.begin(), data.end()));
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user