Attempt to fix some sanitizer issues for tests

This commit is contained in:
John Wellbelove 2025-03-16 19:07:25 +00:00
parent ebc588a477
commit a86b124019
3 changed files with 10 additions and 16 deletions

View File

@ -322,7 +322,10 @@ namespace etl
if (p_next != &this->terminator)
{
link_type* p_unlinked = etl::unlink_after<link_type>(link);
p_unlinked->clear();
if (p_unlinked != ETL_NULLPTR)
{
p_unlinked->clear();
}
--current_size;
}
}

View File

@ -37,6 +37,7 @@ SOFTWARE.
#include <vector>
#include "etl/map.h"
#include "etl/string.h"
#include "data.h"
@ -1575,7 +1576,7 @@ namespace
#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED)
TEST_FIXTURE(SetupFixture, test_map_template_deduction)
{
using Pair = std::pair<const std::string, int>;
using Pair = std::pair<const etl::string<1>, int>;
etl::map data { Pair{"0", 0}, Pair{"1", 1}, Pair{"2", 2}, Pair{"3", 3}, Pair{"4", 4}, Pair{"5", 5} };
@ -1596,9 +1597,9 @@ namespace
#if ETL_HAS_INITIALIZER_LIST
TEST_FIXTURE(SetupFixture, test_make_map)
{
using Pair = ETL_OR_STD::pair<const std::string, int>;
using Pair = ETL_OR_STD::pair<const etl::string<1>, int>;
auto data = etl::make_map<std::string, int, std::less<std::string>>(Pair{ "0", 0 }, Pair{ "1", 1 }, Pair{ "2", 2 }, Pair{ "3", 3 }, Pair{ "4", 4 }, Pair{ "5", 5 });
auto data = etl::make_map<const etl::string<1>, int, std::less<etl::string<1>>>(Pair{ "0", 0 }, Pair{ "1", 1 }, Pair{ "2", 2 }, Pair{ "3", 3 }, Pair{ "4", 4 }, Pair{ "5", 5 });
auto v = *data.begin();
using Type = decltype(v);

View File

@ -341,14 +341,7 @@ namespace
etl::multi_span<int>::iterator ms_itr = ms_int.begin();
etl::multi_span<int>::iterator ms_end_itr = ms_int.end();
while (ms_itr != ms_end_itr)
{
// Fill the multi span
*ms_itr++ = *exp_itr++;
}
ms_itr = ms_int.begin();
exp_itr = expected.begin();
std::copy(ms_itr, ms_end_itr, exp_itr);
while (ms_itr != ms_end_itr)
{
@ -554,10 +547,7 @@ namespace
multi_span_type::reverse_iterator ms_itr = ms_int.rbegin();
multi_span_type::reverse_iterator ms_end_itr = ms_int.rend();
while (ms_itr != ms_end_itr)
{
*ms_itr++ = *exp_itr++;
}
std::copy(ms_itr, ms_end_itr, exp_itr);
while (ms_itr != ms_end_itr)
{