mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Added const_map_ext and const_multimap_ext
This commit is contained in:
parent
e84be139c5
commit
64eb9742f0
1
.gitignore
vendored
1
.gitignore
vendored
@ -402,3 +402,4 @@ test/etl_error_handler/assert_function/build-make
|
||||
test/syntax_check/bgcc
|
||||
test/vs2022/Debug MSVC C++23
|
||||
test/vs2022/Debug MSVC C++23 - No STL
|
||||
.vs
|
||||
|
||||
@ -41,6 +41,7 @@ SOFTWARE.
|
||||
#include "type_traits.h"
|
||||
#include "functional.h"
|
||||
#include "nth_type.h"
|
||||
#include "span.h"
|
||||
|
||||
#include "private/comparator_is_transparent.h"
|
||||
|
||||
@ -391,7 +392,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR14 size_type full() const ETL_NOEXCEPT
|
||||
{
|
||||
return size() == max_elements;
|
||||
return (max_elements != 0) && (size() == max_elements);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -446,7 +447,7 @@ namespace etl
|
||||
/// Constructor
|
||||
//*************************************************************************
|
||||
template <typename... TElements>
|
||||
ETL_CONSTEXPR14 explicit iconst_map(value_type* element_list_, size_type size_, size_type max_elements_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 explicit iconst_map(const value_type* element_list_, size_type size_, size_type max_elements_) ETL_NOEXCEPT
|
||||
: element_list(element_list_)
|
||||
, element_list_end{element_list_ + size_}
|
||||
, max_elements(max_elements_)
|
||||
@ -475,9 +476,9 @@ namespace etl
|
||||
|
||||
value_compare vcompare;
|
||||
|
||||
value_type* element_list;
|
||||
value_type* element_list_end;
|
||||
size_type max_elements;
|
||||
const value_type* element_list;
|
||||
const value_type* element_list_end;
|
||||
size_type max_elements;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -490,22 +491,24 @@ namespace etl
|
||||
|
||||
using base_t = iconst_map<TKey, TMapped, TKeyCompare>;
|
||||
|
||||
using key_type = typename base_t::key_type;
|
||||
using value_type = typename base_t::value_type;
|
||||
using mapped_type = typename base_t::mapped_type ;
|
||||
using key_compare = typename base_t::key_compare;
|
||||
using const_reference = typename base_t::const_reference;
|
||||
using const_pointer = typename base_t::const_pointer;
|
||||
using const_iterator = typename base_t::const_iterator;
|
||||
using size_type = typename base_t::size_type;
|
||||
using key_type = typename base_t::key_type;
|
||||
using value_type = typename base_t::value_type;
|
||||
using mapped_type = typename base_t::mapped_type ;
|
||||
using key_compare = typename base_t::key_compare;
|
||||
using const_reference = typename base_t::const_reference;
|
||||
using const_pointer = typename base_t::const_pointer;
|
||||
using const_iterator = typename base_t::const_iterator;
|
||||
using size_type = typename base_t::size_type;
|
||||
|
||||
/// Defines the parameter types
|
||||
using const_key_reference = const key_type&;
|
||||
using const_mapped_reference = const mapped_type&;
|
||||
|
||||
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
|
||||
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Construct a const_map from a variadic list of elements.
|
||||
/// Static asserts if the element type is not constructible.
|
||||
/// Static asserts if the elements are not of type <code>value_type</code>.
|
||||
/// Static asserts if the number of elements is greater than the capacity of the const_map.
|
||||
//*************************************************************************
|
||||
@ -514,8 +517,6 @@ namespace etl
|
||||
: iconst_map<TKey, TMapped, TKeyCompare>(element_list, sizeof...(elements), Size)
|
||||
, element_list{etl::forward<TElements>(elements)...}
|
||||
{
|
||||
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
|
||||
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
|
||||
static_assert((etl::are_all_same<value_type, etl::decay_t<TElements>...>::value), "All elements must be value_type");
|
||||
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
|
||||
}
|
||||
@ -529,10 +530,74 @@ namespace etl
|
||||
/// Template deduction guides.
|
||||
//*************************************************************************
|
||||
#if ETL_USING_CPP17
|
||||
template <typename... TPairs>
|
||||
const_map(TPairs...) -> const_map<typename etl::nth_type_t<0, TPairs...>::first_type,
|
||||
typename etl::nth_type_t<0, TPairs...>::second_type,
|
||||
sizeof...(TPairs)>;
|
||||
template <typename... TElements>
|
||||
const_map(TElements...) -> const_map<typename etl::nth_type_t<0, TElements...>::first_type,
|
||||
typename etl::nth_type_t<0, TElements...>::second_type,
|
||||
sizeof...(TElements)>;
|
||||
#endif
|
||||
|
||||
//*********************************************************************
|
||||
/// Map type designed for constexpr.
|
||||
//*********************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey>>
|
||||
class const_map_ext : public iconst_map<TKey, TMapped, TKeyCompare>
|
||||
{
|
||||
public:
|
||||
|
||||
using base_t = iconst_map<TKey, TMapped, TKeyCompare>;
|
||||
|
||||
using key_type = typename base_t::key_type;
|
||||
using value_type = typename base_t::value_type;
|
||||
using mapped_type = typename base_t::mapped_type ;
|
||||
using key_compare = typename base_t::key_compare;
|
||||
using const_reference = typename base_t::const_reference;
|
||||
using const_pointer = typename base_t::const_pointer;
|
||||
using const_iterator = typename base_t::const_iterator;
|
||||
using size_type = typename base_t::size_type;
|
||||
|
||||
/// Defines the parameter types
|
||||
using const_key_reference = const key_type&;
|
||||
using const_mapped_reference = const mapped_type&;
|
||||
|
||||
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
|
||||
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Default construct a const_map.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR14 const_map_ext() ETL_NOEXCEPT
|
||||
: iconst_map<TKey, TMapped, TKeyCompare>(nullptr, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Construct a const_map from a variadic list of elements.
|
||||
//*************************************************************************
|
||||
template <size_type Size>
|
||||
ETL_CONSTEXPR14 explicit const_map_ext(const etl::span<const value_type, Size>& sp) ETL_NOEXCEPT
|
||||
: iconst_map<TKey, TMapped, TKeyCompare>(sp.data(), Size, Size)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Construct a const_map from an array.
|
||||
//*************************************************************************
|
||||
template <size_type Size>
|
||||
ETL_CONSTEXPR14 explicit const_map_ext(const value_type(&begin_)[Size]) ETL_NOEXCEPT
|
||||
: iconst_map<TKey, TMapped, TKeyCompare>(begin_, Size, Size)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
/// Template deduction guides.
|
||||
//*************************************************************************
|
||||
#if ETL_USING_CPP17
|
||||
template <typename TElements, size_t N>
|
||||
const_map_ext(const etl::span<TElements, N>&) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
|
||||
|
||||
template <typename TElements, size_t N>
|
||||
const_map_ext(const TElements(&)[N]) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
|
||||
#endif
|
||||
|
||||
//*************************************************************************
|
||||
@ -540,7 +605,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator ==(const etl::iconst_map<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return etl::equal(lhs.begin(), lhs.end(), rhs.begin());
|
||||
}
|
||||
@ -550,7 +615,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator !=(const etl::iconst_map<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
@ -560,7 +625,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator <(const etl::iconst_map<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return etl::lexicographical_compare(lhs.begin(), lhs.end(),
|
||||
rhs.begin(), rhs.end(),
|
||||
@ -572,7 +637,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator >(const etl::iconst_map<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return (rhs < lhs);
|
||||
}
|
||||
@ -582,7 +647,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator <=(const etl::iconst_map<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
@ -592,7 +657,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator >=(const etl::iconst_map<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_map<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ SOFTWARE.
|
||||
#ifndef ETL_CONST_MULTIMAP_INCLUDED
|
||||
#define ETL_CONST_MULTIMAP_INCLUDED
|
||||
|
||||
#include "platform.h"
|
||||
#include "platform.h"
|
||||
|
||||
#if ETL_NOT_USING_CPP11
|
||||
#error NOT SUPPORTED FOR C++03 OR BELOW
|
||||
@ -41,6 +41,7 @@ SOFTWARE.
|
||||
#include "type_traits.h"
|
||||
#include "functional.h"
|
||||
#include "nth_type.h"
|
||||
#include "span.h"
|
||||
|
||||
#include "private/comparator_is_transparent.h"
|
||||
|
||||
@ -54,14 +55,14 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
using key_type = TKey;
|
||||
using value_type = ETL_OR_STD::pair<const TKey, TMapped>;
|
||||
using mapped_type = TMapped ;
|
||||
using key_compare = TKeyCompare;
|
||||
using const_reference = const value_type&;
|
||||
using const_pointer = const value_type*;
|
||||
using const_iterator = const value_type*;
|
||||
using size_type = size_t;
|
||||
using key_type = TKey;
|
||||
using value_type = ETL_OR_STD::pair<const TKey, TMapped>;
|
||||
using mapped_type = TMapped ;
|
||||
using key_compare = TKeyCompare;
|
||||
using const_reference = const value_type&;
|
||||
using const_pointer = const value_type*;
|
||||
using const_iterator = const value_type*;
|
||||
using size_type = size_t;
|
||||
|
||||
/// Defines the parameter types
|
||||
using const_key_reference = const key_type&;
|
||||
@ -343,7 +344,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR14 size_type full() const ETL_NOEXCEPT
|
||||
{
|
||||
return size() == max_elements;
|
||||
return (max_elements != 0) && (size() == max_elements);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -398,7 +399,7 @@ namespace etl
|
||||
/// Constructor
|
||||
//*************************************************************************
|
||||
template <typename... TElements>
|
||||
ETL_CONSTEXPR14 explicit iconst_multimap(value_type* element_list_, size_type size_, size_type max_elements_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 explicit iconst_multimap(const value_type* element_list_, size_type size_, size_type max_elements_) ETL_NOEXCEPT
|
||||
: element_list(element_list_)
|
||||
, element_list_end{element_list_ + size_}
|
||||
, max_elements(max_elements_)
|
||||
@ -427,8 +428,8 @@ namespace etl
|
||||
|
||||
value_compare vcompare;
|
||||
|
||||
value_type* element_list;
|
||||
value_type* element_list_end;
|
||||
const value_type* element_list;
|
||||
const value_type* element_list_end;
|
||||
size_type max_elements;
|
||||
};
|
||||
|
||||
@ -455,6 +456,9 @@ namespace etl
|
||||
using const_key_reference = const key_type&;
|
||||
using const_mapped_reference = const mapped_type&;
|
||||
|
||||
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
|
||||
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Construct a const_map from a variadic list of elements.
|
||||
/// Static asserts if the element type is not constructible.
|
||||
@ -466,8 +470,6 @@ namespace etl
|
||||
: iconst_multimap<TKey, TMapped, TKeyCompare>(element_list, sizeof...(elements), Size)
|
||||
, element_list{etl::forward<TElements>(elements)...}
|
||||
{
|
||||
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
|
||||
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
|
||||
static_assert((etl::are_all_same<value_type, etl::decay_t<TElements>...>::value), "All elements must be value_type");
|
||||
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
|
||||
}
|
||||
@ -483,8 +485,72 @@ namespace etl
|
||||
#if ETL_USING_CPP17
|
||||
template <typename... TPairs>
|
||||
const_multimap(TPairs...) -> const_multimap<typename etl::nth_type_t<0, TPairs...>::first_type,
|
||||
typename etl::nth_type_t<0, TPairs...>::second_type,
|
||||
sizeof...(TPairs)>;
|
||||
typename etl::nth_type_t<0, TPairs...>::second_type,
|
||||
sizeof...(TPairs)>;
|
||||
#endif
|
||||
|
||||
//*********************************************************************
|
||||
/// Map type designed for constexpr.
|
||||
//*********************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey>>
|
||||
class const_multimap_ext : public iconst_multimap<TKey, TMapped, TKeyCompare>
|
||||
{
|
||||
public:
|
||||
|
||||
using base_t = iconst_multimap<TKey, TMapped, TKeyCompare>;
|
||||
|
||||
using key_type = typename base_t::key_type;
|
||||
using value_type = typename base_t::value_type;
|
||||
using mapped_type = typename base_t::mapped_type ;
|
||||
using key_compare = typename base_t::key_compare;
|
||||
using const_reference = typename base_t::const_reference;
|
||||
using const_pointer = typename base_t::const_pointer;
|
||||
using const_iterator = typename base_t::const_iterator;
|
||||
using size_type = typename base_t::size_type;
|
||||
|
||||
/// Defines the parameter types
|
||||
using const_key_reference = const key_type&;
|
||||
using const_mapped_reference = const mapped_type&;
|
||||
|
||||
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
|
||||
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Default construct a const_map.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR14 const_multimap_ext() ETL_NOEXCEPT
|
||||
: iconst_multimap<TKey, TMapped, TKeyCompare>(nullptr, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Construct a const_map from a variadic list of elements.
|
||||
//*************************************************************************
|
||||
template <size_type Size>
|
||||
ETL_CONSTEXPR14 explicit const_multimap_ext(const etl::span<const value_type, Size>& sp) ETL_NOEXCEPT
|
||||
: iconst_multimap<TKey, TMapped, TKeyCompare>(sp.data(), Size, Size)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
///\brief Construct a const_map from an array.
|
||||
//*************************************************************************
|
||||
template <size_type Size>
|
||||
ETL_CONSTEXPR14 explicit const_multimap_ext(const value_type(&begin_)[Size]) ETL_NOEXCEPT
|
||||
: iconst_multimap<TKey, TMapped, TKeyCompare>(begin_, Size, Size)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
/// Template deduction guides.
|
||||
//*************************************************************************
|
||||
#if ETL_USING_CPP17
|
||||
template <typename TElements, size_t N>
|
||||
const_multimap_ext(const etl::span<TElements, N>&) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
|
||||
|
||||
template <typename TElements, size_t N>
|
||||
const_multimap_ext(const TElements(&)[N]) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
|
||||
#endif
|
||||
|
||||
//*************************************************************************
|
||||
@ -492,7 +558,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator ==(const etl::iconst_multimap<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_multimap<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_multimap<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return etl::equal(lhs.begin(), lhs.end(), rhs.begin());
|
||||
}
|
||||
@ -502,7 +568,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TKey, typename TMapped, typename TKeyCompare>
|
||||
ETL_CONSTEXPR14 bool operator !=(const etl::iconst_multimap<TKey, TMapped, TKeyCompare>& lhs,
|
||||
const etl::iconst_multimap<TKey, TMapped, TKeyCompare>& rhs)
|
||||
const etl::iconst_multimap<TKey, TMapped, TKeyCompare>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@ -103,8 +103,10 @@ namespace
|
||||
using IDataTransparentComparator = etl::iconst_map<Key, int, etl::less<>>;
|
||||
#endif
|
||||
|
||||
using value_type = Data::value_type;
|
||||
using Data_const_iterator = Data::const_iterator;
|
||||
using value_type = Data::value_type;
|
||||
using key_type = Data::key_type;
|
||||
using mapped_type = Data::mapped_type;
|
||||
using const_iterator = Data::const_iterator;
|
||||
|
||||
SUITE(test_const_map)
|
||||
{
|
||||
@ -113,14 +115,14 @@ namespace
|
||||
{
|
||||
static const Data data;
|
||||
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const Data::const_iterator begin = data.begin();
|
||||
static const Data::const_iterator end = data.end();
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const const_iterator begin = data.begin();
|
||||
static const const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 0UL);
|
||||
@ -136,14 +138,14 @@ namespace
|
||||
{
|
||||
static const Data data{ value_type{Key('A'), 0 } };
|
||||
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const Data::const_iterator begin = data.begin();
|
||||
static const Data::const_iterator end = data.end();
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const const_iterator begin = data.begin();
|
||||
static const const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 1U);
|
||||
@ -165,14 +167,14 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const Data::const_iterator begin = data.begin();
|
||||
static const Data::const_iterator end = data.end();
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const const_iterator begin = data.begin();
|
||||
static const const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == Max_Size);
|
||||
@ -196,14 +198,14 @@ namespace
|
||||
|
||||
static const IData& idata = data;
|
||||
|
||||
static const bool is_valid = idata.is_valid();
|
||||
static const size_t size = idata.size();
|
||||
static const bool empty = idata.empty();
|
||||
static const bool full = idata.full();
|
||||
static const size_t capacity = idata.capacity();
|
||||
static const size_t max_size = idata.max_size();
|
||||
static const Data::const_iterator begin = idata.begin();
|
||||
static const Data::const_iterator end = idata.end();
|
||||
static const bool is_valid = idata.is_valid();
|
||||
static const size_t size = idata.size();
|
||||
static const bool empty = idata.empty();
|
||||
static const bool full = idata.full();
|
||||
static const size_t capacity = idata.capacity();
|
||||
static const size_t max_size = idata.max_size();
|
||||
static const const_iterator begin = idata.begin();
|
||||
static const const_iterator end = idata.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == Max_Size);
|
||||
@ -228,21 +230,11 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_cpp17_deduced_constructor)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
etl::const_map<Key, int, 10U> check{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const etl::const_map data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
etl::const_map<Key, int, 10U> check{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK_TRUE(data.size() == Max_Size);
|
||||
CHECK_FALSE(data.empty());
|
||||
@ -278,9 +270,9 @@ namespace
|
||||
TEST(test_end_const)
|
||||
{
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
|
||||
static const Data::const_iterator end_itr = data.end();
|
||||
static const const_iterator end_itr = data.end();
|
||||
|
||||
CHECK_TRUE(end_itr == (data.begin() + data.size()));
|
||||
}
|
||||
@ -296,16 +288,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::mapped_type atA = data[Key('A')];
|
||||
static const Data::mapped_type atB = data[Key('B')];
|
||||
static const Data::mapped_type atC = data[Key('C')];
|
||||
static const Data::mapped_type atD = data[Key('D')];
|
||||
static const Data::mapped_type atE = data[Key('E')];
|
||||
static const Data::mapped_type atF = data[Key('F')];
|
||||
static const Data::mapped_type atG = data[Key('G')];
|
||||
static const Data::mapped_type atH = data[Key('H')];
|
||||
static const Data::mapped_type atI = data[Key('I')];
|
||||
static const Data::mapped_type atJ = data[Key('J')];
|
||||
static const mapped_type atA = data[Key('A')];
|
||||
static const mapped_type atB = data[Key('B')];
|
||||
static const mapped_type atC = data[Key('C')];
|
||||
static const mapped_type atD = data[Key('D')];
|
||||
static const mapped_type atE = data[Key('E')];
|
||||
static const mapped_type atF = data[Key('F')];
|
||||
static const mapped_type atG = data[Key('G')];
|
||||
static const mapped_type atH = data[Key('H')];
|
||||
static const mapped_type atI = data[Key('I')];
|
||||
static const mapped_type atJ = data[Key('J')];
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -331,16 +323,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::mapped_type atA = data['A'];
|
||||
static const Data::mapped_type atB = data['B'];
|
||||
static const Data::mapped_type atC = data['C'];
|
||||
static const Data::mapped_type atD = data['D'];
|
||||
static const Data::mapped_type atE = data['E'];
|
||||
static const Data::mapped_type atF = data['F'];
|
||||
static const Data::mapped_type atG = data['G'];
|
||||
static const Data::mapped_type atH = data['H'];
|
||||
static const Data::mapped_type atI = data['I'];
|
||||
static const Data::mapped_type atJ = data['J'];
|
||||
static const mapped_type atA = data['A'];
|
||||
static const mapped_type atB = data['B'];
|
||||
static const mapped_type atC = data['C'];
|
||||
static const mapped_type atD = data['D'];
|
||||
static const mapped_type atE = data['E'];
|
||||
static const mapped_type atF = data['F'];
|
||||
static const mapped_type atG = data['G'];
|
||||
static const mapped_type atH = data['H'];
|
||||
static const mapped_type atI = data['I'];
|
||||
static const mapped_type atJ = data['J'];
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -366,16 +358,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::mapped_type atA = data.at(Key('A'));
|
||||
static const Data::mapped_type atB = data.at(Key('B'));
|
||||
static const Data::mapped_type atC = data.at(Key('C'));
|
||||
static const Data::mapped_type atD = data.at(Key('D'));
|
||||
static const Data::mapped_type atE = data.at(Key('E'));
|
||||
static const Data::mapped_type atF = data.at(Key('F'));
|
||||
static const Data::mapped_type atG = data.at(Key('G'));
|
||||
static const Data::mapped_type atH = data.at(Key('H'));
|
||||
static const Data::mapped_type atI = data.at(Key('I'));
|
||||
static const Data::mapped_type atJ = data.at(Key('J'));
|
||||
static const mapped_type atA = data.at(Key('A'));
|
||||
static const mapped_type atB = data.at(Key('B'));
|
||||
static const mapped_type atC = data.at(Key('C'));
|
||||
static const mapped_type atD = data.at(Key('D'));
|
||||
static const mapped_type atE = data.at(Key('E'));
|
||||
static const mapped_type atF = data.at(Key('F'));
|
||||
static const mapped_type atG = data.at(Key('G'));
|
||||
static const mapped_type atH = data.at(Key('H'));
|
||||
static const mapped_type atI = data.at(Key('I'));
|
||||
static const mapped_type atJ = data.at(Key('J'));
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -401,16 +393,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::mapped_type atA = data.at('A');
|
||||
static const Data::mapped_type atB = data.at('B');
|
||||
static const Data::mapped_type atC = data.at('C');
|
||||
static const Data::mapped_type atD = data.at('D');
|
||||
static const Data::mapped_type atE = data.at('E');
|
||||
static const Data::mapped_type atF = data.at('F');
|
||||
static const Data::mapped_type atG = data.at('G');
|
||||
static const Data::mapped_type atH = data.at('H');
|
||||
static const Data::mapped_type atI = data.at('I');
|
||||
static const Data::mapped_type atJ = data.at('J');
|
||||
static const mapped_type atA = data.at('A');
|
||||
static const mapped_type atB = data.at('B');
|
||||
static const mapped_type atC = data.at('C');
|
||||
static const mapped_type atD = data.at('D');
|
||||
static const mapped_type atE = data.at('E');
|
||||
static const mapped_type atF = data.at('F');
|
||||
static const mapped_type atG = data.at('G');
|
||||
static const mapped_type atH = data.at('H');
|
||||
static const mapped_type atI = data.at('I');
|
||||
static const mapped_type atJ = data.at('J');
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -436,16 +428,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -499,22 +491,22 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range('A');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range('B');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range('C');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range('D');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range('E');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range('F');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range('G');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range('H');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range('I');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range('J');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range('A');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range('B');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range('C');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range('D');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range('E');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range('F');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range('G');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range('H');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range('I');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -568,23 +560,23 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('K'), 10 }, value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('E'), 4 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static const Data::const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static const Data::const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static const Data::const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static const Data::const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static const Data::const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static const Data::const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static const Data::const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static const Data::const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static const Data::const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static const Data::const_iterator resultK = data.lower_bound(Key('K'));
|
||||
static const const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static const const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static const const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static const const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static const const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static const const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static const const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static const const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static const const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static const const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static const const_iterator resultK = data.lower_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -618,23 +610,23 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('K'), 10 }, value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('E'), 4 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.lower_bound('A');
|
||||
static const Data::const_iterator resultB = data.lower_bound('B');
|
||||
static const Data::const_iterator resultC = data.lower_bound('C');
|
||||
static const Data::const_iterator resultD = data.lower_bound('D');
|
||||
static const Data::const_iterator resultE = data.lower_bound('E');
|
||||
static const Data::const_iterator resultF = data.lower_bound('F');
|
||||
static const Data::const_iterator resultG = data.lower_bound('G');
|
||||
static const Data::const_iterator resultH = data.lower_bound('H');
|
||||
static const Data::const_iterator resultI = data.lower_bound('I');
|
||||
static const Data::const_iterator resultJ = data.lower_bound('J');
|
||||
static const Data::const_iterator resultK = data.lower_bound('K');
|
||||
static const const_iterator resultA = data.lower_bound('A');
|
||||
static const const_iterator resultB = data.lower_bound('B');
|
||||
static const const_iterator resultC = data.lower_bound('C');
|
||||
static const const_iterator resultD = data.lower_bound('D');
|
||||
static const const_iterator resultE = data.lower_bound('E');
|
||||
static const const_iterator resultF = data.lower_bound('F');
|
||||
static const const_iterator resultG = data.lower_bound('G');
|
||||
static const const_iterator resultH = data.lower_bound('H');
|
||||
static const const_iterator resultI = data.lower_bound('I');
|
||||
static const const_iterator resultJ = data.lower_bound('J');
|
||||
static const const_iterator resultK = data.lower_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -668,23 +660,23 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('K'), 10 }, value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('E'), 4 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static const Data::const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static const Data::const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static const Data::const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static const Data::const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static const Data::const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static const Data::const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static const Data::const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static const Data::const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static const Data::const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static const Data::const_iterator resultK = data.upper_bound(Key('K'));
|
||||
static const const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static const const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static const const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static const const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static const const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static const const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static const const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static const const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static const const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static const const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static const const_iterator resultK = data.upper_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -718,23 +710,23 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('K'), 10 }, value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('E'), 4 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('E'), 4 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.upper_bound('A');
|
||||
static const Data::const_iterator resultB = data.upper_bound('B');
|
||||
static const Data::const_iterator resultC = data.upper_bound('C');
|
||||
static const Data::const_iterator resultD = data.upper_bound('D');
|
||||
static const Data::const_iterator resultE = data.upper_bound('E');
|
||||
static const Data::const_iterator resultF = data.upper_bound('F');
|
||||
static const Data::const_iterator resultG = data.upper_bound('G');
|
||||
static const Data::const_iterator resultH = data.upper_bound('H');
|
||||
static const Data::const_iterator resultI = data.upper_bound('I');
|
||||
static const Data::const_iterator resultJ = data.upper_bound('J');
|
||||
static const Data::const_iterator resultK = data.upper_bound('K');
|
||||
static const const_iterator resultA = data.upper_bound('A');
|
||||
static const const_iterator resultB = data.upper_bound('B');
|
||||
static const const_iterator resultC = data.upper_bound('C');
|
||||
static const const_iterator resultD = data.upper_bound('D');
|
||||
static const const_iterator resultE = data.upper_bound('E');
|
||||
static const const_iterator resultF = data.upper_bound('F');
|
||||
static const const_iterator resultG = data.upper_bound('G');
|
||||
static const const_iterator resultH = data.upper_bound('H');
|
||||
static const const_iterator resultI = data.upper_bound('I');
|
||||
static const const_iterator resultJ = data.upper_bound('J');
|
||||
static const const_iterator resultK = data.upper_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -768,10 +760,10 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const size_t countA = data.count(Key('A'));
|
||||
@ -804,10 +796,10 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const size_t countA = data.count('A');
|
||||
@ -840,13 +832,13 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
Data::const_iterator itr = data.begin();
|
||||
const_iterator itr = data.begin();
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_TRUE((value_type{Key('J'), 9 }) == *itr++);
|
||||
@ -880,22 +872,22 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.find(Key('A'));
|
||||
static const Data::const_iterator resultB = data.find(Key('B'));
|
||||
static const Data::const_iterator resultC = data.find(Key('C'));
|
||||
static const Data::const_iterator resultD = data.find(Key('D'));
|
||||
static const Data::const_iterator resultE = data.find(Key('E'));
|
||||
static const Data::const_iterator resultF = data.find(Key('F'));
|
||||
static const Data::const_iterator resultG = data.find(Key('G'));
|
||||
static const Data::const_iterator resultH = data.find(Key('H'));
|
||||
static const Data::const_iterator resultI = data.find(Key('I'));
|
||||
static const Data::const_iterator resultJ = data.find(Key('J'));
|
||||
static const const_iterator resultA = data.find(Key('A'));
|
||||
static const const_iterator resultB = data.find(Key('B'));
|
||||
static const const_iterator resultC = data.find(Key('C'));
|
||||
static const const_iterator resultD = data.find(Key('D'));
|
||||
static const const_iterator resultE = data.find(Key('E'));
|
||||
static const const_iterator resultF = data.find(Key('F'));
|
||||
static const const_iterator resultG = data.find(Key('G'));
|
||||
static const const_iterator resultH = data.find(Key('H'));
|
||||
static const const_iterator resultI = data.find(Key('I'));
|
||||
static const const_iterator resultJ = data.find(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -927,22 +919,22 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.find('A');
|
||||
static const Data::const_iterator resultB = data.find('B');
|
||||
static const Data::const_iterator resultC = data.find('C');
|
||||
static const Data::const_iterator resultD = data.find('D');
|
||||
static const Data::const_iterator resultE = data.find('E');
|
||||
static const Data::const_iterator resultF = data.find('F');
|
||||
static const Data::const_iterator resultG = data.find('G');
|
||||
static const Data::const_iterator resultH = data.find('H');
|
||||
static const Data::const_iterator resultI = data.find('I');
|
||||
static const Data::const_iterator resultJ = data.find('J');
|
||||
static const const_iterator resultA = data.find('A');
|
||||
static const const_iterator resultB = data.find('B');
|
||||
static const const_iterator resultC = data.find('C');
|
||||
static const const_iterator resultD = data.find('D');
|
||||
static const const_iterator resultE = data.find('E');
|
||||
static const const_iterator resultF = data.find('F');
|
||||
static const const_iterator resultG = data.find('G');
|
||||
static const const_iterator resultH = data.find('H');
|
||||
static const const_iterator resultI = data.find('I');
|
||||
static const const_iterator resultJ = data.find('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -1031,10 +1023,10 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const bool containsA = data.contains(Key('A'));
|
||||
@ -1067,10 +1059,10 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const bool containsA = data.contains('A');
|
||||
|
||||
@ -35,6 +35,7 @@ SOFTWARE.
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <span>
|
||||
|
||||
#include "etl/const_map.h"
|
||||
#include "etl/map.h"
|
||||
@ -105,8 +106,10 @@ namespace
|
||||
using IDataTransparentComparator = etl::iconst_map<Key, int, etl::less<>>;
|
||||
#endif
|
||||
|
||||
using value_type = Data::value_type;
|
||||
using Data_const_iterator = Data::const_iterator;
|
||||
using value_type = Data::value_type;
|
||||
using key_type = Data::key_type;
|
||||
using mapped_type = Data::mapped_type;
|
||||
using const_iterator = Data::const_iterator;
|
||||
|
||||
SUITE(test_const_map)
|
||||
{
|
||||
@ -115,14 +118,14 @@ namespace
|
||||
{
|
||||
static constexpr Data data;
|
||||
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr Data::const_iterator begin = data.begin();
|
||||
static constexpr Data::const_iterator end = data.end();
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr const_iterator begin = data.begin();
|
||||
static constexpr const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 0UL);
|
||||
@ -138,14 +141,14 @@ namespace
|
||||
{
|
||||
static constexpr Data data{ value_type{Key('A'), 0 } };
|
||||
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr Data::const_iterator begin = data.begin();
|
||||
static constexpr Data::const_iterator end = data.end();
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr const_iterator begin = data.begin();
|
||||
static constexpr const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 1U);
|
||||
@ -167,14 +170,14 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr Data::const_iterator begin = data.begin();
|
||||
static constexpr Data::const_iterator end = data.end();
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr const_iterator begin = data.begin();
|
||||
static constexpr const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == Max_Size);
|
||||
@ -198,14 +201,14 @@ namespace
|
||||
|
||||
static constexpr const IData& idata = data;
|
||||
|
||||
static constexpr bool is_valid = idata.is_valid();
|
||||
static constexpr size_t size = idata.size();
|
||||
static constexpr bool empty = idata.empty();
|
||||
static constexpr bool full = idata.full();
|
||||
static constexpr size_t capacity = idata.capacity();
|
||||
static constexpr size_t max_size = idata.max_size();
|
||||
static constexpr Data::const_iterator begin = idata.begin();
|
||||
static constexpr Data::const_iterator end = idata.end();
|
||||
static constexpr bool is_valid = idata.is_valid();
|
||||
static constexpr size_t size = idata.size();
|
||||
static constexpr bool empty = idata.empty();
|
||||
static constexpr bool full = idata.full();
|
||||
static constexpr size_t capacity = idata.capacity();
|
||||
static constexpr size_t max_size = idata.max_size();
|
||||
static constexpr const_iterator begin = idata.begin();
|
||||
static constexpr const_iterator end = idata.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == Max_Size);
|
||||
@ -230,21 +233,11 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_cpp17_deduced_constructor)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static constexpr Data data{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static constexpr Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
etl::const_map<Key, int, 10U> check{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static constexpr etl::const_map data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
etl::const_map<Key, int, 10U> check{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK_TRUE(data.size() == Max_Size);
|
||||
CHECK_FALSE(data.empty());
|
||||
@ -282,7 +275,7 @@ namespace
|
||||
static constexpr Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
|
||||
static constexpr Data::const_iterator end_itr = data.end();
|
||||
static constexpr const_iterator end_itr = data.end();
|
||||
|
||||
CHECK_TRUE(end_itr == (data.begin() + data.size()));
|
||||
}
|
||||
@ -298,16 +291,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::mapped_type atA = data[Key('A')];
|
||||
static constexpr Data::mapped_type atB = data[Key('B')];
|
||||
static constexpr Data::mapped_type atC = data[Key('C')];
|
||||
static constexpr Data::mapped_type atD = data[Key('D')];
|
||||
static constexpr Data::mapped_type atE = data[Key('E')];
|
||||
static constexpr Data::mapped_type atF = data[Key('F')];
|
||||
static constexpr Data::mapped_type atG = data[Key('G')];
|
||||
static constexpr Data::mapped_type atH = data[Key('H')];
|
||||
static constexpr Data::mapped_type atI = data[Key('I')];
|
||||
static constexpr Data::mapped_type atJ = data[Key('J')];
|
||||
static constexpr mapped_type atA = data[Key('A')];
|
||||
static constexpr mapped_type atB = data[Key('B')];
|
||||
static constexpr mapped_type atC = data[Key('C')];
|
||||
static constexpr mapped_type atD = data[Key('D')];
|
||||
static constexpr mapped_type atE = data[Key('E')];
|
||||
static constexpr mapped_type atF = data[Key('F')];
|
||||
static constexpr mapped_type atG = data[Key('G')];
|
||||
static constexpr mapped_type atH = data[Key('H')];
|
||||
static constexpr mapped_type atI = data[Key('I')];
|
||||
static constexpr mapped_type atJ = data[Key('J')];
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -333,16 +326,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::mapped_type atA = data['A'];
|
||||
static constexpr Data::mapped_type atB = data['B'];
|
||||
static constexpr Data::mapped_type atC = data['C'];
|
||||
static constexpr Data::mapped_type atD = data['D'];
|
||||
static constexpr Data::mapped_type atE = data['E'];
|
||||
static constexpr Data::mapped_type atF = data['F'];
|
||||
static constexpr Data::mapped_type atG = data['G'];
|
||||
static constexpr Data::mapped_type atH = data['H'];
|
||||
static constexpr Data::mapped_type atI = data['I'];
|
||||
static constexpr Data::mapped_type atJ = data['J'];
|
||||
static constexpr mapped_type atA = data['A'];
|
||||
static constexpr mapped_type atB = data['B'];
|
||||
static constexpr mapped_type atC = data['C'];
|
||||
static constexpr mapped_type atD = data['D'];
|
||||
static constexpr mapped_type atE = data['E'];
|
||||
static constexpr mapped_type atF = data['F'];
|
||||
static constexpr mapped_type atG = data['G'];
|
||||
static constexpr mapped_type atH = data['H'];
|
||||
static constexpr mapped_type atI = data['I'];
|
||||
static constexpr mapped_type atJ = data['J'];
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -368,16 +361,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::mapped_type atA = data.at(Key('A'));
|
||||
static constexpr Data::mapped_type atB = data.at(Key('B'));
|
||||
static constexpr Data::mapped_type atC = data.at(Key('C'));
|
||||
static constexpr Data::mapped_type atD = data.at(Key('D'));
|
||||
static constexpr Data::mapped_type atE = data.at(Key('E'));
|
||||
static constexpr Data::mapped_type atF = data.at(Key('F'));
|
||||
static constexpr Data::mapped_type atG = data.at(Key('G'));
|
||||
static constexpr Data::mapped_type atH = data.at(Key('H'));
|
||||
static constexpr Data::mapped_type atI = data.at(Key('I'));
|
||||
static constexpr Data::mapped_type atJ = data.at(Key('J'));
|
||||
static constexpr mapped_type atA = data.at(Key('A'));
|
||||
static constexpr mapped_type atB = data.at(Key('B'));
|
||||
static constexpr mapped_type atC = data.at(Key('C'));
|
||||
static constexpr mapped_type atD = data.at(Key('D'));
|
||||
static constexpr mapped_type atE = data.at(Key('E'));
|
||||
static constexpr mapped_type atF = data.at(Key('F'));
|
||||
static constexpr mapped_type atG = data.at(Key('G'));
|
||||
static constexpr mapped_type atH = data.at(Key('H'));
|
||||
static constexpr mapped_type atI = data.at(Key('I'));
|
||||
static constexpr mapped_type atJ = data.at(Key('J'));
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -403,16 +396,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::mapped_type atA = data.at('A');
|
||||
static constexpr Data::mapped_type atB = data.at('B');
|
||||
static constexpr Data::mapped_type atC = data.at('C');
|
||||
static constexpr Data::mapped_type atD = data.at('D');
|
||||
static constexpr Data::mapped_type atE = data.at('E');
|
||||
static constexpr Data::mapped_type atF = data.at('F');
|
||||
static constexpr Data::mapped_type atG = data.at('G');
|
||||
static constexpr Data::mapped_type atH = data.at('H');
|
||||
static constexpr Data::mapped_type atI = data.at('I');
|
||||
static constexpr Data::mapped_type atJ = data.at('J');
|
||||
static constexpr mapped_type atA = data.at('A');
|
||||
static constexpr mapped_type atB = data.at('B');
|
||||
static constexpr mapped_type atC = data.at('C');
|
||||
static constexpr mapped_type atD = data.at('D');
|
||||
static constexpr mapped_type atE = data.at('E');
|
||||
static constexpr mapped_type atF = data.at('F');
|
||||
static constexpr mapped_type atG = data.at('G');
|
||||
static constexpr mapped_type atH = data.at('H');
|
||||
static constexpr mapped_type atI = data.at('I');
|
||||
static constexpr mapped_type atJ = data.at('J');
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK(atA == 0);
|
||||
@ -438,16 +431,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -507,16 +500,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range('A');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range('B');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range('C');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range('D');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range('E');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range('F');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range('G');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range('H');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range('I');
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range('J');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range('A');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range('B');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range('C');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range('D');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range('E');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range('F');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range('G');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range('H');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range('I');
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -576,17 +569,17 @@ namespace
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static constexpr Data::const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static constexpr Data::const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static constexpr Data::const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static constexpr Data::const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static constexpr Data::const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static constexpr Data::const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static constexpr Data::const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static constexpr Data::const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static constexpr Data::const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static constexpr Data::const_iterator resultK = data.lower_bound(Key('K'));
|
||||
static constexpr const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static constexpr const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static constexpr const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static constexpr const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static constexpr const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static constexpr const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static constexpr const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static constexpr const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static constexpr const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static constexpr const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static constexpr const_iterator resultK = data.lower_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -626,17 +619,17 @@ namespace
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.lower_bound('A');
|
||||
static constexpr Data::const_iterator resultB = data.lower_bound('B');
|
||||
static constexpr Data::const_iterator resultC = data.lower_bound('C');
|
||||
static constexpr Data::const_iterator resultD = data.lower_bound('D');
|
||||
static constexpr Data::const_iterator resultE = data.lower_bound('E');
|
||||
static constexpr Data::const_iterator resultF = data.lower_bound('F');
|
||||
static constexpr Data::const_iterator resultG = data.lower_bound('G');
|
||||
static constexpr Data::const_iterator resultH = data.lower_bound('H');
|
||||
static constexpr Data::const_iterator resultI = data.lower_bound('I');
|
||||
static constexpr Data::const_iterator resultJ = data.lower_bound('J');
|
||||
static constexpr Data::const_iterator resultK = data.lower_bound('K');
|
||||
static constexpr const_iterator resultA = data.lower_bound('A');
|
||||
static constexpr const_iterator resultB = data.lower_bound('B');
|
||||
static constexpr const_iterator resultC = data.lower_bound('C');
|
||||
static constexpr const_iterator resultD = data.lower_bound('D');
|
||||
static constexpr const_iterator resultE = data.lower_bound('E');
|
||||
static constexpr const_iterator resultF = data.lower_bound('F');
|
||||
static constexpr const_iterator resultG = data.lower_bound('G');
|
||||
static constexpr const_iterator resultH = data.lower_bound('H');
|
||||
static constexpr const_iterator resultI = data.lower_bound('I');
|
||||
static constexpr const_iterator resultJ = data.lower_bound('J');
|
||||
static constexpr const_iterator resultK = data.lower_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -676,17 +669,17 @@ namespace
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static constexpr Data::const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static constexpr Data::const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static constexpr Data::const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static constexpr Data::const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static constexpr Data::const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static constexpr Data::const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static constexpr Data::const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static constexpr Data::const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static constexpr Data::const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static constexpr Data::const_iterator resultK = data.upper_bound(Key('K'));
|
||||
static constexpr const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static constexpr const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static constexpr const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static constexpr const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static constexpr const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static constexpr const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static constexpr const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static constexpr const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static constexpr const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static constexpr const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static constexpr const_iterator resultK = data.upper_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -726,17 +719,17 @@ namespace
|
||||
value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 }, value_type{Key('K'), 10 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.upper_bound('A');
|
||||
static constexpr Data::const_iterator resultB = data.upper_bound('B');
|
||||
static constexpr Data::const_iterator resultC = data.upper_bound('C');
|
||||
static constexpr Data::const_iterator resultD = data.upper_bound('D');
|
||||
static constexpr Data::const_iterator resultE = data.upper_bound('E');
|
||||
static constexpr Data::const_iterator resultF = data.upper_bound('F');
|
||||
static constexpr Data::const_iterator resultG = data.upper_bound('G');
|
||||
static constexpr Data::const_iterator resultH = data.upper_bound('H');
|
||||
static constexpr Data::const_iterator resultI = data.upper_bound('I');
|
||||
static constexpr Data::const_iterator resultJ = data.upper_bound('J');
|
||||
static constexpr Data::const_iterator resultK = data.upper_bound('K');
|
||||
static constexpr const_iterator resultA = data.upper_bound('A');
|
||||
static constexpr const_iterator resultB = data.upper_bound('B');
|
||||
static constexpr const_iterator resultC = data.upper_bound('C');
|
||||
static constexpr const_iterator resultD = data.upper_bound('D');
|
||||
static constexpr const_iterator resultE = data.upper_bound('E');
|
||||
static constexpr const_iterator resultF = data.upper_bound('F');
|
||||
static constexpr const_iterator resultG = data.upper_bound('G');
|
||||
static constexpr const_iterator resultH = data.upper_bound('H');
|
||||
static constexpr const_iterator resultI = data.upper_bound('I');
|
||||
static constexpr const_iterator resultJ = data.upper_bound('J');
|
||||
static constexpr const_iterator resultK = data.upper_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -848,7 +841,7 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
Data::const_iterator itr = data.begin();
|
||||
const_iterator itr = data.begin();
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_TRUE((value_type{Key('J'), 9 }) == *itr++);
|
||||
@ -888,16 +881,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.find(Key('A'));
|
||||
static constexpr Data::const_iterator resultB = data.find(Key('B'));
|
||||
static constexpr Data::const_iterator resultC = data.find(Key('C'));
|
||||
static constexpr Data::const_iterator resultD = data.find(Key('D'));
|
||||
static constexpr Data::const_iterator resultE = data.find(Key('E'));
|
||||
static constexpr Data::const_iterator resultF = data.find(Key('F'));
|
||||
static constexpr Data::const_iterator resultG = data.find(Key('G'));
|
||||
static constexpr Data::const_iterator resultH = data.find(Key('H'));
|
||||
static constexpr Data::const_iterator resultI = data.find(Key('I'));
|
||||
static constexpr Data::const_iterator resultJ = data.find(Key('J'));
|
||||
static constexpr const_iterator resultA = data.find(Key('A'));
|
||||
static constexpr const_iterator resultB = data.find(Key('B'));
|
||||
static constexpr const_iterator resultC = data.find(Key('C'));
|
||||
static constexpr const_iterator resultD = data.find(Key('D'));
|
||||
static constexpr const_iterator resultE = data.find(Key('E'));
|
||||
static constexpr const_iterator resultF = data.find(Key('F'));
|
||||
static constexpr const_iterator resultG = data.find(Key('G'));
|
||||
static constexpr const_iterator resultH = data.find(Key('H'));
|
||||
static constexpr const_iterator resultI = data.find(Key('I'));
|
||||
static constexpr const_iterator resultJ = data.find(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -935,16 +928,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.find('A');
|
||||
static constexpr Data::const_iterator resultB = data.find('B');
|
||||
static constexpr Data::const_iterator resultC = data.find('C');
|
||||
static constexpr Data::const_iterator resultD = data.find('D');
|
||||
static constexpr Data::const_iterator resultE = data.find('E');
|
||||
static constexpr Data::const_iterator resultF = data.find('F');
|
||||
static constexpr Data::const_iterator resultG = data.find('G');
|
||||
static constexpr Data::const_iterator resultH = data.find('H');
|
||||
static constexpr Data::const_iterator resultI = data.find('I');
|
||||
static constexpr Data::const_iterator resultJ = data.find('J');
|
||||
static constexpr const_iterator resultA = data.find('A');
|
||||
static constexpr const_iterator resultB = data.find('B');
|
||||
static constexpr const_iterator resultC = data.find('C');
|
||||
static constexpr const_iterator resultD = data.find('D');
|
||||
static constexpr const_iterator resultE = data.find('E');
|
||||
static constexpr const_iterator resultF = data.find('F');
|
||||
static constexpr const_iterator resultG = data.find('G');
|
||||
static constexpr const_iterator resultH = data.find('H');
|
||||
static constexpr const_iterator resultI = data.find('I');
|
||||
static constexpr const_iterator resultJ = data.find('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
|
||||
1689
test/test_const_map_ext.cpp
Normal file
1689
test/test_const_map_ext.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1689
test/test_const_map_ext_constexpr.cpp
Normal file
1689
test/test_const_map_ext_constexpr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -102,8 +102,10 @@ namespace
|
||||
using IDataTransparentComparator = etl::iconst_multimap<Key, int, etl::less<>>;
|
||||
#endif
|
||||
|
||||
using value_type = Data::value_type;
|
||||
using Data_const_iterator = Data::const_iterator;
|
||||
using value_type = Data::value_type;
|
||||
using key_type = Data::key_type;
|
||||
using mapped_type = Data::mapped_type;
|
||||
using const_iterator = Data::const_iterator;
|
||||
|
||||
SUITE(test_const_multimap)
|
||||
{
|
||||
@ -112,14 +114,14 @@ namespace
|
||||
{
|
||||
static const Data data;
|
||||
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const Data::const_iterator begin = data.begin();
|
||||
static const Data::const_iterator end = data.end();
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const const_iterator begin = data.begin();
|
||||
static const const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 0UL);
|
||||
@ -135,14 +137,14 @@ namespace
|
||||
{
|
||||
static const Data data{ value_type{Key('A'), 0 } };
|
||||
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const Data::const_iterator begin = data.begin();
|
||||
static const Data::const_iterator end = data.end();
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const const_iterator begin = data.begin();
|
||||
static const const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 1U);
|
||||
@ -158,20 +160,20 @@ namespace
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const Data::const_iterator begin = data.begin();
|
||||
static const Data::const_iterator end = data.end();
|
||||
static const bool is_valid = data.is_valid();
|
||||
static const size_t size = data.size();
|
||||
static const bool empty = data.empty();
|
||||
static const bool full = data.full();
|
||||
static const size_t capacity = data.capacity();
|
||||
static const size_t max_size = data.max_size();
|
||||
static const const_iterator begin = data.begin();
|
||||
static const const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == Max_Size);
|
||||
@ -196,21 +198,12 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_cpp17_deduced_constructor)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
static const etl::const_multimap data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
etl::const_multimap<Key, int, 10U> check{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
etl::const_multimap<Key, int, 10U> check{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK_TRUE(data.size() == Max_Size);
|
||||
CHECK_FALSE(data.empty());
|
||||
@ -248,7 +241,7 @@ namespace
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
|
||||
static const Data::const_iterator end_itr = data.end();
|
||||
static const const_iterator end_itr = data.end();
|
||||
|
||||
CHECK_TRUE(end_itr == (data.begin() + data.size()));
|
||||
}
|
||||
@ -264,16 +257,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -333,16 +326,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range('A');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range('B');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range('C');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range('D');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range('E');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range('F');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range('G');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range('H');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range('I');
|
||||
static const ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range('J');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range('A');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range('B');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range('C');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range('D');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range('E');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range('F');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range('G');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range('H');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range('I');
|
||||
static const ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -395,24 +388,24 @@ namespace
|
||||
TEST(test_lower_bound_const)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static const Data::const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static const Data::const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static const Data::const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static const Data::const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static const Data::const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static const Data::const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static const Data::const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static const Data::const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static const Data::const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static const Data::const_iterator resultK = data.lower_bound(Key('K'));
|
||||
static const const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static const const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static const const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static const const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static const const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static const const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static const const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static const const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static const const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static const const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static const const_iterator resultK = data.lower_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -452,17 +445,17 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.lower_bound('A');
|
||||
static const Data::const_iterator resultB = data.lower_bound('B');
|
||||
static const Data::const_iterator resultC = data.lower_bound('C');
|
||||
static const Data::const_iterator resultD = data.lower_bound('D');
|
||||
static const Data::const_iterator resultE = data.lower_bound('E');
|
||||
static const Data::const_iterator resultF = data.lower_bound('F');
|
||||
static const Data::const_iterator resultG = data.lower_bound('G');
|
||||
static const Data::const_iterator resultH = data.lower_bound('H');
|
||||
static const Data::const_iterator resultI = data.lower_bound('I');
|
||||
static const Data::const_iterator resultJ = data.lower_bound('J');
|
||||
static const Data::const_iterator resultK = data.lower_bound('K');
|
||||
static const const_iterator resultA = data.lower_bound('A');
|
||||
static const const_iterator resultB = data.lower_bound('B');
|
||||
static const const_iterator resultC = data.lower_bound('C');
|
||||
static const const_iterator resultD = data.lower_bound('D');
|
||||
static const const_iterator resultE = data.lower_bound('E');
|
||||
static const const_iterator resultF = data.lower_bound('F');
|
||||
static const const_iterator resultG = data.lower_bound('G');
|
||||
static const const_iterator resultH = data.lower_bound('H');
|
||||
static const const_iterator resultI = data.lower_bound('I');
|
||||
static const const_iterator resultJ = data.lower_bound('J');
|
||||
static const const_iterator resultK = data.lower_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -495,24 +488,24 @@ namespace
|
||||
TEST(test_upper_bound_const)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static const Data::const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static const Data::const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static const Data::const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static const Data::const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static const Data::const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static const Data::const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static const Data::const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static const Data::const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static const Data::const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static const Data::const_iterator resultK = data.upper_bound(Key('K'));
|
||||
static const const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static const const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static const const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static const const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static const const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static const const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static const const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static const const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static const const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static const const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static const const_iterator resultK = data.upper_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -552,17 +545,17 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.upper_bound('A');
|
||||
static const Data::const_iterator resultB = data.upper_bound('B');
|
||||
static const Data::const_iterator resultC = data.upper_bound('C');
|
||||
static const Data::const_iterator resultD = data.upper_bound('D');
|
||||
static const Data::const_iterator resultE = data.upper_bound('E');
|
||||
static const Data::const_iterator resultF = data.upper_bound('F');
|
||||
static const Data::const_iterator resultG = data.upper_bound('G');
|
||||
static const Data::const_iterator resultH = data.upper_bound('H');
|
||||
static const Data::const_iterator resultI = data.upper_bound('I');
|
||||
static const Data::const_iterator resultJ = data.upper_bound('J');
|
||||
static const Data::const_iterator resultK = data.upper_bound('K');
|
||||
static const const_iterator resultA = data.upper_bound('A');
|
||||
static const const_iterator resultB = data.upper_bound('B');
|
||||
static const const_iterator resultC = data.upper_bound('C');
|
||||
static const const_iterator resultD = data.upper_bound('D');
|
||||
static const const_iterator resultE = data.upper_bound('E');
|
||||
static const const_iterator resultF = data.upper_bound('F');
|
||||
static const const_iterator resultG = data.upper_bound('G');
|
||||
static const const_iterator resultH = data.upper_bound('H');
|
||||
static const const_iterator resultI = data.upper_bound('I');
|
||||
static const const_iterator resultJ = data.upper_bound('J');
|
||||
static const const_iterator resultK = data.upper_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -595,11 +588,11 @@ namespace
|
||||
TEST(test_count_const)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
CHECK_EQUAL(1, data.count(Key('A')));
|
||||
@ -643,14 +636,14 @@ namespace
|
||||
TEST(test_const_iterator)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
Data::const_iterator itr = data.begin();
|
||||
const_iterator itr = data.begin();
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_TRUE((value_type{Key('J'), 9 }) == *itr++);
|
||||
@ -683,23 +676,23 @@ namespace
|
||||
TEST(test_find_const)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.find(Key('A'));
|
||||
static const Data::const_iterator resultB = data.find(Key('B'));
|
||||
static const Data::const_iterator resultC = data.find(Key('C'));
|
||||
static const Data::const_iterator resultD = data.find(Key('D'));
|
||||
static const Data::const_iterator resultE = data.find(Key('E'));
|
||||
static const Data::const_iterator resultF = data.find(Key('F'));
|
||||
static const Data::const_iterator resultG = data.find(Key('G'));
|
||||
static const Data::const_iterator resultH = data.find(Key('H'));
|
||||
static const Data::const_iterator resultI = data.find(Key('I'));
|
||||
static const Data::const_iterator resultJ = data.find(Key('J'));
|
||||
static const const_iterator resultA = data.find(Key('A'));
|
||||
static const const_iterator resultB = data.find(Key('B'));
|
||||
static const const_iterator resultC = data.find(Key('C'));
|
||||
static const const_iterator resultD = data.find(Key('D'));
|
||||
static const const_iterator resultE = data.find(Key('E'));
|
||||
static const const_iterator resultF = data.find(Key('F'));
|
||||
static const const_iterator resultG = data.find(Key('G'));
|
||||
static const const_iterator resultH = data.find(Key('H'));
|
||||
static const const_iterator resultI = data.find(Key('I'));
|
||||
static const const_iterator resultJ = data.find(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -737,16 +730,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const Data::const_iterator resultA = data.find('A');
|
||||
static const Data::const_iterator resultB = data.find('B');
|
||||
static const Data::const_iterator resultC = data.find('C');
|
||||
static const Data::const_iterator resultD = data.find('D');
|
||||
static const Data::const_iterator resultE = data.find('E');
|
||||
static const Data::const_iterator resultF = data.find('F');
|
||||
static const Data::const_iterator resultG = data.find('G');
|
||||
static const Data::const_iterator resultH = data.find('H');
|
||||
static const Data::const_iterator resultI = data.find('I');
|
||||
static const Data::const_iterator resultJ = data.find('J');
|
||||
static const const_iterator resultA = data.find('A');
|
||||
static const const_iterator resultB = data.find('B');
|
||||
static const const_iterator resultC = data.find('C');
|
||||
static const const_iterator resultD = data.find('D');
|
||||
static const const_iterator resultE = data.find('E');
|
||||
static const const_iterator resultF = data.find('F');
|
||||
static const const_iterator resultG = data.find('G');
|
||||
static const const_iterator resultH = data.find('H');
|
||||
static const const_iterator resultI = data.find('I');
|
||||
static const const_iterator resultJ = data.find('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -777,11 +770,11 @@ namespace
|
||||
TEST(test_contains_const)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static const DataTransparentComparator data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
static const Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static const DataTransparentComparator data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
static const Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static const bool containsA = data.contains(Key('A'));
|
||||
|
||||
@ -104,8 +104,10 @@ namespace
|
||||
using IDataTransparentComparator = etl::iconst_multimap<Key, int, etl::less<>>;
|
||||
#endif
|
||||
|
||||
using value_type = Data::value_type;
|
||||
using Data_const_iterator = Data::const_iterator;
|
||||
using value_type = Data::value_type;
|
||||
using key_type = Data::key_type;
|
||||
using mapped_type = Data::mapped_type;
|
||||
using const_iterator = Data::const_iterator;
|
||||
|
||||
SUITE(test_const_multimap)
|
||||
{
|
||||
@ -114,14 +116,14 @@ namespace
|
||||
{
|
||||
static constexpr Data data;
|
||||
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr Data::const_iterator begin = data.begin();
|
||||
static constexpr Data::const_iterator end = data.end();
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr const_iterator begin = data.begin();
|
||||
static constexpr const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 0UL);
|
||||
@ -137,14 +139,14 @@ namespace
|
||||
{
|
||||
static constexpr Data data{ value_type{Key('A'), 0 } };
|
||||
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr Data::const_iterator begin = data.begin();
|
||||
static constexpr Data::const_iterator end = data.end();
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr const_iterator begin = data.begin();
|
||||
static constexpr const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == 1U);
|
||||
@ -166,14 +168,14 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr Data::const_iterator begin = data.begin();
|
||||
static constexpr Data::const_iterator end = data.end();
|
||||
static constexpr bool is_valid = data.is_valid();
|
||||
static constexpr size_t size = data.size();
|
||||
static constexpr bool empty = data.empty();
|
||||
static constexpr bool full = data.full();
|
||||
static constexpr size_t capacity = data.capacity();
|
||||
static constexpr size_t max_size = data.max_size();
|
||||
static constexpr const_iterator begin = data.begin();
|
||||
static constexpr const_iterator end = data.end();
|
||||
|
||||
CHECK_TRUE(is_valid);
|
||||
CHECK_TRUE(size == Max_Size);
|
||||
@ -198,21 +200,12 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_cpp17_deduced_constructor)
|
||||
{
|
||||
#ifdef TEST_GREATER_THAN
|
||||
static constexpr Data data{ value_type{Key('J'), 9 }, value_type{Key('G'), 8 }, value_type{Key('G'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
static constexpr Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
static constexpr etl::const_multimap data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
etl::const_multimap<Key, int, 10U> check{ value_type{Key('J'), 9 }, value_type{Key('I'), 8 }, value_type{Key('H'), 7 }, value_type{Key('G'), 6 }, value_type{Key('F'), 5 },
|
||||
value_type{Key('E'), 4 }, value_type{Key('D'), 3 }, value_type{Key('C'), 2 }, value_type{Key('B'), 1 }, value_type{Key('A'), 0 } };
|
||||
#else
|
||||
etl::const_multimap<Key, int, 10U> check{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('H'), 7 }, value_type{Key('I'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
CHECK_TRUE(data.is_valid());
|
||||
CHECK_TRUE(data.size() == Max_Size);
|
||||
CHECK_FALSE(data.empty());
|
||||
@ -250,7 +243,7 @@ namespace
|
||||
static constexpr Data data{ value_type{Key('A'), 0 }, value_type{Key('B'), 1 }, value_type{Key('C'), 2 }, value_type{Key('D'), 3 }, value_type{Key('E'), 4 },
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
|
||||
static constexpr Data::const_iterator end_itr = data.end();
|
||||
static constexpr const_iterator end_itr = data.end();
|
||||
|
||||
CHECK_TRUE(end_itr == (data.begin() + data.size()));
|
||||
}
|
||||
@ -266,16 +259,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static constexpr ETL_OR_STD::pair<Data::const_iterator, Data::const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultA = data.equal_range(Key('A'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultB = data.equal_range(Key('B'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultC = data.equal_range(Key('C'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultD = data.equal_range(Key('D'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultE = data.equal_range(Key('E'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultF = data.equal_range(Key('F'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultG = data.equal_range(Key('G'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultH = data.equal_range(Key('H'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultI = data.equal_range(Key('I'));
|
||||
static constexpr ETL_OR_STD::pair<const_iterator, const_iterator> resultJ = data.equal_range(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA.first)));
|
||||
@ -335,17 +328,17 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static constexpr Data::const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static constexpr Data::const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static constexpr Data::const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static constexpr Data::const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static constexpr Data::const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static constexpr Data::const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static constexpr Data::const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static constexpr Data::const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static constexpr Data::const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static constexpr Data::const_iterator resultK = data.lower_bound(Key('K'));
|
||||
static constexpr const_iterator resultA = data.lower_bound(Key('A'));
|
||||
static constexpr const_iterator resultB = data.lower_bound(Key('B'));
|
||||
static constexpr const_iterator resultC = data.lower_bound(Key('C'));
|
||||
static constexpr const_iterator resultD = data.lower_bound(Key('D'));
|
||||
static constexpr const_iterator resultE = data.lower_bound(Key('E'));
|
||||
static constexpr const_iterator resultF = data.lower_bound(Key('F'));
|
||||
static constexpr const_iterator resultG = data.lower_bound(Key('G'));
|
||||
static constexpr const_iterator resultH = data.lower_bound(Key('H'));
|
||||
static constexpr const_iterator resultI = data.lower_bound(Key('I'));
|
||||
static constexpr const_iterator resultJ = data.lower_bound(Key('J'));
|
||||
static constexpr const_iterator resultK = data.lower_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -385,17 +378,17 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.lower_bound('A');
|
||||
static constexpr Data::const_iterator resultB = data.lower_bound('B');
|
||||
static constexpr Data::const_iterator resultC = data.lower_bound('C');
|
||||
static constexpr Data::const_iterator resultD = data.lower_bound('D');
|
||||
static constexpr Data::const_iterator resultE = data.lower_bound('E');
|
||||
static constexpr Data::const_iterator resultF = data.lower_bound('F');
|
||||
static constexpr Data::const_iterator resultG = data.lower_bound('G');
|
||||
static constexpr Data::const_iterator resultH = data.lower_bound('H');
|
||||
static constexpr Data::const_iterator resultI = data.lower_bound('I');
|
||||
static constexpr Data::const_iterator resultJ = data.lower_bound('J');
|
||||
static constexpr Data::const_iterator resultK = data.lower_bound('K');
|
||||
static constexpr const_iterator resultA = data.lower_bound('A');
|
||||
static constexpr const_iterator resultB = data.lower_bound('B');
|
||||
static constexpr const_iterator resultC = data.lower_bound('C');
|
||||
static constexpr const_iterator resultD = data.lower_bound('D');
|
||||
static constexpr const_iterator resultE = data.lower_bound('E');
|
||||
static constexpr const_iterator resultF = data.lower_bound('F');
|
||||
static constexpr const_iterator resultG = data.lower_bound('G');
|
||||
static constexpr const_iterator resultH = data.lower_bound('H');
|
||||
static constexpr const_iterator resultI = data.lower_bound('I');
|
||||
static constexpr const_iterator resultJ = data.lower_bound('J');
|
||||
static constexpr const_iterator resultK = data.lower_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -435,17 +428,17 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static constexpr Data::const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static constexpr Data::const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static constexpr Data::const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static constexpr Data::const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static constexpr Data::const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static constexpr Data::const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static constexpr Data::const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static constexpr Data::const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static constexpr Data::const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static constexpr Data::const_iterator resultK = data.upper_bound(Key('K'));
|
||||
static constexpr const_iterator resultA = data.upper_bound(Key('A'));
|
||||
static constexpr const_iterator resultB = data.upper_bound(Key('B'));
|
||||
static constexpr const_iterator resultC = data.upper_bound(Key('C'));
|
||||
static constexpr const_iterator resultD = data.upper_bound(Key('D'));
|
||||
static constexpr const_iterator resultE = data.upper_bound(Key('E'));
|
||||
static constexpr const_iterator resultF = data.upper_bound(Key('F'));
|
||||
static constexpr const_iterator resultG = data.upper_bound(Key('G'));
|
||||
static constexpr const_iterator resultH = data.upper_bound(Key('H'));
|
||||
static constexpr const_iterator resultI = data.upper_bound(Key('I'));
|
||||
static constexpr const_iterator resultJ = data.upper_bound(Key('J'));
|
||||
static constexpr const_iterator resultK = data.upper_bound(Key('K'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -485,17 +478,17 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.upper_bound('A');
|
||||
static constexpr Data::const_iterator resultB = data.upper_bound('B');
|
||||
static constexpr Data::const_iterator resultC = data.upper_bound('C');
|
||||
static constexpr Data::const_iterator resultD = data.upper_bound('D');
|
||||
static constexpr Data::const_iterator resultE = data.upper_bound('E');
|
||||
static constexpr Data::const_iterator resultF = data.upper_bound('F');
|
||||
static constexpr Data::const_iterator resultG = data.upper_bound('G');
|
||||
static constexpr Data::const_iterator resultH = data.upper_bound('H');
|
||||
static constexpr Data::const_iterator resultI = data.upper_bound('I');
|
||||
static constexpr Data::const_iterator resultJ = data.upper_bound('J');
|
||||
static constexpr Data::const_iterator resultK = data.upper_bound('K');
|
||||
static constexpr const_iterator resultA = data.upper_bound('A');
|
||||
static constexpr const_iterator resultB = data.upper_bound('B');
|
||||
static constexpr const_iterator resultC = data.upper_bound('C');
|
||||
static constexpr const_iterator resultD = data.upper_bound('D');
|
||||
static constexpr const_iterator resultE = data.upper_bound('E');
|
||||
static constexpr const_iterator resultF = data.upper_bound('F');
|
||||
static constexpr const_iterator resultG = data.upper_bound('G');
|
||||
static constexpr const_iterator resultH = data.upper_bound('H');
|
||||
static constexpr const_iterator resultI = data.upper_bound('I');
|
||||
static constexpr const_iterator resultJ = data.upper_bound('J');
|
||||
static constexpr const_iterator resultK = data.upper_bound('K');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(10, (std::distance(data.begin(), resultA)));
|
||||
@ -583,7 +576,7 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
Data::const_iterator itr = data.begin();
|
||||
const_iterator itr = data.begin();
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_TRUE((value_type{Key('J'), 9 }) == *itr++);
|
||||
@ -623,16 +616,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.find(Key('A'));
|
||||
static constexpr Data::const_iterator resultB = data.find(Key('B'));
|
||||
static constexpr Data::const_iterator resultC = data.find(Key('C'));
|
||||
static constexpr Data::const_iterator resultD = data.find(Key('D'));
|
||||
static constexpr Data::const_iterator resultE = data.find(Key('E'));
|
||||
static constexpr Data::const_iterator resultF = data.find(Key('F'));
|
||||
static constexpr Data::const_iterator resultG = data.find(Key('G'));
|
||||
static constexpr Data::const_iterator resultH = data.find(Key('H'));
|
||||
static constexpr Data::const_iterator resultI = data.find(Key('I'));
|
||||
static constexpr Data::const_iterator resultJ = data.find(Key('J'));
|
||||
static constexpr const_iterator resultA = data.find(Key('A'));
|
||||
static constexpr const_iterator resultB = data.find(Key('B'));
|
||||
static constexpr const_iterator resultC = data.find(Key('C'));
|
||||
static constexpr const_iterator resultD = data.find(Key('D'));
|
||||
static constexpr const_iterator resultE = data.find(Key('E'));
|
||||
static constexpr const_iterator resultF = data.find(Key('F'));
|
||||
static constexpr const_iterator resultG = data.find(Key('G'));
|
||||
static constexpr const_iterator resultH = data.find(Key('H'));
|
||||
static constexpr const_iterator resultI = data.find(Key('I'));
|
||||
static constexpr const_iterator resultJ = data.find(Key('J'));
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
@ -670,16 +663,16 @@ namespace
|
||||
value_type{Key('F'), 5 }, value_type{Key('G'), 6 }, value_type{Key('G'), 7 }, value_type{Key('G'), 8 }, value_type{Key('J'), 9 } };
|
||||
#endif
|
||||
|
||||
static constexpr Data::const_iterator resultA = data.find('A');
|
||||
static constexpr Data::const_iterator resultB = data.find('B');
|
||||
static constexpr Data::const_iterator resultC = data.find('C');
|
||||
static constexpr Data::const_iterator resultD = data.find('D');
|
||||
static constexpr Data::const_iterator resultE = data.find('E');
|
||||
static constexpr Data::const_iterator resultF = data.find('F');
|
||||
static constexpr Data::const_iterator resultG = data.find('G');
|
||||
static constexpr Data::const_iterator resultH = data.find('H');
|
||||
static constexpr Data::const_iterator resultI = data.find('I');
|
||||
static constexpr Data::const_iterator resultJ = data.find('J');
|
||||
static constexpr const_iterator resultA = data.find('A');
|
||||
static constexpr const_iterator resultB = data.find('B');
|
||||
static constexpr const_iterator resultC = data.find('C');
|
||||
static constexpr const_iterator resultD = data.find('D');
|
||||
static constexpr const_iterator resultE = data.find('E');
|
||||
static constexpr const_iterator resultF = data.find('F');
|
||||
static constexpr const_iterator resultG = data.find('G');
|
||||
static constexpr const_iterator resultH = data.find('H');
|
||||
static constexpr const_iterator resultI = data.find('I');
|
||||
static constexpr const_iterator resultJ = data.find('J');
|
||||
|
||||
#ifdef TEST_GREATER_THAN
|
||||
CHECK_EQUAL(9, (std::distance(data.begin(), resultA)));
|
||||
|
||||
1495
test/test_const_multimap_ext.cpp
Normal file
1495
test/test_const_multimap_ext.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1484
test/test_const_multimap_ext_constexpr.cpp
Normal file
1484
test/test_const_multimap_ext_constexpr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -9274,8 +9274,12 @@
|
||||
<ClCompile Include="..\test_circular_iterator.cpp" />
|
||||
<ClCompile Include="..\test_const_map.cpp" />
|
||||
<ClCompile Include="..\test_const_map_constexpr.cpp" />
|
||||
<ClCompile Include="..\test_const_map_ext.cpp" />
|
||||
<ClCompile Include="..\test_const_map_ext_constexpr.cpp" />
|
||||
<ClCompile Include="..\test_const_multimap.cpp" />
|
||||
<ClCompile Include="..\test_const_multimap_constexpr.cpp" />
|
||||
<ClCompile Include="..\test_const_multimap_ext.cpp" />
|
||||
<ClCompile Include="..\test_const_multimap_ext_constexpr.cpp" />
|
||||
<ClCompile Include="..\test_correlation.cpp" />
|
||||
<ClCompile Include="..\test_covariance.cpp" />
|
||||
<ClCompile Include="..\test_crc1.cpp" />
|
||||
|
||||
@ -1516,7 +1516,7 @@
|
||||
<Filter>ETL\Containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\const_multimap.h">
|
||||
<Filter>UnitTest++\Header Files</Filter>
|
||||
<Filter>ETL\Containers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -3611,6 +3611,18 @@
|
||||
<ClCompile Include="..\test_const_multimap.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_const_map_ext.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_const_map_ext_constexpr.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_const_multimap_ext.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_const_multimap_ext_constexpr.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\library.properties">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user