Fixed shadow warnings in all files

#823 Multiple variable shadowing warnings in private/bitset_new.h
This commit is contained in:
John Wellbelove 2024-01-25 14:22:26 +00:00
parent d2c7a206e7
commit 77513730e0
58 changed files with 928 additions and 857 deletions

View File

@ -58,28 +58,28 @@ namespace etl
}
//*************************************************************************
/// Construct from text and format spec.
/// Construct from text and format fmt.
//*************************************************************************
basic_string_stream(TIString& text_, const TFormat& spec_)
: text(text_)
, spec(spec_)
, format(spec_)
{
}
//*************************************************************************
/// Set the format spec.
/// Set the format fmt.
//*************************************************************************
void set_format(const TFormat& spec_)
{
spec = spec_;
format = spec_;
}
//*************************************************************************
/// Get a const reference to the format spec.
/// Get a const reference to the format fmt.
//*************************************************************************
const TFormat& get_format() const
{
return spec;
return format;
}
//*************************************************************************
@ -121,27 +121,27 @@ namespace etl
//*********************************
/// TFormat
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, const TFormat& spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, const TFormat& fmt)
{
ss.spec = spec;
ss.format = fmt;
return ss;
}
//*********************************
/// etl::base_spec from etl::setbase, etl::bin, etl::oct, etl::dec & etl::hex stream manipulators
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::base_spec spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::base_spec fmt)
{
ss.spec.base(spec.base);
ss.format.base(fmt.base);
return ss;
}
//*********************************
/// etl::width_spec from etl::setw stream manipulator
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::width_spec spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::width_spec fmt)
{
ss.spec.width(spec.width);
ss.format.width(fmt.width);
return ss;
}
@ -149,63 +149,63 @@ namespace etl
/// etl::fill_spec from etl::setfill stream manipulator
//*********************************
template <typename TChar>
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::fill_spec<TChar> spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::fill_spec<TChar> fmt)
{
ss.spec.fill(spec.fill);
ss.format.fill(fmt.fill);
return ss;
}
//*********************************
/// etl::precision_spec from etl::setprecision stream manipulator
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::precision_spec spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::precision_spec fmt)
{
ss.spec.precision(spec.precision);
ss.format.precision(fmt.precision);
return ss;
}
//*********************************
/// etl::boolalpha_spec from etl::boolalpha & etl::noboolalpha stream manipulators
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::boolalpha_spec spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::boolalpha_spec fmt)
{
ss.spec.boolalpha(spec.boolalpha);
ss.format.boolalpha(fmt.boolalpha);
return ss;
}
//*********************************
/// etl::uppercase_spec from etl::uppercase & etl::nouppercase stream manipulators
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::uppercase_spec spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::uppercase_spec fmt)
{
ss.spec.upper_case(spec.upper_case);
ss.format.upper_case(fmt.upper_case);
return ss;
}
//*********************************
/// etl::showbase_spec from etl::showbase & etl::noshowbase stream manipulators
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::showbase_spec spec)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::showbase_spec fmt)
{
ss.spec.show_base(spec.show_base);
ss.format.show_base(fmt.show_base);
return ss;
}
//*********************************
/// etl::left_spec from etl::left stream manipulator
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::left_spec /*spec*/)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::left_spec /*fmt*/)
{
ss.spec.left();
ss.format.left();
return ss;
}
//*********************************
/// etl::right_spec from etl::left stream manipulator
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::right_spec /*spec*/)
friend basic_string_stream& operator <<(basic_string_stream& ss, etl::private_basic_format_spec::right_spec /*fmt*/)
{
ss.spec.right();
ss.format.right();
return ss;
}
@ -214,7 +214,7 @@ namespace etl
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, TStringView view)
{
etl::to_string(view, ss.text, ss.spec, true);
etl::to_string(view, ss.text, ss.format, true);
return ss;
}
@ -241,9 +241,9 @@ namespace etl
//*********************************
/// From a string interface
//*********************************
friend basic_string_stream& operator <<(basic_string_stream& ss, const TIString& text)
friend basic_string_stream& operator <<(basic_string_stream& ss, const TIString& t)
{
etl::to_string(text, ss.text, ss.spec, true);
etl::to_string(t, ss.text, ss.format, true);
return ss;
}
@ -251,9 +251,9 @@ namespace etl
/// From a string
//*********************************
template <template <size_t> class TString, size_t SIZE>
friend basic_string_stream& operator <<(basic_string_stream& ss, const TString<SIZE>& text)
friend basic_string_stream& operator <<(basic_string_stream& ss, const TString<SIZE>& t)
{
const TIString& itext = text;
const TIString& itext = t;
etl::to_string(itext, ss.str(), ss.get_format(), true);
return ss;
}
@ -264,14 +264,14 @@ namespace etl
template <typename T>
friend basic_string_stream& operator <<(basic_string_stream& ss, const T& value)
{
etl::to_string(value, ss.text, ss.spec, true);
etl::to_string(value, ss.text, ss.format, true);
return ss;
}
private:
TIString& text;
TFormat spec;
TIString& text;
TFormat format;
basic_string_stream(const basic_string_stream&) ETL_DELETE;
basic_string_stream& operator =(const basic_string_stream&) ETL_DELETE;

View File

@ -69,7 +69,7 @@ namespace etl
byte_stream_writer(etl::span<char> span_, etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(span_.begin())
, pcurrent(span_.begin())
, length(span_.size_bytes())
, stream_length(span_.size_bytes())
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -81,7 +81,7 @@ namespace etl
byte_stream_writer(etl::span<unsigned char> span_, etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(reinterpret_cast<char*>(span_.begin()))
, pcurrent(reinterpret_cast<char*>(span_.begin()))
, length(span_.size_bytes())
, stream_length(span_.size_bytes())
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -93,7 +93,7 @@ namespace etl
byte_stream_writer(void* begin_, void* end_, etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(reinterpret_cast<char*>(begin_))
, pcurrent(reinterpret_cast<char*>(begin_))
, length(etl::distance(reinterpret_cast<char*>(begin_), reinterpret_cast<char*>(end_)))
, stream_length(etl::distance(reinterpret_cast<char*>(begin_), reinterpret_cast<char*>(end_)))
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -105,7 +105,7 @@ namespace etl
byte_stream_writer(void* begin_, size_t length_, etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(reinterpret_cast<char*>(begin_))
, pcurrent(reinterpret_cast<char*>(begin_))
, length(length_)
, stream_length(length_)
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -118,7 +118,7 @@ namespace etl
byte_stream_writer(T(&begin_)[Size], etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(begin_)
, pcurrent(begin_)
, length(begin_ + (Size * sizeof(T)))
, stream_length(begin_ + (Size * sizeof(T)))
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -333,7 +333,7 @@ namespace etl
//***************************************************************************
etl::span<char> free_data()
{
return etl::span<char>(pcurrent, pdata + length);
return etl::span<char>(pcurrent, pdata + stream_length);
}
//***************************************************************************
@ -341,7 +341,7 @@ namespace etl
//***************************************************************************
etl::span<const char> free_data() const
{
return etl::span<const char>(pcurrent, pdata + length);
return etl::span<const char>(pcurrent, pdata + stream_length);
}
//***************************************************************************
@ -349,7 +349,7 @@ namespace etl
//***************************************************************************
etl::span<char> data()
{
return etl::span<char>(pdata, pdata + length);
return etl::span<char>(pdata, pdata + stream_length);
}
//***************************************************************************
@ -357,7 +357,7 @@ namespace etl
//***************************************************************************
etl::span<const char> data() const
{
return etl::span<const char>(pdata, pdata + length);
return etl::span<const char>(pdata, pdata + stream_length);
}
//***************************************************************************
@ -389,7 +389,7 @@ namespace etl
//***************************************************************************
size_t capacity() const
{
return length;
return stream_length;
}
//***************************************************************************
@ -410,7 +410,7 @@ namespace etl
}
//***************************************************************************
/// Sets the function to call afer every write.
/// Sets the function to call after every write.
//***************************************************************************
void set_callback(callback_type callback_)
{
@ -418,7 +418,7 @@ namespace etl
}
//***************************************************************************
/// Gets the function to call afer every write.
/// Gets the function to call after every write.
//***************************************************************************
callback_type get_callback() const
{
@ -481,7 +481,7 @@ namespace etl
char* const pdata; ///< The start of the byte stream buffer.
char* pcurrent; ///< The current position in the byte stream buffer.
const size_t length; ///< The length of the byte stream buffer.
const size_t stream_length; ///< The length of the byte stream buffer.
const etl::endian stream_endianness; ///< The endianness of the stream data.
callback_type callback; ///< An optional callback on every step on the write buffer.
};
@ -503,7 +503,7 @@ namespace etl
byte_stream_reader(etl::span<char> span_, etl::endian stream_endianness_)
: pdata(span_.begin())
, pcurrent(span_.begin())
, length(span_.size_bytes())
, stream_length(span_.size_bytes())
, stream_endianness(stream_endianness_)
{
}
@ -514,7 +514,7 @@ namespace etl
byte_stream_reader(etl::span<const char> span_, etl::endian stream_endianness_)
: pdata(span_.begin())
, pcurrent(span_.begin())
, length(span_.size_bytes())
, stream_length(span_.size_bytes())
, stream_endianness(stream_endianness_)
{
}
@ -525,7 +525,7 @@ namespace etl
byte_stream_reader(const void* begin_, const void* end_, etl::endian stream_endianness_)
: pdata(reinterpret_cast<const char*>(begin_))
, pcurrent(reinterpret_cast<const char*>(begin_))
, length(etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_)))
, stream_length(etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_)))
, stream_endianness(stream_endianness_)
{
}
@ -536,7 +536,7 @@ namespace etl
byte_stream_reader(const void* begin_, size_t length_, etl::endian stream_endianness_)
: pdata(reinterpret_cast<const char*>(begin_))
, pcurrent(reinterpret_cast<const char*>(begin_))
, length(length_)
, stream_length(length_)
, stream_endianness(stream_endianness_)
{
}
@ -548,7 +548,7 @@ namespace etl
byte_stream_reader(T(&begin_)[Size], etl::endian stream_endianness_)
: pdata(begin_)
, pcurrent(begin_)
, length(begin_ + (Size * sizeof(T)))
, stream_length(begin_ + (Size * sizeof(T)))
, stream_endianness(stream_endianness_)
{
}
@ -560,7 +560,7 @@ namespace etl
byte_stream_reader(const T(&begin_)[Size], etl::endian stream_endianness_)
: pdata(begin_)
, pcurrent(begin_)
, length(begin_ + (Size * sizeof(T)))
, stream_length(begin_ + (Size * sizeof(T)))
, stream_endianness(stream_endianness_)
{
}
@ -766,7 +766,7 @@ namespace etl
//***************************************************************************
etl::span<const char> free_data() const
{
return etl::span<const char>(pcurrent, pdata + length);
return etl::span<const char>(pcurrent, pdata + stream_length);
}
//***************************************************************************
@ -774,7 +774,7 @@ namespace etl
//***************************************************************************
etl::span<const char> data() const
{
return etl::span<const char>(pdata, pdata + length);
return etl::span<const char>(pdata, pdata + stream_length);
}
//***************************************************************************
@ -790,7 +790,7 @@ namespace etl
//***************************************************************************
size_t size_bytes() const
{
return length;
return stream_length;
}
//***************************************************************************
@ -801,7 +801,7 @@ namespace etl
{
size_t used = etl::distance(pdata, pcurrent);
return (length - used) / sizeof(T);
return (stream_length - used) / sizeof(T);
}
//***************************************************************************
@ -855,7 +855,7 @@ namespace etl
const char* const pdata; ///< The start of the byte stream buffer.
const char* pcurrent; ///< The current position in the byte stream buffer.
const size_t length; ///< The length of the byte stream buffer.
const size_t stream_length; ///< The length of the byte stream buffer.
const etl::endian stream_endianness; ///< The endianness of the stream data.
};

View File

@ -76,7 +76,7 @@ namespace etl
}
//***********************************
add_insert_iterator& operator =(typename TFrame_Check_Sequence::value_type value)
add_insert_iterator& operator =(uint8_t value)
{
p_fcs->add(value);
return *this;

View File

@ -587,11 +587,11 @@ namespace etl
//********************************************
template <typename TMessage>
bool process_event_type(const etl::imessage& msg, etl::fsm_state_id_t& state_id)
bool process_event_type(const etl::imessage& msg, etl::fsm_state_id_t& new_state_id)
{
if (TMessage::ID == msg.get_message_id())
{
state_id = static_cast<TDerived*>(this)->on_event(static_cast<const TMessage&>(msg));
new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const TMessage&>(msg));
return true;
}
else

View File

@ -613,11 +613,11 @@ namespace etl
//********************************************
template <typename TMessage>
bool process_event_type(const etl::imessage& msg, etl::fsm_state_id_t& state_id)
bool process_event_type(const etl::imessage& msg, etl::fsm_state_id_t& new_state_id)
{
if (TMessage::ID == msg.get_message_id())
{
state_id = static_cast<TDerived*>(this)->on_event(static_cast<const TMessage&>(msg));
new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const TMessage&>(msg));
return true;
}
else

View File

@ -212,8 +212,8 @@ namespace etl
}
//********************************************
null_message_router(etl::imessage_router& successor)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor)
null_message_router(etl::imessage_router& successor_)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor_)
{
}
@ -290,8 +290,8 @@ namespace etl
}
//********************************************
message_producer(etl::imessage_router& successor)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor)
message_producer(etl::imessage_router& successor_)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor_)
{
}
@ -303,8 +303,8 @@ namespace etl
}
//********************************************
message_producer(etl::message_router_id_t id_, etl::imessage_router& successor)
: imessage_router(id_, successor)
message_producer(etl::message_router_id_t id_, etl::imessage_router& successor_)
: imessage_router(id_, successor_)
{
ETL_ASSERT(id_ <= etl::imessage_router::MAX_MESSAGE_ROUTER, ETL_ERROR(etl::message_router_illegal_id));
}

View File

@ -228,9 +228,7 @@ namespace etl
// Always pass the message on to the successor.
if (has_successor())
{
etl::imessage_router& successor = get_successor();
successor.receive(destination_router_id, msg);
get_successor().receive(destination_router_id, msg);
}
}

View File

@ -227,11 +227,9 @@ namespace etl
if (has_successor())
{
etl::imessage_router& successor = get_successor();
if (successor.accepts(message.get_message_id()))
if (get_successor().accepts(message.get_message_id()))
{
successor.receive(destination_router_id, message);
get_successor().receive(destination_router_id, message);
}
}
}
@ -306,11 +304,9 @@ namespace etl
if (has_successor())
{
etl::imessage_router& successor = get_successor();
if (successor.accepts(shared_msg.get_message().get_message_id()))
if (get_successor().accepts(shared_msg.get_message().get_message_id()))
{
successor.receive(destination_router_id, shared_msg);
get_successor().receive(destination_router_id, shared_msg);
}
}
}
@ -370,9 +366,9 @@ namespace etl
//*******************************************
/// Constructor.
//*******************************************
imessage_bus(router_list_t& list, etl::imessage_router& successor)
: imessage_router(etl::imessage_router::MESSAGE_BUS, successor),
router_list(list)
imessage_bus(router_list_t& router_list_, etl::imessage_router& successor_)
: imessage_router(etl::imessage_router::MESSAGE_BUS, successor_),
router_list(router_list_)
{
}
@ -416,8 +412,8 @@ namespace etl
//*******************************************
/// Constructor.
//*******************************************
message_bus(etl::imessage_router& successor)
: imessage_bus(router_list, successor)
message_bus(etl::imessage_router& successor_)
: imessage_bus(router_list, successor_)
{
}

View File

@ -200,8 +200,8 @@ namespace etl
}
//********************************************
null_message_router(etl::imessage_router& successor)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor)
null_message_router(etl::imessage_router& successor_)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor_)
{
}
@ -278,8 +278,8 @@ namespace etl
}
//********************************************
message_producer(etl::imessage_router& successor)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor)
message_producer(etl::imessage_router& successor_)
: imessage_router(imessage_router::NULL_MESSAGE_ROUTER, successor_)
{
}
@ -291,8 +291,8 @@ namespace etl
}
//********************************************
message_producer(etl::message_router_id_t id_, etl::imessage_router& successor)
: imessage_router(id_, successor)
message_producer(etl::message_router_id_t id_, etl::imessage_router& successor_)
: imessage_router(id_, successor_)
{
ETL_ASSERT(id_ <= etl::imessage_router::MAX_MESSAGE_ROUTER, ETL_ERROR(etl::message_router_illegal_id));
}

View File

@ -324,7 +324,7 @@ namespace etl
{
typedef T value_type;
virtual bool operator()(const value_type& current, const value_type& last) const = 0;
virtual bool operator()(const value_type& lhs, const value_type& rhs) const = 0;
};
//***************************************************************************
@ -334,9 +334,9 @@ namespace etl
{
typedef T value_type;
virtual bool operator()(const value_type& current, const value_type& last) const ETL_OVERRIDE
virtual bool operator()(const value_type& lhs, const value_type& rhs) const ETL_OVERRIDE
{
return etl::not_equal_to<value_type>()(current, last);
return etl::not_equal_to<value_type>()(lhs, rhs);
}
};
@ -347,9 +347,9 @@ namespace etl
{
typedef T value_type;
virtual bool operator()(const value_type& current, const value_type& last) const ETL_OVERRIDE
virtual bool operator()(const value_type& lhs, const value_type& rhs) const ETL_OVERRIDE
{
return etl::less<value_type>()(current, last);
return etl::less<value_type>()(lhs, rhs);
}
};
@ -360,9 +360,9 @@ namespace etl
{
typedef T value_type;
virtual bool operator()(const value_type& current, const value_type& last) const ETL_OVERRIDE
virtual bool operator()(const value_type& lhs, const value_type& rhs) const ETL_OVERRIDE
{
return etl::greater<value_type>()(current, last);
return etl::greater<value_type>()(lhs, rhs);
}
};

View File

@ -860,7 +860,7 @@ namespace etl
--dst_index;
// Shift lsb.
element_type lsb = element_type((pdata[src_index] & lsb_mask) << lsb_shift);
lsb = element_type((pdata[src_index] & lsb_mask) << lsb_shift);
pdata[dst_index] = lsb;
--src_index;
}

View File

@ -827,13 +827,14 @@ namespace etl
//*************************************************************************
/// Initialise from an unsigned long long.
//*************************************************************************
template <typename TElementType>
ETL_CONSTEXPR14
static
void initialise(pointer pbuffer,
size_t /*number_of_elements*/,
unsigned long long value) ETL_NOEXCEPT
{
*pbuffer = static_cast<element_type>(value);
*pbuffer = static_cast<TElementType>(value);
}
//*************************************************************************
@ -1672,7 +1673,7 @@ namespace etl
--dst_index;
// Shift lsb.
element_type lsb = element_type((pbuffer[src_index] & lsb_mask) << lsb_shift);
lsb = element_type((pbuffer[src_index] & lsb_mask) << lsb_shift);
pbuffer[dst_index] = lsb;
--src_index;
}
@ -1769,28 +1770,49 @@ namespace etl
//*************************************************************************
/// Initialise from an unsigned long long.
/// Enabled if the number of bits in the element equals the number of bits in an unsigned long long.
//*************************************************************************
template <typename TElementType>
ETL_CONSTEXPR14
static
void initialise(pointer pbuffer,
size_t number_of_elements,
unsigned long long value) ETL_NOEXCEPT
typename etl::enable_if<etl::integral_limits<TElementType>::bits == etl::integral_limits<unsigned long long>::bits, void>::type
initialise(pointer pbuffer,
size_t number_of_elements,
unsigned long long value) ETL_NOEXCEPT
{
size_t i = 0UL;
// Set the non-zero elements.
pbuffer[i++] = value;
// Clear the remaining elements.
while (i != number_of_elements)
{
pbuffer[i++] = All_Clear_Element;
}
}
//*************************************************************************
/// Initialise from an unsigned long long.
/// Enabled if the number of bits in the element doesn't equal the number of bits in an unsigned long long.
//*************************************************************************
template <typename TElementType>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::integral_limits<TElementType>::bits != etl::integral_limits<unsigned long long>::bits, void>::type
initialise(pointer pbuffer,
size_t number_of_elements,
unsigned long long value) ETL_NOEXCEPT
{
size_t i = 0UL;
const size_t Shift = etl::integral_limits<element_type>::bits;
// Set the non-zero elements.
if ETL_IF_CONSTEXPR(etl::integral_limits<element_type>::bits == etl::integral_limits<unsigned long long>::bits)
const unsigned long long Shift = etl::integral_limits<element_type>::bits;
while ((value != 0) && (i != number_of_elements))
{
pbuffer[i++] = value;
}
else
{
while ((value != 0) && (i != number_of_elements))
{
pbuffer[i++] = value & All_Set_Element;
value = value >> Shift;
}
pbuffer[i++] = value & All_Set_Element;
value = value >> Shift;
}
// Clear the remaining elements.
@ -2029,16 +2051,18 @@ namespace etl
//*************************************************************************
/// Construct from a value.
//*************************************************************************
ETL_CONSTEXPR14 bitset(unsigned long long value) ETL_NOEXCEPT
template <typename TValue>
ETL_CONSTEXPR14 bitset(TValue value, typename etl::enable_if<is_integral<TValue>::value>::type* = 0) ETL_NOEXCEPT
: buffer()
{
implementation::initialise(buffer, Number_Of_Elements, value);
implementation::template initialise<element_type>(buffer, Number_Of_Elements, value);
}
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset(const char* text) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0) ETL_NOEXCEPT
: buffer()
{
implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
@ -2047,7 +2071,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset(const wchar_t* text) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0) ETL_NOEXCEPT
: buffer()
{
implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
@ -2056,7 +2081,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset(const char16_t* text) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0) ETL_NOEXCEPT
: buffer()
{
implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
@ -2065,7 +2091,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset(const char32_t* text) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0) ETL_NOEXCEPT
: buffer()
{
implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
@ -2981,22 +3008,24 @@ namespace etl
: pbuffer(pbuffer_)
{
ETL_ASSERT(pbuffer != ETL_NULLPTR, ETL_ERROR(etl::bitset_invalid_buffer));
implementation::initialise(pbuffer, Number_Of_Elements, value);
implementation::template initialise<element_type>(pbuffer, Number_Of_Elements, value);
}
//*************************************************************************
/// Construct from a value.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(unsigned long long value, buffer_type& buffer) ETL_NOEXCEPT
template <typename TValue>
ETL_CONSTEXPR14 bitset_ext(TValue value, buffer_type& buffer, typename etl::enable_if<is_integral<TValue>::value>::type* = 0) ETL_NOEXCEPT
: pbuffer(buffer.data())
{
implementation::initialise(pbuffer, Number_Of_Elements, value);
implementation::template initialise<element_type>(pbuffer, Number_Of_Elements, value);
}
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const char* text, element_type* pbuffer_)
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_, typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0)
: pbuffer(pbuffer_)
{
ETL_ASSERT(pbuffer != ETL_NULLPTR, ETL_ERROR(etl::bitset_invalid_buffer));
@ -3006,7 +3035,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const char* text, buffer_type& buffer) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer, typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0) ETL_NOEXCEPT
: pbuffer(buffer.data())
{
implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
@ -3015,7 +3045,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const wchar_t* text, element_type* pbuffer_)
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_, typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0)
: pbuffer(pbuffer_)
{
ETL_ASSERT(pbuffer != ETL_NULLPTR, ETL_ERROR(etl::bitset_invalid_buffer));
@ -3025,7 +3056,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const wchar_t* text, buffer_type& buffer) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer, typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0) ETL_NOEXCEPT
: pbuffer(buffer.data())
{
implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
@ -3034,7 +3066,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const char16_t* text, element_type* pbuffer_)
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_, typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0)
: pbuffer(pbuffer_)
{
ETL_ASSERT(pbuffer != ETL_NULLPTR, ETL_ERROR(etl::bitset_invalid_buffer));
@ -3044,7 +3077,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const char16_t* text, buffer_type& buffer) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer, typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0) ETL_NOEXCEPT
: pbuffer(buffer.data())
{
implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
@ -3053,7 +3087,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const char32_t* text, element_type* pbuffer_)
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_, typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0)
: pbuffer(pbuffer_)
{
ETL_ASSERT(pbuffer != ETL_NULLPTR, ETL_ERROR(etl::bitset_invalid_buffer));
@ -3063,7 +3098,8 @@ namespace etl
//*************************************************************************
/// Construct from a string.
//*************************************************************************
ETL_CONSTEXPR14 bitset_ext(const char32_t* text, buffer_type& buffer) ETL_NOEXCEPT
template <typename TPString>
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer, typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0) ETL_NOEXCEPT
: pbuffer(buffer.data())
{
implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);

View File

@ -868,9 +868,9 @@ namespace etl
/// Default constructor.
//*************************************************************************
queue_spsc_locked(const etl::ifunction<void>& lock,
const etl::ifunction<void>& unlock)
: base_t(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, lock, unlock)
queue_spsc_locked(const etl::ifunction<void>& lock_,
const etl::ifunction<void>& unlock_)
: base_t(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, lock_, unlock_)
{
}

View File

@ -47,19 +47,19 @@ namespace etl
{
enum enum_type
{
undefined = 0,
binary = 2,
octal = 8,
decimal = 10,
hex = 16
undefined = 0,
binary = 2,
octal = 8,
decimal = 10,
hexadecimal = 16
};
ETL_DECLARE_ENUM_TYPE(radix, uint_least8_t)
ETL_ENUM_TYPE(undefined, "undefined")
ETL_ENUM_TYPE(binary, "binary")
ETL_ENUM_TYPE(octal, "octal")
ETL_ENUM_TYPE(decimal, "decimal")
ETL_ENUM_TYPE(hex, "hex")
ETL_ENUM_TYPE(undefined, "undefined")
ETL_ENUM_TYPE(binary, "binary")
ETL_ENUM_TYPE(octal, "octal")
ETL_ENUM_TYPE(decimal, "decimal")
ETL_ENUM_TYPE(hexadecimal, "hexadecimal")
ETL_END_ENUM_TYPE
};
}

View File

@ -251,7 +251,7 @@ namespace etl
break;
}
case etl::radix::hex:
case etl::radix::hexadecimal:
{
return ((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f'));
break;
@ -281,7 +281,7 @@ namespace etl
break;
}
case etl::radix::hex:
case etl::radix::hexadecimal:
{
if ((c >= '0') && (c <= '9'))
{
@ -363,7 +363,7 @@ namespace etl
return (radix == etl::radix::binary) ||
(radix == etl::radix::octal) ||
(radix == etl::radix::decimal) ||
(radix == etl::radix::hex);
(radix == etl::radix::hexadecimal);
}
//***************************************************************************

View File

@ -1420,14 +1420,14 @@ namespace etl
//*************************************************************************
/// Move from a range
//*************************************************************************
void move(iterator first, iterator last)
void move(iterator b, iterator e)
{
while (first != last)
while (b != e)
{
iterator temp = first;
iterator temp = b;
++temp;
insert(etl::move(*first));
first = temp;
insert(etl::move(*b));
b = temp;
}
}
#endif
@ -1489,26 +1489,26 @@ namespace etl
else if (pbucket == last)
{
// We erased the last, so we need to search again. Start from the first, go no further than the current last.
bucket_t* pcurrent = first;
pbucket = first;
bucket_t* pend = last;
last = first;
while (pcurrent != pend)
while (pbucket != pend)
{
if (!pcurrent->empty())
if (!pbucket->empty())
{
last = pcurrent;
last = pbucket;
}
++pcurrent;
++pbucket;
}
}
}
}
//*********************************************************************
/// Delete a data noe at the specified location.
/// Delete a data node at the specified location.
//*********************************************************************
local_iterator delete_data_node(local_iterator iprevious, local_iterator icurrent, bucket_t& bucket)
{

View File

@ -1274,14 +1274,14 @@ namespace etl
//*************************************************************************
/// Move from a range
//*************************************************************************
void move(iterator first, iterator last)
void move(iterator b, iterator e)
{
while (first != last)
while (b != e)
{
iterator temp = first;
iterator temp = b;
++temp;
insert(etl::move(*first));
first = temp;
insert(etl::move(*b));
b = temp;
}
}
#endif
@ -1323,7 +1323,7 @@ namespace etl
//*********************************************************************
/// Adjust the first and last markers according to the erased entry.
//*********************************************************************
void adjust_first_last_markers_after_erase(bucket_t* pcurrent)
void adjust_first_last_markers_after_erase(bucket_t* pbucket)
{
if (empty())
{
@ -1332,7 +1332,7 @@ namespace etl
}
else
{
if (pcurrent == first)
if (pbucket == first)
{
// We erased the first so, we need to search again from where we erased.
while (first->empty())
@ -1340,29 +1340,29 @@ namespace etl
++first;
}
}
else if (pcurrent == last)
else if (pbucket == last)
{
// We erased the last, so we need to search again. Start from the first, go no further than the current last.
bucket_t* pcurrent = first;
pbucket = first;
bucket_t* pend = last;
last = first;
while (pcurrent != pend)
while (pbucket != pend)
{
if (!pcurrent->empty())
if (!pbucket->empty())
{
last = pcurrent;
last = pbucket;
}
++pcurrent;
++pbucket;
}
}
}
}
//*********************************************************************
/// Delete a data noe at the specified location.
/// Delete a data node at the specified location.
//*********************************************************************
local_iterator delete_data_node(local_iterator iprevious, local_iterator icurrent, bucket_t& bucket)
{

View File

@ -1252,14 +1252,14 @@ namespace etl
//*************************************************************************
/// Move from a range
//*************************************************************************
void move(iterator first, iterator last)
void move(iterator b, iterator e)
{
while (first != last)
while (b != e)
{
iterator temp = first;
iterator temp = b;
++temp;
insert(etl::move(*first));
first = temp;
insert(etl::move(*b));
b = temp;
}
}
#endif
@ -1301,7 +1301,7 @@ namespace etl
//*********************************************************************
/// Adjust the first and last markers according to the erased entry.
//*********************************************************************
void adjust_first_last_markers_after_erase(bucket_t* pcurrent)
void adjust_first_last_markers_after_erase(bucket_t* pbucket)
{
if (empty())
{
@ -1310,7 +1310,7 @@ namespace etl
}
else
{
if (pcurrent == first)
if (pbucket == first)
{
// We erased the first so, we need to search again from where we erased.
while (first->empty())
@ -1318,29 +1318,29 @@ namespace etl
++first;
}
}
else if (pcurrent == last)
else if (pbucket == last)
{
// We erased the last, so we need to search again. Start from the first, go no further than the current last.
bucket_t* pcurrent = first;
pbucket = first;
bucket_t* pend = last;
last = first;
while (pcurrent != pend)
while (pbucket != pend)
{
if (!pcurrent->empty())
if (!pbucket->empty())
{
last = pcurrent;
last = pbucket;
}
++pcurrent;
++pbucket;
}
}
}
}
//*********************************************************************
/// Delete a data noe at the specified location.
/// Delete a data node at the specified location.
//*********************************************************************
local_iterator delete_data_node(local_iterator iprevious, local_iterator icurrent, bucket_t& bucket)
{

View File

@ -1272,20 +1272,20 @@ namespace etl
//*************************************************************************
/// Move from a range
//*************************************************************************
void move(iterator first, iterator last)
void move(iterator b, iterator e)
{
#if ETL_IS_DEBUG_BUILD
difference_type d = etl::distance(first, last);
difference_type d = etl::distance(b, e);
ETL_ASSERT(d >= 0, ETL_ERROR(unordered_set_iterator));
ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_set_full));
#endif
while (first != last)
while (b != e)
{
iterator temp = first;
iterator temp = b;
++temp;
insert(etl::move(*first));
first = temp;
insert(etl::move(*b));
b = temp;
}
}
#endif
@ -1309,7 +1309,7 @@ namespace etl
if (size() == 1)
{
first = pbucket;
last = pbucket;
last = pbucket;
}
else
{
@ -1327,7 +1327,7 @@ namespace etl
//*********************************************************************
/// Adjust the first and last markers according to the erased entry.
//*********************************************************************
void adjust_first_last_markers_after_erase(bucket_t* pcurrent)
void adjust_first_last_markers_after_erase(bucket_t* pbucket)
{
if (empty())
{
@ -1336,7 +1336,7 @@ namespace etl
}
else
{
if (pcurrent == first)
if (pbucket == first)
{
// We erased the first so, we need to search again from where we erased.
while (first->empty())
@ -1344,29 +1344,29 @@ namespace etl
++first;
}
}
else if (pcurrent == last)
else if (pbucket == last)
{
// We erased the last, so we need to search again. Start from the first, go no further than the current last.
bucket_t* pcurrent = first;
pbucket = first;
bucket_t* pend = last;
last = first;
while (pcurrent != pend)
while (pbucket != pend)
{
if (!pcurrent->empty())
if (!pbucket->empty())
{
last = pcurrent;
last = pbucket;
}
++pcurrent;
++pbucket;
}
}
}
}
//*********************************************************************
/// Delete a data noe at the specified location.
/// Delete a data node at the specified location.
//*********************************************************************
local_iterator delete_data_node(local_iterator iprevious, local_iterator icurrent, bucket_t& bucket)
{

View File

@ -383,6 +383,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
-Werror
-Wfloat-equal
-Wuseless-cast
-Wshadow
)
endif ()
@ -395,6 +396,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wextra
-Werror
-Wfloat-equal
-Wshadow
)
endif ()

View File

@ -19,10 +19,10 @@
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK(" #value ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -41,10 +41,10 @@
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK(" #value ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -62,10 +62,10 @@
UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -83,10 +83,10 @@
UnitTest::CheckEqualHex(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -104,10 +104,10 @@
UnitTest::CheckNotEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -125,10 +125,10 @@
UnitTest::CheckNotEqualHex(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -146,10 +146,10 @@
UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -167,10 +167,10 @@
UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -188,10 +188,10 @@
UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \
@ -209,10 +209,10 @@
UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
}) \
UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \
UNITTEST_IMPL_CATCH (std::exception, e, \
UNITTEST_IMPL_CATCH (std::exception, exc, \
{ \
UnitTest::MemoryOutStream UnitTest_message; \
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \
UnitTest_message << "Unhandled exception (" << exc.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
UnitTest_message.GetText()); \
}) \

View File

@ -39,12 +39,12 @@ namespace UnitTest {
testObject.RunImpl();
})
#endif
UNITTEST_IMPL_CATCH(RequiredCheckException, e, { (void)e; })
UNITTEST_IMPL_CATCH(AssertException, e, { (void)e; })
UNITTEST_IMPL_CATCH(std::exception, e,
UNITTEST_IMPL_CATCH(RequiredCheckException, exc, { (void)exc; })
UNITTEST_IMPL_CATCH(AssertException, exc, { (void)exc; })
UNITTEST_IMPL_CATCH(std::exception, exc,
{
MemoryOutStream stream;
stream << "Unhandled exception: " << e.what();
stream << "Unhandled exception: " << exc.what();
CurrentTest::Results()->OnTestFailure(details, stream.GetText());
})
UNITTEST_IMPL_CATCH_ALL

View File

@ -283,7 +283,7 @@ compiler=$clang_compiler
SetConfigurationName "STL"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation

View File

@ -84,9 +84,9 @@ namespace
{
}
Data(int a, int b)
: a(a)
, b(b)
Data(int a_, int b_)
: a(a_)
, b(b_)
{
}

View File

@ -1143,7 +1143,7 @@ namespace
//*************************************************************************
TEST(test_to_ulong_min)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits> data((unsigned long)etl::integral_limits<unsigned long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits> data(etl::integral_limits<unsigned long>::min);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1152,7 +1152,7 @@ namespace
//*************************************************************************
TEST(test_to_ulong_max)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits> data((unsigned long)etl::integral_limits<unsigned long>::max);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits> data(etl::integral_limits<unsigned long>::max);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::max(), value);
@ -1161,14 +1161,14 @@ namespace
//*************************************************************************
TEST(test_to_ulong_overflow)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits + 1> data((unsigned long)etl::integral_limits<unsigned long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits + 1> data(etl::integral_limits<unsigned long>::min);
CHECK_THROW(data.to_ulong(), etl::bitset_overflow);
}
//*************************************************************************
TEST(test_to_ullong_min)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits> data((unsigned long long)etl::integral_limits<unsigned long long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits> data(etl::integral_limits<unsigned long long>::min);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1177,7 +1177,7 @@ namespace
//*************************************************************************
TEST(test_to_ullong_max)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits> data((unsigned long long)etl::integral_limits<unsigned long long>::max);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits> data(etl::integral_limits<unsigned long long>::max);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long long>::max(), value);
@ -1186,7 +1186,7 @@ namespace
//*************************************************************************
TEST(test_to_ullong_overflow)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits + 1> data((unsigned long long)etl::integral_limits<unsigned long long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits + 1> data(etl::integral_limits<unsigned long long>::min);
CHECK_THROW(data.to_ullong(), etl::bitset_overflow);
}

View File

@ -1139,7 +1139,7 @@ namespace
//*************************************************************************
TEST(test_to_ulong_min)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits, uint64_t> data((unsigned long)etl::integral_limits<unsigned long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits, uint64_t> data(etl::integral_limits<unsigned long>::min);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1148,7 +1148,7 @@ namespace
//*************************************************************************
TEST(test_to_ulong_max)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits, uint64_t> data((unsigned long)etl::integral_limits<unsigned long>::max);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits, uint64_t> data(etl::integral_limits<unsigned long>::max);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::max(), value);
@ -1157,14 +1157,14 @@ namespace
//*************************************************************************
TEST(test_to_ulong_overflow)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits + 1, uint64_t> data((unsigned long)etl::integral_limits<unsigned long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long>::bits + 1, uint64_t> data(etl::integral_limits<unsigned long>::min);
CHECK_THROW(data.to_ulong(), etl::bitset_overflow);
}
//*************************************************************************
TEST(test_to_ullong_min)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits, uint64_t> data((unsigned long long)etl::integral_limits<unsigned long long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits, uint64_t> data(etl::integral_limits<unsigned long long>::min);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1173,7 +1173,7 @@ namespace
//*************************************************************************
TEST(test_to_ullong_max)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits, uint64_t> data((unsigned long long)etl::integral_limits<unsigned long long>::max);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits, uint64_t> data(etl::integral_limits<unsigned long long>::max);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long long>::max(), value);
@ -1182,7 +1182,7 @@ namespace
//*************************************************************************
TEST(test_to_ullong_overflow)
{
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits + 1, uint64_t> data((unsigned long long)etl::integral_limits<unsigned long long>::min);
ETL_CONSTEXPR14 etl::bitset<etl::integral_limits<unsigned long long>::bits + 1, uint64_t> data(etl::integral_limits<unsigned long long>::min);
CHECK_THROW(data.to_ullong(), etl::bitset_overflow);
}

View File

@ -1086,7 +1086,7 @@ namespace
TEST(test_to_ulong_min)
{
etl::bitset_ext<etl::integral_limits<unsigned long>::bits>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long>::bits> data((unsigned long)etl::integral_limits<unsigned long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long>::bits> data(etl::integral_limits<unsigned long>::min, buffer);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1096,7 +1096,7 @@ namespace
TEST(test_to_ulong_max)
{
etl::bitset_ext<etl::integral_limits<unsigned long>::bits>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long>::bits> data((unsigned long)etl::integral_limits<unsigned long>::max, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long>::bits> data(etl::integral_limits<unsigned long>::max, buffer);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::max(), value);
@ -1106,7 +1106,7 @@ namespace
TEST(test_to_ulong_overflow)
{
etl::bitset_ext<etl::integral_limits<unsigned long>::bits + 1>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long>::bits + 1> data((unsigned long)etl::integral_limits<unsigned long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long>::bits + 1> data(etl::integral_limits<unsigned long>::min, buffer);
CHECK_THROW(data.to_ulong(), etl::bitset_overflow);
}
@ -1114,7 +1114,7 @@ namespace
TEST(test_to_ullong_min)
{
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits> data((unsigned long long)etl::integral_limits<unsigned long long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits> data(etl::integral_limits<unsigned long long>::min, buffer);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1124,7 +1124,7 @@ namespace
TEST(test_to_ullong_max)
{
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits> data((unsigned long long)etl::integral_limits<unsigned long long>::max, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits> data(etl::integral_limits<unsigned long long>::max, buffer);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long long>::max(), value);
@ -1134,7 +1134,7 @@ namespace
TEST(test_to_ullong_overflow)
{
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits + 1>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits + 1> data((unsigned long long)etl::integral_limits<unsigned long long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits + 1> data(etl::integral_limits<unsigned long long>::min, buffer);
CHECK_THROW(data.to_ullong(), etl::bitset_overflow);
}
@ -1570,9 +1570,10 @@ namespace
etl::bitset_ext<64> original(0x0123456789ABCDEFULL, buffer1);
for (ull shift = 0U; shift < 64U; ++shift)
for (size_t shift = 0U; shift < 64U; ++shift)
{
etl::bitset_ext<64> data(original, buffer2);
CHECK_EQUAL_HEX(((value & mask) << shift), (data <<= shift).value<uint64_t>());
mask >>= 1;
}
@ -1604,7 +1605,7 @@ namespace
etl::bitset_ext<64> original(0x0123456789ABCDEFULL, buffer1);
for (ull shift = 0U; shift < 64U; ++shift)
for (size_t shift = 0U; shift < 64U; ++shift)
{
etl::bitset_ext<64> data(original, buffer2);
CHECK_EQUAL_HEX((value >> shift), (data >>= shift).value<uint64_t>());

View File

@ -85,8 +85,8 @@ namespace
CHECK_EQUAL(All_Set_Element, All_Set_Element2);
//*******************************
constexpr size_t All_Clear_Element1 = bitset_type::All_Clear_Element;
constexpr size_t All_Clear_Element2 = bitset_type::all_clear_element();
constexpr element_type All_Clear_Element1 = bitset_type::All_Clear_Element;
constexpr element_type All_Clear_Element2 = bitset_type::all_clear_element();
CHECK_EQUAL(All_Clear_Element, All_Clear_Element1);
CHECK_EQUAL(All_Clear_Element, All_Clear_Element2);
@ -1114,7 +1114,7 @@ namespace
TEST(test_to_ulong_min)
{
etl::bitset_ext<etl::integral_limits<unsigned long>::bits, uint64_t>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long>::bits, uint64_t> data((unsigned long)etl::integral_limits<unsigned long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long>::bits, uint64_t> data(etl::integral_limits<unsigned long>::min, buffer);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1124,7 +1124,7 @@ namespace
TEST(test_to_ulong_max)
{
etl::bitset_ext<etl::integral_limits<unsigned long>::bits, uint64_t>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long>::bits, uint64_t> data((unsigned long)etl::integral_limits<unsigned long>::max, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long>::bits, uint64_t> data(etl::integral_limits<unsigned long>::max, buffer);
unsigned long value = data.to_ulong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::max(), value);
@ -1134,7 +1134,7 @@ namespace
TEST(test_to_ulong_overflow)
{
etl::bitset_ext<etl::integral_limits<unsigned long>::bits + 1, uint64_t>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long>::bits + 1, uint64_t> data((unsigned long)etl::integral_limits<unsigned long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long>::bits + 1, uint64_t> data(etl::integral_limits<unsigned long>::min, buffer);
CHECK_THROW(data.to_ulong(), etl::bitset_overflow);
}
@ -1142,7 +1142,7 @@ namespace
TEST(test_to_ullong_min)
{
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits, uint64_t>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits, uint64_t> data((unsigned long long)etl::integral_limits<unsigned long long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits, uint64_t> data(etl::integral_limits<unsigned long long>::min, buffer);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long>::min(), value);
@ -1152,7 +1152,7 @@ namespace
TEST(test_to_ullong_max)
{
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits, uint64_t>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits, uint64_t> data((unsigned long long)etl::integral_limits<unsigned long long>::max, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits, uint64_t> data(etl::integral_limits<unsigned long long>::max, buffer);
unsigned long long value = data.to_ullong();
CHECK_EQUAL(std::numeric_limits<unsigned long long>::max(), value);
@ -1162,7 +1162,7 @@ namespace
TEST(test_to_ullong_overflow)
{
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits + 1, uint64_t>::buffer_type buffer;
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits + 1, uint64_t> data((unsigned long long)etl::integral_limits<unsigned long long>::min, buffer);
etl::bitset_ext<etl::integral_limits<unsigned long long>::bits + 1, uint64_t> data(etl::integral_limits<unsigned long long>::min, buffer);
CHECK_THROW(data.to_ullong(), etl::bitset_overflow);
}
@ -1749,7 +1749,7 @@ namespace
etl::bitset_ext<64, uint64_t> original(0x0123456789ABCDEFULL, buffer1);
for (ull shift = 0U; shift < 64U; ++shift)
for (size_t shift = 0U; shift < 64ULL; ++shift)
{
etl::bitset_ext<64, uint64_t> data(original, buffer2);
CHECK_EQUAL_HEX(((value & mask) << shift), (data <<= shift).value<uint64_t>());
@ -1783,7 +1783,7 @@ namespace
etl::bitset_ext<64, uint64_t> original(0x0123456789ABCDEFULL, buffer1);
for (ull shift = 0U; shift < 64U; ++shift)
for (size_t shift = 0U; shift < 64U; ++shift)
{
etl::bitset_ext<64, uint64_t> data(original, buffer2);
CHECK_EQUAL_HEX((value >> shift), (data >>= shift).value<uint64_t>());

View File

@ -66,11 +66,11 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
Test()
Object()
: callback(*this)
{
}
@ -88,13 +88,13 @@ namespace
}
// Callback for 'member1'.
etl::function_mp<Test, size_t, &Test::member1> callback;
etl::function_mp<Object, size_t, &Object::member1> callback;
};
Test test;
Object object;
// Callback for 'member2'.
etl::function_imp<Test, size_t, test, &Test::member2> member_callback;
etl::function_imp<Object, size_t, object, &Object::member2> member_callback;
// Callback for 'global'.
etl::function_fp<size_t, global> global_callback;
@ -136,7 +136,7 @@ namespace
Service service;
service.register_callback<GLOBAL>(global_callback);
service.register_callback<MEMBER1>(test.callback);
service.register_callback<MEMBER1>(object.callback);
service.register_callback<MEMBER2>(member_callback);
service.callback<GLOBAL>();
@ -154,7 +154,7 @@ namespace
Service service;
service.register_callback(GLOBAL, global_callback);
service.register_callback(MEMBER1, test.callback);
service.register_callback(MEMBER1, object.callback);
service.register_callback(MEMBER2, member_callback);
service.callback(GLOBAL);
@ -172,7 +172,7 @@ namespace
Service service;
service.register_callback<GLOBAL>(global_callback);
service.register_callback<MEMBER1>(test.callback);
service.register_callback<MEMBER1>(object.callback);
service.register_callback<MEMBER2>(member_callback);
service.callback<MEMBER1>();
@ -190,7 +190,7 @@ namespace
Service service;
service.register_callback(GLOBAL, global_callback);
service.register_callback(MEMBER1, test.callback);
service.register_callback(MEMBER1, object.callback);
service.register_callback(MEMBER2, member_callback);
service.callback(MEMBER1);
@ -208,7 +208,7 @@ namespace
Service service;
service.register_callback<GLOBAL>(global_callback);
service.register_callback<MEMBER1>(test.callback);
service.register_callback<MEMBER1>(object.callback);
service.register_callback<MEMBER2>(member_callback);
service.callback<MEMBER2>();
@ -226,7 +226,7 @@ namespace
Service service;
service.register_callback<GLOBAL>(global_callback);
service.register_callback<MEMBER1>(test.callback);
service.register_callback<MEMBER1>(object.callback);
service.register_callback<MEMBER2>(member_callback);
service.callback(OUT_OF_RANGE);
@ -244,7 +244,7 @@ namespace
Service service;
service.register_callback<GLOBAL>(global_callback);
service.register_callback<MEMBER1>(test.callback);
service.register_callback<MEMBER1>(object.callback);
service.register_callback<MEMBER2>(member_callback);
service.register_unhandled_callback(unhandled_callback);

View File

@ -49,11 +49,11 @@ namespace
//***************************************************************************
// Class callback via etl::function
//***************************************************************************
class Test
class Object
{
public:
Test()
Object()
: p_controller(nullptr)
{
}
@ -81,9 +81,9 @@ namespace
etl::callback_timer<3>* p_controller;
};
Test test;
etl::function_imv<Test, test, &Test::callback> member_callback;
etl::function_imv<Test, test, &Test::callback2> member_callback2;
Object object;
etl::function_imv<Object, object, &Object::callback> member_callback;
etl::function_imv<Object, object, &Object::callback2> member_callback2;
//***************************************************************************
// Free function callback via etl::function
@ -136,7 +136,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Single_Shot);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -160,11 +160,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -175,7 +175,7 @@ namespace
etl::callback_timer<1> timer_controller;
etl::timer::id::type id1 = timer_controller.register_timer(member_callback, 37, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
timer_controller.enable(true);
@ -195,7 +195,7 @@ namespace
CHECK(timer_controller.set_period(id1, 50));
timer_controller.start(id1);
test.tick_list.clear();
object.tick_list.clear();
ticks = 0;
@ -207,7 +207,7 @@ namespace
// Timer should have timed out.
CHECK_EQUAL(50U, *test.tick_list.data());
CHECK_EQUAL(50U, *object.tick_list.data());
CHECK(timer_controller.unregister_timer(id1));
CHECK(!timer_controller.unregister_timer(id1));
@ -224,7 +224,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -248,11 +248,11 @@ namespace
std::vector<uint64_t> compare2 = { 23, 46, 69, 92 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -266,7 +266,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -294,11 +294,11 @@ namespace
std::vector<uint64_t> compare2 = { 25, 50, 70, 95 };
std::vector<uint64_t> compare3 = { 15, 25, 35, 45, 55, 70, 80, 90, 100 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -312,7 +312,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -347,11 +347,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -368,9 +368,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -388,9 +388,9 @@ namespace
std::vector<uint64_t> compare1 = { 100, 110, 122 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
}
//*************************************************************************
@ -405,9 +405,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -425,9 +425,9 @@ namespace
std::vector<uint64_t> compare1 = { 102, 111, 123 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
}
//*************************************************************************
@ -439,7 +439,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -470,11 +470,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -488,7 +488,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -518,11 +518,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -536,7 +536,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -561,11 +561,11 @@ namespace
std::vector<uint64_t> compare2 = { 6, 28, 51, 74, 97 };
std::vector<uint64_t> compare3 = { 16, 27, 38, 49, 60, 71, 82, 93 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -774,7 +774,7 @@ namespace
etl::timer::id::type id2 = controller.register_timer(free_function_callback, 100, etl::timer::mode::Repeating);
etl::timer::id::type id3 = controller.register_timer(free_callback2, 10, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -812,18 +812,18 @@ namespace
//Join the thread with the main thread
t1.join();
CHECK_EQUAL(2U, test.tick_list.size());
CHECK_EQUAL(2U, object.tick_list.size());
CHECK_EQUAL(10U, free_tick_list1.size());
CHECK(free_tick_list2.size() < 65U);
//std::vector<uint64_t> compare1 = { 400, 900 };
//std::vector<uint64_t> compare2 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
//CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), min(compare1.size(), test.tick_list.size()));
//CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), min(compare1.size(), object.tick_list.size()));
//CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), min(compare2.size(), free_tick_list1.size()));
}
#endif

View File

@ -52,11 +52,11 @@ namespace
//***************************************************************************
// Class callback via etl::function
//***************************************************************************
class Test
class Object
{
public:
Test()
Object()
: p_controller(nullptr)
{
}
@ -86,9 +86,9 @@ namespace
using callback_type = etl::icallback_timer_atomic<std::atomic_uint32_t>::callback_type;
Test test;
callback_type member_callback1 = callback_type::create<Test, test, &Test::callback1>();
callback_type member_callback2 = callback_type::create<Test, test, &Test::callback2>();
Object object;
callback_type member_callback1 = callback_type::create<Object, object, &Object::callback1>();
callback_type member_callback2 = callback_type::create<Object, object, &Object::callback2>();
//***************************************************************************
// Free function callback via etl::function
@ -143,7 +143,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Single_Shot);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -167,11 +167,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -182,7 +182,7 @@ namespace
etl::callback_timer_atomic<1, std::atomic_uint32_t> timer_controller;
etl::timer::id::type id1 = timer_controller.register_timer(member_callback1, 37, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
timer_controller.enable(true);
@ -202,7 +202,7 @@ namespace
CHECK(timer_controller.set_period(id1, 50));
timer_controller.start(id1);
test.tick_list.clear();
object.tick_list.clear();
ticks = 0;
@ -214,7 +214,7 @@ namespace
// Timer should have timed out.
CHECK_EQUAL(50U, *test.tick_list.data());
CHECK_EQUAL(50U, *object.tick_list.data());
CHECK(timer_controller.unregister_timer(id1));
CHECK(!timer_controller.unregister_timer(id1));
@ -231,7 +231,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -255,11 +255,11 @@ namespace
std::vector<uint64_t> compare2 = { 23, 46, 69, 92 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -273,7 +273,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -301,11 +301,11 @@ namespace
std::vector<uint64_t> compare2 = { 25, 50, 70, 95 };
std::vector<uint64_t> compare3 = { 15, 25, 35, 45, 55, 70, 80, 90, 100 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -319,7 +319,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -354,11 +354,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -375,9 +375,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -395,9 +395,9 @@ namespace
std::vector<uint64_t> compare1 = { 100, 110, 122 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
}
//*************************************************************************
@ -412,9 +412,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -432,9 +432,9 @@ namespace
std::vector<uint64_t> compare1 = { 102, 111, 123 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
}
//*************************************************************************
@ -446,7 +446,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -477,11 +477,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -495,7 +495,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -525,11 +525,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -543,7 +543,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback1, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -568,11 +568,11 @@ namespace
std::vector<uint64_t> compare2 = { 6, 28, 51, 74, 97 };
std::vector<uint64_t> compare3 = { 16, 27, 38, 49, 60, 71, 82, 93 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
}
@ -780,7 +780,7 @@ namespace
etl::timer::id::type id2 = controller.register_timer(free_function_callback1, 100, etl::timer::mode::Repeating);
etl::timer::id::type id3 = controller.register_timer(free_function_callback2, 10, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -818,18 +818,18 @@ namespace
//Join the thread with the main thread
t1.join();
CHECK_EQUAL(2U, test.tick_list.size());
CHECK_EQUAL(2U, object.tick_list.size());
CHECK_EQUAL(10U, free_tick_list1.size());
CHECK(free_tick_list2.size() < 65U);
//std::vector<uint64_t> compare1 = { 400, 900 };
//std::vector<uint64_t> compare2 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
//CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), min(compare1.size(), test.tick_list.size()));
//CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), min(compare1.size(), object.tick_list.size()));
//CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), min(compare2.size(), free_tick_list1.size()));
}
#endif

View File

@ -65,11 +65,11 @@ namespace
//***************************************************************************
// Class callback via etl::delegate
//***************************************************************************
class Test
class Object
{
public:
Test()
Object()
: p_controller(nullptr)
{
}
@ -99,9 +99,9 @@ namespace
using callback_type = etl::icallback_timer_interrupt<ScopedGuard>::callback_type;
Test test;
callback_type member_callback = callback_type::create<Test, test, &Test::callback>();
callback_type member_callback2 = callback_type::create<Test, test, &Test::callback2>();
Object object;
callback_type member_callback = callback_type::create<Object, object, &Object::callback>();
callback_type member_callback2 = callback_type::create<Object, object, &Object::callback2>();
//***************************************************************************
// Free function callback via etl::function
@ -158,7 +158,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Single_Shot);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -182,11 +182,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -199,7 +199,7 @@ namespace
etl::callback_timer_interrupt<1, ScopedGuard> timer_controller;
etl::timer::id::type id1 = timer_controller.register_timer(member_callback, 37, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
timer_controller.enable(true);
@ -219,7 +219,7 @@ namespace
CHECK(timer_controller.set_period(id1, 50));
timer_controller.start(id1);
test.tick_list.clear();
object.tick_list.clear();
ticks = 0;
@ -231,7 +231,7 @@ namespace
// Timer should have timed out.
CHECK_EQUAL(50U, *test.tick_list.data());
CHECK_EQUAL(50U, *object.tick_list.data());
CHECK(timer_controller.unregister_timer(id1));
CHECK(!timer_controller.unregister_timer(id1));
@ -250,7 +250,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -274,11 +274,11 @@ namespace
std::vector<uint64_t> compare2 = { 23, 46, 69, 92 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -294,7 +294,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -322,11 +322,11 @@ namespace
std::vector<uint64_t> compare2 = { 25, 50, 70, 95 };
std::vector<uint64_t> compare3 = { 15, 25, 35, 45, 55, 70, 80, 90, 100 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -342,7 +342,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -377,11 +377,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -400,9 +400,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -420,9 +420,9 @@ namespace
std::vector<uint64_t> compare1 = { 100, 110, 122 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_EQUAL(0U, ScopedGuard::guard_count);
}
@ -439,9 +439,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -459,9 +459,9 @@ namespace
std::vector<uint64_t> compare1 = { 102, 111, 123 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_EQUAL(0U, ScopedGuard::guard_count);
}
@ -475,7 +475,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -506,11 +506,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -526,7 +526,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -556,11 +556,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -576,7 +576,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -601,11 +601,11 @@ namespace
std::vector<uint64_t> compare2 = { 6, 28, 51, 74, 97 };
std::vector<uint64_t> compare3 = { 16, 27, 38, 49, 60, 71, 82, 93 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());

View File

@ -84,11 +84,11 @@ namespace
//***************************************************************************
// Class callback via etl::function
//***************************************************************************
class Test
class Object
{
public:
Test()
Object()
: p_controller(nullptr)
{
}
@ -121,9 +121,9 @@ namespace
using lock_type = etl::icallback_timer_locked::lock_type;
using unlock_type = etl::icallback_timer_locked::unlock_type;
Test test;
callback_type member_callback = callback_type::create<Test, test, &Test::callback>();
callback_type member_callback2 = callback_type::create<Test, test, &Test::callback2>();
Object object;
callback_type member_callback = callback_type::create<Object, object, &Object::callback>();
callback_type member_callback2 = callback_type::create<Object, object, &Object::callback2>();
//***************************************************************************
// Free function callback via etl::function
@ -190,7 +190,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Single_Shot);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -214,11 +214,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -236,7 +236,7 @@ namespace
etl::callback_timer_locked<1> timer_controller(try_lock, lock, unlock);
etl::timer::id::type id1 = timer_controller.register_timer(member_callback, 37, etl::timer::mode::Single_Shot);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
timer_controller.enable(true);
@ -256,7 +256,7 @@ namespace
CHECK(timer_controller.set_period(id1, 50));
timer_controller.start(id1);
test.tick_list.clear();
object.tick_list.clear();
ticks = 0;
@ -268,7 +268,7 @@ namespace
// Timer should have timed out.
CHECK_EQUAL(50U, *test.tick_list.data());
CHECK_EQUAL(50U, *object.tick_list.data());
CHECK(timer_controller.unregister_timer(id1));
CHECK(!timer_controller.unregister_timer(id1));
@ -292,7 +292,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -316,11 +316,11 @@ namespace
std::vector<uint64_t> compare2 = { 23, 46, 69, 92 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -341,7 +341,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -369,11 +369,11 @@ namespace
std::vector<uint64_t> compare2 = { 25, 50, 70, 95 };
std::vector<uint64_t> compare3 = { 15, 25, 35, 45, 55, 70, 80, 90, 100 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -394,7 +394,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -429,11 +429,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -457,9 +457,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -477,9 +477,9 @@ namespace
std::vector<uint64_t> compare1 = { 100, 110, 122 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_EQUAL(0U, locks.lock_count);
}
@ -501,9 +501,9 @@ namespace
(void)id2;
(void)id3;
test.set_controller(timer_controller);
object.set_controller(timer_controller);
test.tick_list.clear();
object.tick_list.clear();
timer_controller.start(id1);
@ -521,9 +521,9 @@ namespace
std::vector<uint64_t> compare1 = { 102, 111, 123 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_EQUAL(0U, locks.lock_count);
}
@ -542,7 +542,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -573,11 +573,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -598,7 +598,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -628,11 +628,11 @@ namespace
std::vector<uint64_t> compare2 = { 23 };
std::vector<uint64_t> compare3 = { 11, 22, 33 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -653,7 +653,7 @@ namespace
etl::timer::id::type id2 = timer_controller.register_timer(free_function_callback, 23, etl::timer::mode::Repeating);
etl::timer::id::type id3 = timer_controller.register_timer(free_function_callback2, 11, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -678,11 +678,11 @@ namespace
std::vector<uint64_t> compare2 = { 6, 28, 51, 74, 97 };
std::vector<uint64_t> compare3 = { 16, 27, 38, 49, 60, 71, 82, 93 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), compare1.size());
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), compare2.size());
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
@ -957,7 +957,7 @@ namespace
etl::timer::id::type id2 = controller.register_timer(free_function_callback, 100, etl::timer::mode::Repeating);
etl::timer::id::type id3 = controller.register_timer(free_function_callback2, 10, etl::timer::mode::Repeating);
test.tick_list.clear();
object.tick_list.clear();
free_tick_list1.clear();
free_tick_list2.clear();
@ -1001,18 +1001,18 @@ namespace
//Join the thread with the main thread
t1.join();
CHECK_EQUAL(2U, test.tick_list.size());
CHECK_EQUAL(2U, object.tick_list.size());
CHECK_EQUAL(10U, free_tick_list1.size());
CHECK(free_tick_list2.size() < 65U);
std::vector<uint64_t> compare1 = { 400, 900 };
std::vector<uint64_t> compare2 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
CHECK(test.tick_list.size() != 0);
CHECK(object.tick_list.size() != 0);
CHECK(free_tick_list1.size() != 0);
CHECK(free_tick_list2.size() != 0);
CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), min(compare1.size(), test.tick_list.size()));
CHECK_ARRAY_EQUAL(compare1.data(), object.tick_list.data(), min(compare1.size(), object.tick_list.size()));
CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list1.data(), min(compare2.size(), free_tick_list1.size()));
CHECK_EQUAL(0U, threadLock.lock_count);

View File

@ -55,15 +55,16 @@ namespace
using BufferM_t = etl::uninitialized_buffer_of<ItemM, SIZE + 1>;
using Buffer_t = etl::uninitialized_buffer_of<Ndc, SIZE + 1>;
BufferM_t bufferm1;
BufferM_t bufferm2;
//BufferM_t bufferm1;
//BufferM_t bufferm2;
Buffer_t buffer1;
Buffer_t buffer2;
//Buffer_t buffer1;
//Buffer_t buffer2;
//*************************************************************************
TEST(test_default_constructor)
{
Buffer_t buffer1;
Data data(buffer1.raw, SIZE);
CHECK(data.is_valid());
@ -80,6 +81,8 @@ namespace
//*************************************************************************
TEST(test_set_buffer_after_default_constructor)
{
Buffer_t buffer1;
Data data(SIZE);
CHECK(!data.is_valid());
@ -100,6 +103,7 @@ namespace
//*************************************************************************
TEST(test_constructor_from_literal)
{
Buffer_t buffer1;
Data data({ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") }, buffer1.raw, SIZE);
Compare compare = { Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
@ -115,6 +119,7 @@ namespace
//*************************************************************************
TEST(test_constructor_from_literal_excess)
{
Buffer_t buffer1;
Data data({ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") }, buffer1.raw, SIZE);
Compare compare = { Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
@ -131,6 +136,7 @@ namespace
//*************************************************************************
TEST(test_cpp17_deduced_constructor)
{
Buffer_t buffer1;
Data data({ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") }, buffer1.raw, SIZE);
Compare compare{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
@ -147,6 +153,7 @@ namespace
#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED)
TEST(test_cpp17_deduced_constructor_excess)
{
Buffer_t buffer1;
Data data({ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") }, buffer1.raw, SIZE);
Compare compare{ Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
@ -162,6 +169,7 @@ namespace
//*************************************************************************
TEST(test_push)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
for (auto v : test)
@ -183,6 +191,7 @@ namespace
//*************************************************************************
TEST(test_move_push)
{
BufferM_t bufferm1;
DataM data(bufferm1.raw, SIZE);
CompareM compare;
@ -203,6 +212,7 @@ namespace
//*************************************************************************
TEST(test_push_full_range)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -220,6 +230,7 @@ namespace
//*************************************************************************
TEST(test_iterator_to_pointer_operator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -241,6 +252,7 @@ namespace
//*************************************************************************
TEST(test_const_iterator_to_pointer_operator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -262,6 +274,7 @@ namespace
//*************************************************************************
TEST(test_push_full_range_reverse_iterator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -279,6 +292,7 @@ namespace
//*************************************************************************
TEST(test_push_excess_range)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -296,6 +310,7 @@ namespace
//*************************************************************************
TEST(test_push_excess_range_reverse_iterator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -313,6 +328,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_at_start_of_buffer)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -330,6 +346,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_at_start_of_buffer_reverse_iterator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -347,6 +364,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_at_end_of_buffer)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -365,6 +383,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_at_end_of_buffer_reverse_iterator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -383,6 +402,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_middle_of_buffer)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4") };
Compare input2{ Ndc("5"), Ndc("6"), Ndc("7") };
Data data(buffer1.raw, SIZE);
@ -403,6 +423,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_middle_of_buffer_reverse_iterator)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4") };
Compare input2{ Ndc("5"), Ndc("6"), Ndc("7") };
Data data(buffer1.raw, SIZE);
@ -423,6 +444,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_overlap_start_and_end_of_buffer)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Compare input2{ Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
@ -443,6 +465,7 @@ namespace
//*************************************************************************
TEST(test_push_short_range_overlap_start_and_end_of_buffer_reverse_iterator)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Compare input2{ Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
@ -463,6 +486,7 @@ namespace
//*************************************************************************
TEST(test_available)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
for (auto v : test)
@ -475,6 +499,7 @@ namespace
//*************************************************************************
TEST(test_front)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(input1.begin(), input1.end());
@ -492,6 +517,7 @@ namespace
//*************************************************************************
TEST(test_front_const)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(input1.begin(), input1.end());
@ -505,6 +531,7 @@ namespace
//*************************************************************************
TEST(test_back)
{
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(input1.begin(), input1.end());
@ -522,6 +549,7 @@ namespace
//*************************************************************************
TEST(test_back_const)
{
Buffer_t buffer1;
Compare input{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(input.begin(), input.end());
@ -535,7 +563,8 @@ namespace
//*************************************************************************
TEST(test_index_operator)
{
// Overrun by 3
// Overrun by 3
Buffer_t buffer1;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Compare input2{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
@ -561,6 +590,7 @@ namespace
TEST(test_index_operator_const)
{
// Overrun by 3
Buffer_t buffer1;
Compare input{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(input.begin(), input.end());
@ -574,6 +604,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_plus)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -597,6 +628,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_plus_rollover)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -620,6 +652,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_plus_equals)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -643,6 +676,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_plus_equals_rollover)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -666,6 +700,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_minus)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -689,6 +724,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_minus_rollover)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -712,6 +748,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_minus_equals)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -735,6 +772,7 @@ namespace
//*************************************************************************
TEST(test_random_iterator_minus_equals_rollover)
{
Buffer_t buffer1;
Compare input{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(input.begin(), input.end());
@ -758,6 +796,8 @@ namespace
//*************************************************************************
TEST(test_copy_constructor)
{
Buffer_t buffer1;
Buffer_t buffer2;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9") };
Compare input2{ Ndc("9"), Ndc("8"), Ndc("7"), Ndc("6"), Ndc("5"), Ndc("4"), Ndc("3"), Ndc("2"), Ndc("1"), Ndc("0") };
Data data1(buffer1.raw, SIZE);
@ -781,6 +821,8 @@ namespace
//*************************************************************************
TEST(test_move_constructor)
{
BufferM_t bufferm1;
BufferM_t bufferm2;
CompareM input1;
CompareM input2;
CompareM compare;
@ -819,6 +861,8 @@ namespace
//*************************************************************************
TEST(test_assignment)
{
Buffer_t buffer1;
Buffer_t buffer2;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8") };
Compare input2{ Ndc("8"), Ndc("7"), Ndc("6"), Ndc("5"), Ndc("4"), Ndc("3"), Ndc("2"), Ndc("1"), Ndc("0") };
Data data1(buffer1.raw, SIZE);
@ -845,6 +889,8 @@ namespace
//*************************************************************************
TEST(test_move_assignment)
{
Buffer_t buffer1;
Buffer_t buffer2;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8") };
Compare input2{ Ndc("8"), Ndc("7"), Ndc("6"), Ndc("5"), Ndc("4"), Ndc("3"), Ndc("2"), Ndc("1"), Ndc("0") };
Data data1(buffer1.raw, SIZE);
@ -871,6 +917,7 @@ namespace
//*************************************************************************
TEST(test_swap_iterator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -893,6 +940,7 @@ namespace
//*************************************************************************
TEST(test_swap_const_iterator)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -915,6 +963,7 @@ namespace
//*************************************************************************
TEST(test_iterator_difference)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -940,6 +989,7 @@ namespace
//*************************************************************************
TEST(test_const_iterator_difference)
{
Buffer_t buffer1;
Compare test{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data(buffer1.raw, SIZE);
data.push(test.begin(), test.end());
@ -987,6 +1037,7 @@ namespace
TEST(test_equal)
{
// Over-write by 3
Buffer_t buffer1;
Compare input{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data1(buffer1.raw, SIZE);
Data data2(buffer1.raw, SIZE);
@ -1000,6 +1051,8 @@ namespace
TEST(test_not_equal)
{
// Over-write by 3
Buffer_t buffer1;
Buffer_t buffer2;
Compare input1{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("7"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Compare input2{ Ndc("0"), Ndc("1"), Ndc("2"), Ndc("3"), Ndc("4"), Ndc("5"), Ndc("6"), Ndc("6"), Ndc("8"), Ndc("9"), Ndc("10"), Ndc("11"), Ndc("12") };
Data data1(buffer1.raw, SIZE);

View File

@ -8,7 +8,7 @@ https://www.etlcpp.com
Copyright(c) 2022 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining data copy
of this software and associated documentation ciles(the "Software"), to deal
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
@ -470,46 +470,46 @@ namespace
//*************************************************************************
TEST(test_member_dereference_operator_for_random_access_iterator)
{
struct Test
struct Object
{
int data;
int b;
};
Test test[] = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
Object object[] = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
etl::circular_iterator<Test*> ci(std::begin(test), std::end(test));
etl::circular_iterator<Object*> ci(std::begin(object), std::end(object));
CHECK_EQUAL(test[0].data, ci->data);
CHECK_EQUAL(test[0].b, ci->b);
CHECK_EQUAL(object[0].data, ci->data);
CHECK_EQUAL(object[0].b, ci->b);
*ci = { 7, 8 };
CHECK_EQUAL(test[0].data, ci->data);
CHECK_EQUAL(test[0].b, ci->b);
CHECK_EQUAL(object[0].data, ci->data);
CHECK_EQUAL(object[0].b, ci->b);
++ci;
CHECK_EQUAL(test[1].data, ci->data);
CHECK_EQUAL(test[1].b, ci->b);
CHECK_EQUAL(object[1].data, ci->data);
CHECK_EQUAL(object[1].b, ci->b);
++ci;
CHECK_EQUAL(test[2].data, ci->data);
CHECK_EQUAL(test[2].b, ci->b);
CHECK_EQUAL(object[2].data, ci->data);
CHECK_EQUAL(object[2].b, ci->b);
}
//*************************************************************************
TEST(test_member_dereference_operator_for_bidirectional_iterator)
{
struct Test
struct Object
{
int data;
int b;
};
std::list<Test> test = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
std::list<Test>::iterator itr = test.begin();
std::list<Object> object = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
std::list<Object>::iterator itr = object.begin();
etl::circular_iterator<std::list<Test>::iterator> ci(std::begin(test), std::end(test));
etl::circular_iterator<std::list<Object>::iterator> ci(std::begin(object), std::end(object));
CHECK_EQUAL(itr->b, ci->b);
@ -528,16 +528,16 @@ namespace
//*************************************************************************
TEST(test_member_dereference_operator_for_forward_iterator)
{
struct Test
struct Object
{
int data;
int b;
};
std::forward_list<Test> test = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
std::forward_list<Test>::iterator itr = test.begin();
std::forward_list<Object> object = { { 1, 2 }, { 3, 4 }, { 5, 6 } };
std::forward_list<Object>::iterator itr = object.begin();
etl::circular_iterator<std::forward_list<Test>::iterator> ci(std::begin(test), std::end(test));
etl::circular_iterator<std::forward_list<Object>::iterator> ci(std::begin(object), std::end(object));
CHECK_EQUAL(itr->b, ci->b);

View File

@ -37,35 +37,35 @@ namespace
typedef etl::compare<int> CompareInt;
struct Test
struct Object
{
int a;
int b;
};
Test ta = { 1, 2 };
Test tb = { 2, 3 };
Object ta = { 1, 2 };
Object tb = { 2, 3 };
//***********************************
bool operator <(const Test& lhs, const Test& rhs)
bool operator <(const Object& lhs, const Object& rhs)
{
return (lhs.a + lhs.b) < (rhs.a + rhs.b);
}
//***********************************
bool operator >(const Test& lhs, const Test& rhs)
bool operator >(const Object& lhs, const Object& rhs)
{
return (lhs.a + lhs.b) > (rhs.a + rhs.b);
}
//***********************************
bool operator <=(const Test& lhs, const Test& rhs)
bool operator <=(const Object& lhs, const Object& rhs)
{
return (lhs.a + lhs.b) <= (rhs.a + rhs.b);
}
//***********************************
bool operator >=(const Test& lhs, const Test& rhs)
bool operator >=(const Object& lhs, const Object& rhs)
{
return (lhs.a + lhs.b) >= (rhs.a + rhs.b);
}
@ -73,13 +73,13 @@ namespace
//***********************************
struct LessTest
{
bool operator()(const Test& lhs, const Test& rhs) const
bool operator()(const Object& lhs, const Object& rhs) const
{
return (lhs.a + lhs.b) < (rhs.a + rhs.b);
}
};
typedef etl::compare<Test, LessTest> CompareTest;
typedef etl::compare<Object, LessTest> CompareTest;
SUITE(test_compare)
{

View File

@ -71,7 +71,7 @@ namespace
bool parameter_correct = false;
//*****************************************************************************
// Test data structure.
// Object data structure.
//*****************************************************************************
struct Data
{
@ -79,7 +79,7 @@ namespace
};
//*****************************************************************************
// Test moveable only data structure.
// Object moveable only data structure.
//*****************************************************************************
struct MoveableOnlyData
{
@ -161,7 +161,7 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
@ -240,8 +240,8 @@ namespace
return a * 2;
}
Test test_static;
const Test const_test_static;
Object object_static;
const Object const_object_static;
}
namespace
@ -437,9 +437,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void)
{
Test test;
Object object;
etl::delegate<void(void)> d(test);
etl::delegate<void(void)> d(object);
d();
@ -449,9 +449,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_create)
{
Test test;
Object object;
auto d = etl::delegate<void(void)>::create(test);
auto d = etl::delegate<void(void)>::create(object);
d();
@ -462,9 +462,9 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_operator_void_create_constexpr)
{
static Test test;
static Object object;
constexpr auto d = etl::delegate<void(void)>::create(test);
constexpr auto d = etl::delegate<void(void)>::create(object);
d();
@ -475,9 +475,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_const)
{
const Test test;
const Object object;
etl::delegate<void(void)> d(test);
etl::delegate<void(void)> d(object);
d();
@ -488,7 +488,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_compile_time)
{
auto d = etl::delegate<void(void)>::create<Test, test_static>();
auto d = etl::delegate<void(void)>::create<Object, object_static>();
d();
@ -499,7 +499,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_operator_void_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(void)>::create<Test, test_static>();
constexpr auto d = etl::delegate<void(void)>::create<Object, object_static>();
d();
@ -510,7 +510,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_compile_time_const)
{
auto d = etl::delegate<void(void)>::create<const Test, const_test_static>();
auto d = etl::delegate<void(void)>::create<const Object, const_object_static>();
d();
@ -521,7 +521,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_operator_void_compile_time_const_constexpr)
{
constexpr auto d = etl::delegate<void(void)>::create<const Test, const_test_static>();
constexpr auto d = etl::delegate<void(void)>::create<const Object, const_object_static>();
d();
@ -533,11 +533,11 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_member_operator_void)
{
Test test;
Object object;
etl::delegate<void(void)> d;
d = test;
d = object;
d();
@ -547,9 +547,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void)
{
Test test;
Object object;
auto d = etl::delegate<void(void)>::create<Test, &Test::member_void>(test);
auto d = etl::delegate<void(void)>::create<Object, &Object::member_void>(object);
d();
@ -560,9 +560,9 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_void_constexpr)
{
static Test test;
static Object object;
constexpr auto d = etl::delegate<void(void)>::create<Test, &Test::member_void>(test);
constexpr auto d = etl::delegate<void(void)>::create<Object, &Object::member_void>(object);
d();
@ -573,9 +573,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_const)
{
const Test test;
const Object object;
auto d = etl::delegate<void(void)>::create<Test, &Test::member_void_const>(test);
auto d = etl::delegate<void(void)>::create<Object, &Object::member_void_const>(object);
d();
@ -586,9 +586,9 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_void_const_constexpr)
{
static const Test test;
static const Object object;
constexpr auto d = etl::delegate<void(void)>::create<Test, &Test::member_void_const>(test);
constexpr auto d = etl::delegate<void(void)>::create<Object, &Object::member_void_const>(object);
d();
@ -599,9 +599,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int)
{
Test test;
Object object;
auto d = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
auto d = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
d(VALUE1, VALUE2);
@ -613,9 +613,9 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_int_constexpr)
{
static Test test;
static Object object;
constexpr auto d = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
constexpr auto d = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
d(VALUE1, VALUE2);
@ -627,9 +627,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_const)
{
const Test test;
const Object object;
auto d = etl::delegate<void(int, int)>::create<Test, &Test::member_int_const>(test);
auto d = etl::delegate<void(int, int)>::create<Object, &Object::member_int_const>(object);
d(VALUE1, VALUE2);
@ -641,9 +641,9 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_int_const_constexpr)
{
static const Test test;
static const Object object;
constexpr auto d = etl::delegate<void(int, int)>::create<Test, &Test::member_int_const>(test);
constexpr auto d = etl::delegate<void(int, int)>::create<Object, &Object::member_int_const>(object);
d(VALUE1, VALUE2);
@ -655,8 +655,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference)
{
Test test;
auto d = etl::delegate<void(const Data&, int)>::create<Test, &Test::member_reference>(test);
Object object;
auto d = etl::delegate<void(const Data&, int)>::create<Object, &Object::member_reference>(object);
Data data;
data.d = VALUE1;
@ -671,8 +671,8 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_reference_constexpr)
{
static Test test;
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Test, &Test::member_reference>(test);
static Object object;
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Object, &Object::member_reference>(object);
Data data;
data.d = VALUE1;
@ -687,8 +687,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_const)
{
const Test test;
auto d = etl::delegate<void(const Data&, int)>::create<Test, &Test::member_reference_const>(test);
const Object object;
auto d = etl::delegate<void(const Data&, int)>::create<Object, &Object::member_reference_const>(object);
Data data;
data.d = VALUE1;
@ -703,8 +703,8 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_reference_const_constexpr)
{
static const Test test;
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Test, &Test::member_reference_const>(test);
static const Object object;
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Object, &Object::member_reference_const>(object);
Data data;
data.d = VALUE1;
@ -719,8 +719,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_moveableonly)
{
Test test;
auto d = etl::delegate<void(MoveableOnlyData&&)>::create<Test, &Test::member_moveableonly>(test);
Object object;
auto d = etl::delegate<void(MoveableOnlyData&&)>::create<Object, &Object::member_moveableonly>(object);
MoveableOnlyData data;
data.d = VALUE1;
@ -735,8 +735,8 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_moveableonly_constexpr)
{
static Test test;
constexpr auto d = etl::delegate<void(MoveableOnlyData&&)>::create<Test, &Test::member_moveableonly>(test);
static Object object;
constexpr auto d = etl::delegate<void(MoveableOnlyData&&)>::create<Object, &Object::member_moveableonly>(object);
MoveableOnlyData data;
data.d = VALUE1;
@ -751,7 +751,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_static)
{
auto d = etl::delegate<void(const Data&, int)>::create<Test::member_static>();
auto d = etl::delegate<void(const Data&, int)>::create<Object::member_static>();
Data data;
data.d = VALUE1;
@ -766,7 +766,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_static_constexpr)
{
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Test::member_static>();
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Object::member_static>();
Data data;
data.d = VALUE1;
@ -782,7 +782,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_compile_time)
{
auto d = etl::delegate<void(void)>::create<Test, test_static, &Test::member_void>();
auto d = etl::delegate<void(void)>::create<Object, object_static, &Object::member_void>();
d();
@ -793,7 +793,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_void_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(void)>::create<Test, test_static, &Test::member_void>();
constexpr auto d = etl::delegate<void(void)>::create<Object, object_static, &Object::member_void>();
d();
@ -804,7 +804,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_const_compile_time)
{
auto d = etl::delegate<void(void)>::create<Test, const_test_static, &Test::member_void_const>();
auto d = etl::delegate<void(void)>::create<Object, const_object_static, &Object::member_void_const>();
d();
@ -815,7 +815,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_void_const_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(void)>::create<Test, const_test_static, &Test::member_void_const>();
constexpr auto d = etl::delegate<void(void)>::create<Object, const_object_static, &Object::member_void_const>();
d();
@ -826,7 +826,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_compile_time)
{
auto d = etl::delegate<void(int, int)>::create<Test, test_static, &Test::member_int>();
auto d = etl::delegate<void(int, int)>::create<Object, object_static, &Object::member_int>();
d(VALUE1, VALUE2);
@ -838,7 +838,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_int_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(int, int)>::create<Test, test_static, &Test::member_int>();
constexpr auto d = etl::delegate<void(int, int)>::create<Object, object_static, &Object::member_int>();
d(VALUE1, VALUE2);
@ -850,7 +850,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_const_compile_time)
{
auto d = etl::delegate<void(int, int)>::create<Test, const_test_static, &Test::member_int_const>();
auto d = etl::delegate<void(int, int)>::create<Object, const_object_static, &Object::member_int_const>();
d(VALUE1, VALUE2);
@ -862,7 +862,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_int_const_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(int, int)>::create<Test, const_test_static, &Test::member_int_const>();
constexpr auto d = etl::delegate<void(int, int)>::create<Object, const_object_static, &Object::member_int_const>();
d(VALUE1, VALUE2);
@ -874,7 +874,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_compile_time)
{
auto d = etl::delegate<void(const Data&, int)>::create<Test, test_static, &Test::member_reference>();
auto d = etl::delegate<void(const Data&, int)>::create<Object, object_static, &Object::member_reference>();
Data data;
data.d = VALUE1;
@ -889,7 +889,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_reference_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Test, test_static, &Test::member_reference>();
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Object, object_static, &Object::member_reference>();
Data data;
data.d = VALUE1;
@ -904,7 +904,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_const_compile_time)
{
auto d = etl::delegate<void(const Data&, int)>::create<Test, const_test_static, &Test::member_reference_const>();
auto d = etl::delegate<void(const Data&, int)>::create<Object, const_object_static, &Object::member_reference_const>();
Data data;
data.d = VALUE1;
@ -919,7 +919,7 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_member_reference_const_compile_time_constexpr)
{
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Test, const_test_static, &Test::member_reference_const>();
constexpr auto d = etl::delegate<void(const Data&, int)>::create<Object, const_object_static, &Object::member_reference_const>();
Data data;
data.d = VALUE1;
@ -960,10 +960,10 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_set_member_reference)
{
Test test;
Object object;
etl::delegate<void(const Data&, int)> d;
d.set<Test, &Test::member_reference>(test);
d.set<Object, &Object::member_reference>(object);
Data data;
data.d = VALUE1;
@ -977,10 +977,10 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_set_const_member_reference)
{
Test test;
Object object;
etl::delegate<void(const Data&, int)> d;
d.set<Test, &Test::member_reference_const>(test);
d.set<Object, &Object::member_reference_const>(object);
Data data;
data.d = VALUE1;
@ -996,7 +996,7 @@ namespace
{
etl::delegate<void(const Data&, int)> d;
d.set<Test, test_static, &Test::member_reference>();
d.set<Object, object_static, &Object::member_reference>();
Data data;
data.d = VALUE1;
@ -1012,7 +1012,7 @@ namespace
{
etl::delegate<void(const Data&, int)> d;
d.set<Test, const_test_static, &Test::member_reference_const>();
d.set<Object, const_object_static, &Object::member_reference_const>();
Data data;
data.d = VALUE1;
@ -1027,9 +1027,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_construct)
{
Test test;
Object object;
auto d1 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
auto d1 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
auto d2(d1);
d2(VALUE1, VALUE2);
@ -1042,9 +1042,9 @@ namespace
#if ETL_USING_CPP14
TEST_FIXTURE(SetupFixture, test_copy_construct_constexpr)
{
static Test test;
static Object object;
constexpr auto d1 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
constexpr auto d1 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
constexpr auto d2(d1);
d2(VALUE1, VALUE2);
@ -1057,9 +1057,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment)
{
Test test;
Object object;
auto d1 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
auto d1 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
etl::delegate<void(int, int)> d2;
d2 = d1;
@ -1073,9 +1073,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_delegate_equal)
{
Test test;
Object object;
auto d1 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
auto d1 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
auto d2 = d1;
CHECK(d1 == d2);
@ -1084,10 +1084,10 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_delegate_not_equal)
{
Test test;
Object object;
auto d1 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test);
auto d2 = etl::delegate<void(int, int)>::create<Test, &Test::member_int_const>(test);;
auto d1 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(object);
auto d2 = etl::delegate<void(int, int)>::create<Object, &Object::member_int_const>(object);;
CHECK(d1 != d2);
}
@ -1205,12 +1205,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_delegate_identification)
{
Test test1;
Test test2;
Object test1;
Object test2;
auto d1 = etl::delegate<void(int, int)>::create<free_int>();
auto d2 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test1);
auto d3 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test2);
auto d2 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(test1);
auto d3 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(test2);
etl::delegate<void(int, int)> d4;
@ -1241,7 +1241,7 @@ namespace
CHECK(*itr != d2);
CHECK(*itr == d3);
d4 = etl::delegate<void(int, int)>::create<Test, &Test::member_int>(test2); // Same as d3
d4 = etl::delegate<void(int, int)>::create<Object, &Object::member_int>(test2); // Same as d3
itr = std::find(delegate_list.begin(), delegate_list.end(), d4);
CHECK(*itr != d1);
CHECK(*itr != d2);

View File

@ -70,7 +70,7 @@ namespace
bool parameter_correct = false;
//*****************************************************************************
// Test data structure.
// Object data structure.
//*****************************************************************************
struct Data
{
@ -137,7 +137,7 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
@ -208,8 +208,8 @@ namespace
return a * 2;
}
Test test_static;
const Test const_test_static;
Object test_static;
const Object const_test_static;
}
namespace
@ -297,9 +297,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void)
{
Test test;
Object object;
etl_cpp03::delegate<void(void)> d(test);
etl_cpp03::delegate<void(void)> d(object);
d();
@ -309,9 +309,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_create)
{
Test test;
Object object;
auto d = etl_cpp03::delegate<void(void)>::create(test);
auto d = etl_cpp03::delegate<void(void)>::create(object);
d();
@ -321,9 +321,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_const)
{
const Test test;
const Object object;
etl_cpp03::delegate<void(void)> d(test);
etl_cpp03::delegate<void(void)> d(object);
d();
@ -334,7 +334,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_compile_time)
{
auto d = etl_cpp03::delegate<void(void)>::create<Test, test_static>();
auto d = etl_cpp03::delegate<void(void)>::create<Object, test_static>();
d();
@ -344,7 +344,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_operator_void_compile_time_const)
{
auto d = etl_cpp03::delegate<void(void)>::create<const Test, const_test_static>();
auto d = etl_cpp03::delegate<void(void)>::create<const Object, const_test_static>();
d();
@ -355,11 +355,11 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_member_operator_void)
{
Test test;
Object object;
etl_cpp03::delegate<void(void)> d;
d = test;
d = object;
d();
@ -369,9 +369,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void)
{
Test test;
Object object;
auto d = etl_cpp03::delegate<void(void)>::create<Test, &Test::member_void>(test);
auto d = etl_cpp03::delegate<void(void)>::create<Object, &Object::member_void>(object);
d();
@ -381,9 +381,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_const)
{
const Test test;
const Object object;
auto d = etl_cpp03::delegate<void(void)>::create<Test, &Test::member_void_const>(test);
auto d = etl_cpp03::delegate<void(void)>::create<Object, &Object::member_void_const>(object);
d();
@ -393,9 +393,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int)
{
Test test;
Object object;
auto d = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test);
auto d = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(object);
d(VALUE1);
@ -406,9 +406,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_const)
{
const Test test;
const Object object;
auto d = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int_const>(test);
auto d = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int_const>(object);
d(VALUE1);
@ -419,8 +419,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference)
{
Test test;
auto d = etl_cpp03::delegate<void(const Data&)>::create<Test, &Test::member_reference>(test);
Object object;
auto d = etl_cpp03::delegate<void(const Data&)>::create<Object, &Object::member_reference>(object);
Data data;
data.d = VALUE1;
@ -434,8 +434,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_const)
{
const Test test;
auto d = etl_cpp03::delegate<void(const Data&)>::create<Test, &Test::member_reference_const>(test);
const Object object;
auto d = etl_cpp03::delegate<void(const Data&)>::create<Object, &Object::member_reference_const>(object);
Data data;
data.d = VALUE1;
@ -449,7 +449,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_static)
{
auto d = etl_cpp03::delegate<void(const Data&)>::create<Test::member_static>();
auto d = etl_cpp03::delegate<void(const Data&)>::create<Object::member_static>();
Data data;
data.d = VALUE1;
@ -464,7 +464,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_compile_time)
{
auto d = etl_cpp03::delegate<void(void)>::create<Test, test_static, &Test::member_void>();
auto d = etl_cpp03::delegate<void(void)>::create<Object, test_static, &Object::member_void>();
d();
@ -474,7 +474,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_const_compile_time)
{
auto d = etl_cpp03::delegate<void(void)>::create<Test, const_test_static, &Test::member_void_const>();
auto d = etl_cpp03::delegate<void(void)>::create<Object, const_test_static, &Object::member_void_const>();
d();
@ -484,7 +484,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_compile_time)
{
auto d = etl_cpp03::delegate<void(int)>::create<Test, test_static, &Test::member_int>();
auto d = etl_cpp03::delegate<void(int)>::create<Object, test_static, &Object::member_int>();
d(VALUE1);
@ -495,7 +495,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_const_compile_time)
{
auto d = etl_cpp03::delegate<void(int)>::create<Test, const_test_static, &Test::member_int_const>();
auto d = etl_cpp03::delegate<void(int)>::create<Object, const_test_static, &Object::member_int_const>();
d(VALUE1);
@ -506,7 +506,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_compile_time)
{
auto d = etl_cpp03::delegate<void(const Data&)>::create<Test, test_static, &Test::member_reference>();
auto d = etl_cpp03::delegate<void(const Data&)>::create<Object, test_static, &Object::member_reference>();
Data data;
data.d = VALUE1;
@ -520,7 +520,7 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_const_compile_time)
{
auto d = etl_cpp03::delegate<void(const Data&)>::create<Test, const_test_static, &Test::member_reference_const>();
auto d = etl_cpp03::delegate<void(const Data&)>::create<Object, const_test_static, &Object::member_reference_const>();
Data data;
data.d = VALUE1;
@ -560,10 +560,10 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_set_member_reference)
{
Test test;
Object object;
etl_cpp03::delegate<void(const Data&)> d;
d.set<Test, &Test::member_reference>(test);
d.set<Object, &Object::member_reference>(object);
Data data;
data.d = VALUE1;
@ -577,10 +577,10 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_set_const_member_reference)
{
Test test;
Object object;
etl_cpp03::delegate<void(const Data&)> d;
d.set<Test, &Test::member_reference_const>(test);
d.set<Object, &Object::member_reference_const>(object);
Data data;
data.d = VALUE1;
@ -596,7 +596,7 @@ namespace
{
etl_cpp03::delegate<void(const Data&)> d;
d.set<Test, test_static, &Test::member_reference>();
d.set<Object, test_static, &Object::member_reference>();
Data data;
data.d = VALUE1;
@ -612,7 +612,7 @@ namespace
{
etl_cpp03::delegate<void(const Data&)> d;
d.set<Test, const_test_static, &Test::member_reference_const>();
d.set<Object, const_test_static, &Object::member_reference_const>();
Data data;
data.d = VALUE1;
@ -627,9 +627,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_construct)
{
Test test;
Object object;
auto d1 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test);
auto d1 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(object);
auto d2(d1);
d2(VALUE1);
@ -641,9 +641,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment)
{
Test test;
Object object;
auto d1 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test);
auto d1 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(object);
etl_cpp03::delegate<void(int)> d2;
d2 = d1;
@ -657,9 +657,9 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_delegate_equal)
{
Test test;
Object object;
auto d1 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test);
auto d1 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(object);
auto d2 = d1;
CHECK(d1 == d2);
@ -668,10 +668,10 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_delegate_not_equal)
{
Test test;
Object object;
auto d1 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test);
auto d2 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int_const>(test);;
auto d1 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(object);
auto d2 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int_const>(object);;
CHECK(d1 != d2);
}
@ -776,12 +776,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_delegate_identification)
{
Test test1;
Test test2;
Object test1;
Object test2;
auto d1 = etl_cpp03::delegate<void(int)>::create<free_int>();
auto d2 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test1);
auto d3 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test2);
auto d2 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(test1);
auto d3 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(test2);
etl_cpp03::delegate<void(int)> d4;
@ -812,7 +812,7 @@ namespace
CHECK(*itr != d2);
CHECK(*itr == d3);
d4 = etl_cpp03::delegate<void(int)>::create<Test, &Test::member_int>(test2); // Same as d3
d4 = etl_cpp03::delegate<void(int)>::create<Object, &Object::member_int>(test2); // Same as d3
itr = std::find(delegate_list.begin(), delegate_list.end(), d4);
CHECK(*itr != d1);
CHECK(*itr != d2);

View File

@ -68,12 +68,12 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
Test()
: callback(Service::delegate_type::create<Test, &Test::member1>(*this))
Object()
: callback(Service::delegate_type::create<Object, &Object::member1>(*this))
{
}
@ -93,10 +93,10 @@ namespace
etl::delegate<void(size_t)> callback;
};
Test test;
Object object;
// Callback for 'member2'.
ETL_CONSTEXPR14 Service::delegate_type member_callback = Service::delegate_type::create<Test, test, &Test::member2>();
ETL_CONSTEXPR14 Service::delegate_type member_callback = Service::delegate_type::create<Object, object, &Object::member2>();
// Callback for 'global'.
ETL_CONSTEXPR14 Service::delegate_type global_callback = Service::delegate_type::create<global>();
@ -138,7 +138,7 @@ namespace
Service service;
service.register_delegate<Global>(global_callback);
service.register_delegate<Member1>(test.callback);
service.register_delegate<Member1>(object.callback);
service.register_delegate<Member2>(member_callback);
service.call<Global>();
@ -156,7 +156,7 @@ namespace
Service service;
service.register_delegate(Global, global_callback);
service.register_delegate(Member1, test.callback);
service.register_delegate(Member1, object.callback);
service.register_delegate(Member2, member_callback);
service.call(Global);
@ -174,7 +174,7 @@ namespace
Service service;
service.register_delegate<Global>(global_callback);
service.register_delegate<Member1>(test.callback);
service.register_delegate<Member1>(object.callback);
service.register_delegate<Member2>(member_callback);
service.call<Member1>();
@ -192,7 +192,7 @@ namespace
Service service;
service.register_delegate(Global, global_callback);
service.register_delegate(Member1, test.callback);
service.register_delegate(Member1, object.callback);
service.register_delegate(Member2, member_callback);
service.call(Member1);
@ -210,7 +210,7 @@ namespace
Service service;
service.register_delegate<Global>(global_callback);
service.register_delegate<Member1>(test.callback);
service.register_delegate<Member1>(object.callback);
service.register_delegate<Member2>(member_callback);
service.call<Member2>();
@ -228,7 +228,7 @@ namespace
Service service;
service.register_delegate<Global>(global_callback);
service.register_delegate<Member1>(test.callback);
service.register_delegate<Member1>(object.callback);
service.register_delegate<Member2>(member_callback);
service.call(Out_Of_Range);
@ -246,7 +246,7 @@ namespace
Service service;
service.register_delegate<Global>(global_callback);
service.register_delegate<Member1>(test.callback);
service.register_delegate<Member1>(object.callback);
service.register_delegate<Member2>(member_callback);
service.register_unhandled_delegate(unhandled_callback);

View File

@ -67,11 +67,11 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
Test()
Object()
{
}
@ -82,10 +82,10 @@ namespace
}
};
Test test;
Object object;
// Callback for 'member'.
ETL_CONSTEXPR14 etl::delegate<void(size_t)> member_callback = etl::delegate<void(size_t)>::create<Test, test, &Test::member>();
ETL_CONSTEXPR14 etl::delegate<void(size_t)> member_callback = etl::delegate<void(size_t)>::create<Object, object, &Object::member>();
// Callback for 'global'.
ETL_CONSTEXPR14 etl::delegate<void(size_t)> global_callback = etl::delegate<void(size_t)>::create<global>();

View File

@ -68,12 +68,12 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
Test()
: callback(Service::delegate_type::create<Test, &Test::member1>(*this))
Object()
: callback(Service::delegate_type::create<Object, &Object::member1>(*this))
{
}
@ -93,10 +93,10 @@ namespace
Service::delegate_type callback;
};
Test test;
Object object;
// Callback for 'member2'.
Service::delegate_type member_callback = Service::delegate_type::create<Test, test, &Test::member2>();
Service::delegate_type member_callback = Service::delegate_type::create<Object, object, &Object::member2>();
// Callback for 'global'.
Service::delegate_type global_callback = Service::delegate_type::create<global>();

View File

@ -47,15 +47,15 @@ namespace
{
SUITE(test_deque)
{
const size_t SIZE = 14UL;
const size_t Size = 14UL;
typedef TestDataDC<std::string> DC;
typedef TestDataNDC<std::string> NDC;
typedef etl::deque<int, SIZE> DataInt;
typedef etl::deque<int, Size> DataInt;
typedef etl::ideque<int> IDataInt;
typedef etl::deque<DC, SIZE> DataDC;
typedef etl::deque<NDC, SIZE> DataNDC;
typedef etl::deque<DC, Size> DataDC;
typedef etl::deque<NDC, Size> DataNDC;
typedef etl::ideque<NDC> IDataNDC;
typedef std::deque<NDC> Compare_Data;
@ -100,14 +100,14 @@ namespace
CHECK(!data.full());
CHECK(data.begin() == data.end());
CHECK_EQUAL(0U, data.size());
CHECK_EQUAL(SIZE, data.max_size());
CHECK_EQUAL(Size, data.max_size());
}
//*************************************************************************
TEST(test_constructor_fill)
{
Compare_Data compare_data(SIZE, N999);
DataNDC data(SIZE, N999);
Compare_Data compare_data(Size, N999);
DataNDC data(Size, N999);
CHECK_EQUAL(compare_data.size(), data.size());
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
@ -118,8 +118,8 @@ namespace
{
int current_count = NDC::get_instance_count();
DataNDC* pdata = new DataNDC(SIZE, N999);
CHECK_EQUAL(int(current_count + SIZE), NDC::get_instance_count());
DataNDC* pdata = new DataNDC(Size, N999);
CHECK_EQUAL(int(current_count + Size), NDC::get_instance_count());
IDataNDC* pidata = pdata;
delete pidata;
@ -129,7 +129,7 @@ namespace
//*************************************************************************
TEST(test_constructor_fill_excess)
{
CHECK_THROW(DataNDC(SIZE + 1, N999), etl::deque_full);
CHECK_THROW(DataNDC(Size + 1, N999), etl::deque_full);
}
//*************************************************************************
@ -167,8 +167,7 @@ namespace
//*************************************************************************
TEST(test_move_constructor)
{
const size_t SIZE = 10UL;
typedef etl::deque<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::deque<std::unique_ptr<uint32_t>, Size> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
std::unique_ptr<uint32_t> p2(new uint32_t(2U));
@ -196,8 +195,7 @@ namespace
//*************************************************************************
TEST(test_move_insert_erase)
{
const size_t SIZE = 10UL;
typedef etl::deque<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::deque<std::unique_ptr<uint32_t>, Size> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
std::unique_ptr<uint32_t> p2(new uint32_t(2U));
@ -249,8 +247,7 @@ namespace
//*************************************************************************
TEST(test_move_assignment)
{
const size_t SIZE = 10UL;
typedef etl::deque<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::deque<std::unique_ptr<uint32_t>, Size> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
std::unique_ptr<uint32_t> p2(new uint32_t(2U));
@ -294,8 +291,7 @@ namespace
//*************************************************************************
TEST(test_move_assignment_interface)
{
const size_t SIZE = 10UL;
typedef etl::deque<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::deque<std::unique_ptr<uint32_t>, Size> Data;
typedef etl::ideque<std::unique_ptr<uint32_t>> IData;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
@ -366,9 +362,9 @@ namespace
Compare_Data compare_data;
DataNDC data;
compare_data.assign(SIZE, N999);
compare_data.assign(Size, N999);
CHECK_NO_THROW(data.assign(SIZE, N999));
CHECK_NO_THROW(data.assign(Size, N999));
CHECK_EQUAL(compare_data.size(), data.size());
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
@ -379,7 +375,7 @@ namespace
{
DataNDC data;
CHECK_THROW(data.assign(SIZE + 1, N999), etl::deque_full);
CHECK_THROW(data.assign(Size + 1, N999), etl::deque_full);
}
//*************************************************************************
@ -539,7 +535,7 @@ namespace
//*************************************************************************
TEST(test_iterator_comparison)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
DataNDC::iterator first = data.begin() + 1;
DataNDC::iterator second = data.begin() + 1;
@ -579,7 +575,7 @@ namespace
//*************************************************************************
TEST(test_const_iterator_comparison)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
DataNDC::const_iterator first = data.begin() + 1;
DataNDC::const_iterator second = data.begin() + 1;
@ -619,7 +615,7 @@ namespace
//*************************************************************************
TEST(test_iterator_comparison_rollover_left)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_back();
data.pop_back();
@ -640,7 +636,7 @@ namespace
//*************************************************************************
TEST(test_const_iterator_comparison_rollover_left)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_back();
data.pop_back();
@ -661,7 +657,7 @@ namespace
//*************************************************************************
TEST(test_iterator_comparison_rollover_right)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_front();
data.pop_front();
@ -682,7 +678,7 @@ namespace
//*************************************************************************
TEST(test_const_iterator_comparison_rollover_right)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_front();
data.pop_front();
@ -703,7 +699,7 @@ namespace
//*************************************************************************
TEST(test_reverse_iterator_comparison)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
DataNDC::reverse_iterator first = data.rbegin() + 1;
DataNDC::reverse_iterator second = data.rbegin() + 4;
@ -715,7 +711,7 @@ namespace
//*************************************************************************
TEST(test_const_reverse_iterator_comparison)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
DataNDC::const_reverse_iterator first = data.crbegin() + 1;
DataNDC::const_reverse_iterator second = data.crbegin() + 4;
@ -727,7 +723,7 @@ namespace
//*************************************************************************
TEST(test_reverse_iterator_comparison_rollover_left)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_back();
data.pop_back();
@ -748,7 +744,7 @@ namespace
//*************************************************************************
TEST(test_const_reverse_iterator_comparison_rollover_left)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_back();
data.pop_back();
@ -769,7 +765,7 @@ namespace
//*************************************************************************
TEST(test_reverse_iterator_comparison_rollover_right)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_front();
data.pop_front();
@ -790,7 +786,7 @@ namespace
//*************************************************************************
TEST(test_const_reverse_iterator_comparison_rollover_right)
{
DataNDC data(SIZE, N0);
DataNDC data(Size, N0);
data.pop_front();
data.pop_front();
@ -820,7 +816,7 @@ namespace
TEST(test_full)
{
DataDC data;
data.resize(SIZE);
data.resize(Size);
CHECK(data.full());
}
@ -830,13 +826,13 @@ namespace
{
DataDC data;
data.resize(SIZE);
data.resize(Size);
data.clear();
CHECK(data.empty());
// Do it again to check that clear() didn't screw up the internals.
data.resize(SIZE);
CHECK_EQUAL(SIZE, data.size());
data.resize(Size);
CHECK_EQUAL(Size, data.size());
data.clear();
CHECK(data.empty());
}
@ -846,12 +842,12 @@ namespace
{
DataInt data;
data.resize(SIZE);
data.resize(Size);
data.clear();
CHECK(data.empty());
// Do it again to check that clear() didn't screw up the internals.
data.resize(SIZE);
data.resize(Size);
data.clear();
CHECK(data.empty());
}
@ -1012,18 +1008,18 @@ namespace
};
// First fill with Initial values.
etl::deque<S, SIZE> data;
data.resize(SIZE, S(Initial));
etl::deque<S, Size> data;
data.resize(Size, S(Initial));
data.clear();
// Then emplace Default values.
for (size_t i = 0; i < SIZE; ++i)
for (size_t i = 0; i < Size; ++i)
{
data.emplace(data.end());
}
// Compare with an array of default values.
std::array<S, SIZE> compare_data;
std::array<S, Size> compare_data;
compare_data.fill(S());
CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
@ -1056,18 +1052,18 @@ namespace
};
// First fill with Initial values.
etl::deque<S, SIZE> data;
data.resize(SIZE, S(Initial));
etl::deque<S, Size> data;
data.resize(Size, S(Initial));
data.clear();
// Then emplace Default values.
for (size_t i = 0; i < SIZE; ++i)
for (size_t i = 0; i < Size; ++i)
{
data.emplace_front();
}
// Compare with an array of default values.
std::array<S, SIZE> compare_data;
std::array<S, Size> compare_data;
compare_data.fill(S());
CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
@ -1100,18 +1096,18 @@ namespace
};
// First fill with Initial values.
etl::deque<S, SIZE> data;
data.resize(SIZE, S(Initial));
etl::deque<S, Size> data;
data.resize(Size, S(Initial));
data.clear();
// Then emplace Default values.
for (size_t i = 0; i < SIZE; ++i)
for (size_t i = 0; i < Size; ++i)
{
data.emplace_back();
}
// Compare with an array of default values.
std::array<S, SIZE> compare_data;
std::array<S, Size> compare_data;
compare_data.fill(S());
CHECK_TRUE(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
@ -1120,7 +1116,7 @@ namespace
//*************************************************************************
TEST(test_insert_n_value_position)
{
size_t max_insert = SIZE - initial_data_small.size();
size_t max_insert = Size - initial_data_small.size();
for (size_t insert_size = 1UL; insert_size <= max_insert; ++insert_size)
{
@ -1143,7 +1139,7 @@ namespace
{
DataNDC data(initial_data_under.begin(), initial_data_under.end());
size_t insert_size = SIZE - initial_data_under.size() + 1;
size_t insert_size = Size - initial_data_under.size() + 1;
CHECK_THROW(data.insert(data.cbegin(), insert_size, N14), etl::deque_full);
CHECK_THROW(data.insert(data.cend(), insert_size, N14), etl::deque_full);
@ -1153,7 +1149,7 @@ namespace
//*************************************************************************
TEST(test_insert_range)
{
size_t max_insert = SIZE - initial_data_small.size();
size_t max_insert = Size - initial_data_small.size();
for (size_t insert_size = 1UL; insert_size <= max_insert; ++insert_size)
{
@ -1643,7 +1639,7 @@ namespace
{
DataNDC data;
for (size_t i = 0UL; i < SIZE; ++i)
for (size_t i = 0UL; i < Size; ++i)
{
CHECK_NO_THROW(data.push_back(N0));
}
@ -1765,7 +1761,7 @@ namespace
{
DataNDC data;
for (size_t i = 0UL; i < SIZE; ++i)
for (size_t i = 0UL; i < Size; ++i)
{
CHECK_NO_THROW(data.push_front(N1));
}
@ -1873,7 +1869,7 @@ namespace
data.push_back(DC("15"));
data.push_back(DC("16"));
data.push_back(DC("17"));
data.resize(SIZE);
data.resize(Size);
compare_data.pop_front();
compare_data.pop_front();
@ -1885,9 +1881,9 @@ namespace
compare_data.push_back(DC("15"));
compare_data.push_back(DC("16"));
compare_data.push_back(DC("17"));
compare_data.resize(SIZE);
compare_data.resize(Size);
CHECK_EQUAL(size_t(SIZE), data.size());
CHECK_EQUAL(size_t(Size), data.size());
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
}
@ -1908,7 +1904,7 @@ namespace
data.push_back(DC("15"));
data.push_back(DC("16"));
data.push_back(DC("17"));
data.resize(SIZE / 2);
data.resize(Size / 2);
compare_data.pop_front();
compare_data.pop_front();
@ -1920,7 +1916,7 @@ namespace
compare_data.push_back(DC("15"));
compare_data.push_back(DC("16"));
compare_data.push_back(DC("17"));
compare_data.resize(SIZE / 2);
compare_data.resize(Size / 2);
CHECK_EQUAL(compare_data.size(), data.size());
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
@ -1934,9 +1930,9 @@ namespace
data.push_front(N1);
data.push_back(N2);
data.resize(SIZE, N3);
data.resize(Size, N3);
CHECK_EQUAL(size_t(SIZE), data.size());
CHECK_EQUAL(size_t(Size), data.size());
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
}
@ -1945,7 +1941,7 @@ namespace
{
DataDC data;
CHECK_THROW(data.resize(SIZE + 1), etl::deque_full);
CHECK_THROW(data.resize(Size + 1), etl::deque_full);
}
//*************************************************************************
@ -2072,8 +2068,7 @@ namespace
//*************************************************************************
TEST(test_move)
{
const size_t SIZE = 10UL;
typedef etl::deque<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::deque<std::unique_ptr<uint32_t>, Size> Data;
Data data1;
@ -2090,7 +2085,7 @@ namespace
data1.insert(data1.begin() + 1, std::move(p4));
data1.insert(data1.end(), std::move(p5));
const size_t ACTUAL_SIZE = data1.size();
const size_t ACTUAL_Size = data1.size();
CHECK(!bool(p1));
CHECK(!bool(p2));
@ -2113,7 +2108,7 @@ namespace
CHECK_EQUAL(2U, *(*(data2.begin() + 3)));
CHECK_EQUAL(5U, *(*(data2.begin() + 4)));
CHECK_EQUAL(ACTUAL_SIZE, data2.size());
CHECK_EQUAL(ACTUAL_Size, data2.size());
// Move assignment.
Data data3;
@ -2125,7 +2120,7 @@ namespace
CHECK_EQUAL(2U, *(*(data3.begin() + 3)));
CHECK_EQUAL(5U, *(*(data3.begin() + 4)));
CHECK_EQUAL(ACTUAL_SIZE, data3.size());
CHECK_EQUAL(ACTUAL_Size, data3.size());
}
//*************************************************************************

View File

@ -101,21 +101,21 @@ namespace
//*************************************************************************
TEST(test_member_dereference_operator)
{
struct Test
struct Object
{
int a;
int b;
} test = { 1, 2 };
} object = { 1, 2 };
etl::fixed_iterator<Test*> fi(&test);
etl::fixed_iterator<Object*> fi(&object);
CHECK_EQUAL(test.a, fi->a);
CHECK_EQUAL(test.b, fi->b);
CHECK_EQUAL(object.a, fi->a);
CHECK_EQUAL(object.b, fi->b);
*fi = { 3, 4 };
CHECK_EQUAL(test.a, fi->a);
CHECK_EQUAL(test.b, fi->b);
CHECK_EQUAL(object.a, fi->a);
CHECK_EQUAL(object.b, fi->b);
}
//*************************************************************************

View File

@ -38,7 +38,7 @@ namespace
bool parameter_correct = false;
//*****************************************************************************
// Test data structure.
// Object data structure.
//*****************************************************************************
struct Data
{
@ -126,7 +126,7 @@ namespace
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
class Test
class Object
{
public:
@ -148,7 +148,7 @@ namespace
}
};
Test test_static;
Object test_static;
}
//*****************************************************************************
@ -298,8 +298,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void)
{
Test test;
etl::function<Test, void> function(test, &Test::member_void);
Object object;
etl::function<Object, void> function(object, &Object::member_void);
call(function);
@ -309,8 +309,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_member_void)
{
Test test;
const etl::function<Test, void> function(test, &Test::member_void);
Object object;
const etl::function<Object, void> function(object, &Object::member_void);
call(function);
@ -320,8 +320,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int)
{
Test test;
etl::function<Test, int> function(test, &Test::member_int);
Object object;
etl::function<Object, int> function(object, &Object::member_int);
call(function);
@ -332,8 +332,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_member_int)
{
Test test;
const etl::function<Test, int> function(test, &Test::member_int);
Object object;
const etl::function<Object, int> function(object, &Object::member_int);
call(function);
@ -344,8 +344,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference)
{
Test test;
etl::function<Test, const Data&> function(test, &Test::member_reference);
Object object;
etl::function<Object, const Data&> function(object, &Object::member_reference);
call(function);
@ -356,8 +356,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_member_reference)
{
Test test;
const etl::function<Test, const Data&> function(test, &Test::member_reference);
Object object;
const etl::function<Object, const Data&> function(object, &Object::member_reference);
call(function);
@ -368,8 +368,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_void_compile_time)
{
Test test;
etl::function_mv<Test, &Test::member_void> function(test);
Object object;
etl::function_mv<Object, &Object::member_void> function(object);
call(function);
@ -379,8 +379,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_member_void_compile_time)
{
Test test;
const etl::function_mv<Test, &Test::member_void> function(test);
Object object;
const etl::function_mv<Object, &Object::member_void> function(object);
call(function);
@ -390,8 +390,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_int_compile_time)
{
Test test;
etl::function_mp<Test, int, &Test::member_int> function(test);
Object object;
etl::function_mp<Object, int, &Object::member_int> function(object);
call(function);
@ -402,8 +402,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_member_int_compile_time)
{
Test test;
const etl::function_mp<Test, int, &Test::member_int> function(test);
Object object;
const etl::function_mp<Object, int, &Object::member_int> function(object);
call(function);
@ -414,8 +414,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_reference_compile_time)
{
Test test;
etl::function_mp<Test, const Data&, &Test::member_reference> function(test);
Object object;
etl::function_mp<Object, const Data&, &Object::member_reference> function(object);
call(function);
@ -426,8 +426,8 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_member_reference_compile_time)
{
Test test;
const etl::function_mp<Test, const Data&, &Test::member_reference> function(test);
Object object;
const etl::function_mp<Object, const Data&, &Object::member_reference> function(object);
call(function);
@ -440,7 +440,7 @@ namespace
{
function_called = false;
etl::function_imv<Test, test_static, &Test::member_void> function;
etl::function_imv<Object, test_static, &Object::member_void> function;
call(function);
@ -452,7 +452,7 @@ namespace
{
function_called = false;
const etl::function_imv<Test, test_static, &Test::member_void> function;
const etl::function_imv<Object, test_static, &Object::member_void> function;
call(function);
@ -464,7 +464,7 @@ namespace
{
function_called = false;
etl::function_imp<Test, int, test_static, &Test::member_int> function;
etl::function_imp<Object, int, test_static, &Object::member_int> function;
call(function);
@ -476,7 +476,7 @@ namespace
{
function_called = false;
const etl::function_imp<Test, int, test_static, &Test::member_int> function;
const etl::function_imp<Object, int, test_static, &Object::member_int> function;
call(function);
@ -488,7 +488,7 @@ namespace
{
function_called = false;
etl::function_imp<Test, const Data&, test_static, &Test::member_reference> function;
etl::function_imp<Object, const Data&, test_static, &Object::member_reference> function;
call(function);
@ -500,7 +500,7 @@ namespace
{
function_called = false;
const etl::function_imp<Test, const Data&, test_static, &Test::member_reference> function;
const etl::function_imp<Object, const Data&, test_static, &Object::member_reference> function;
call(function);

View File

@ -1427,9 +1427,9 @@ namespace
{
struct functor
{
void operator()(const NDC& ndc)
void operator()(const NDC& object)
{
result += ndc.value;
result += object.value;
}
std::string result;
@ -1458,9 +1458,9 @@ namespace
{
struct functor
{
bool operator()(const NDC& ndc)
bool operator()(const NDC& object)
{
return ndc.value == "4";
return object.value == "4";
}
std::string result;

View File

@ -1560,9 +1560,9 @@ namespace
{
struct functor
{
void operator()(const NDC& ndc)
void operator()(const NDC& object)
{
result += ndc.value;
result += object.value;
}
std::string result;
@ -1594,9 +1594,9 @@ namespace
{
struct functor
{
bool operator()(const NDC& ndc)
bool operator()(const NDC& object)
{
return ndc.value == "4";
return object.value == "4";
}
std::string result;

View File

@ -140,8 +140,6 @@ namespace
InitialDataNDC merge_data3;
InitialDataNDC merge_data4;
bool are_equal;
//*************************************************************************
struct SetupFixture
{
@ -204,7 +202,7 @@ namespace
{
DataNDC0 data0(sorted_data.begin(), sorted_data.end());
are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
CHECK(are_equal);
}
@ -229,7 +227,7 @@ namespace
{
DataNDC0 data0(sorted_data.begin(), sorted_data.end());
are_equal = std::equal(data0.cbegin(), data0.cend(), sorted_data.begin());
bool are_equal = std::equal(data0.cbegin(), data0.cend(), sorted_data.begin());
CHECK(are_equal);
}
@ -274,13 +272,13 @@ namespace
{
DataNDC0 data0;
static InitialDataNDC sorted_data = { ItemNDCNode("0"), ItemNDCNode("1"), ItemNDCNode("2"), ItemNDCNode("3"), ItemNDCNode("4"), ItemNDCNode("5"), ItemNDCNode("6"), ItemNDCNode("7"), ItemNDCNode("8"), ItemNDCNode("9") };
static InitialDataNDC assign_data = { ItemNDCNode("0"), ItemNDCNode("1"), ItemNDCNode("2"), ItemNDCNode("3"), ItemNDCNode("4"), ItemNDCNode("5"), ItemNDCNode("6"), ItemNDCNode("7"), ItemNDCNode("8"), ItemNDCNode("9") };
// Do it twice. We should only get one copy.
data0.assign(sorted_data.begin(), sorted_data.end());
data0.assign(sorted_data.begin(), sorted_data.end());
data0.assign(assign_data.begin(), assign_data.end());
data0.assign(assign_data.begin(), assign_data.end());
bool are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), assign_data.begin());
CHECK(are_equal);
}
@ -294,7 +292,7 @@ namespace
data0.assign(sorted_data.begin(), sorted_data.end());
data1.assign(sorted_data.begin(), sorted_data.end());
are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
CHECK(are_equal);
are_equal = std::equal(data1.begin(), data1.end(), sorted_data.begin());
@ -341,7 +339,7 @@ namespace
data0.push_front(node6);
data0.push_front(node7);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(6U, data0.size());
CHECK_EQUAL(6, std::distance(data0.begin(), data0.end()));
@ -381,7 +379,7 @@ namespace
data0.insert_after(i_data, INSERT_VALUE1);
compare_data.insert_after(i_compare_data, INSERT_VALUE1);
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size());
CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end()));
@ -426,7 +424,7 @@ namespace
data0.insert_after(data0.before_begin(), test2.begin(), test2.end());
are_equal = std::equal(data0.begin(), data0.end(), compare.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare.begin());
CHECK(are_equal);
are_equal = std::equal(data1.begin(), data1.end(), test1.begin());
@ -485,7 +483,7 @@ namespace
CHECK_NO_THROW(data0.push_front(node5));
CHECK_NO_THROW(data0.push_front(node6));
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK_EQUAL(6U, data0.size());
CHECK_EQUAL(6, std::distance(data0.begin(), data0.end()));
@ -573,7 +571,7 @@ namespace
i_compare_data = compare_data.erase_after(i_compare_data);
i_data = data0.erase_after(i_data);
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK(*i_compare_data == *i_data);
@ -675,7 +673,7 @@ namespace
CHECK_EQUAL(*i_compare_result, *i_result);
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size());
CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end()));
@ -705,7 +703,7 @@ namespace
CHECK(i_result == data0.end());
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size());
CHECK_EQUAL(std::distance(compare_data.begin(), compare_data.end()), std::distance(data0.begin(), data0.end()));
@ -743,7 +741,7 @@ namespace
data0.unique(EqualItemNDCNode());
// data0 should have changed.
are_equal = std::equal(data0.begin(), data0.end(), unique_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), unique_data.begin());
CHECK(are_equal);
CHECK_EQUAL(unique_data.size(), data0.size());
CHECK_EQUAL(unique_data.size(), size_t(std::distance(data0.begin(), data0.end())));
@ -765,7 +763,7 @@ namespace
compare_data.remove(ItemNDCNode("7"));
data0.remove(ItemNDCNode("7"));
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size());
@ -787,7 +785,7 @@ namespace
compare_data.remove_if(std::bind(std::equal_to<ItemNDCNode>(), std::placeholders::_1, ItemNDCNode("7")));
data0.remove_if(std::bind(std::equal_to<ItemNDCNode>(), std::placeholders::_1, ItemNDCNode("7")));
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data0.size());
@ -827,7 +825,7 @@ namespace
data0.sort(); // Just sort one of them.
are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
CHECK(are_equal);
are_equal = std::equal(data1.begin(), data1.end(), unsorted_data.begin());
@ -863,7 +861,7 @@ namespace
data0.sort(CompareItemNDCNode()); // Just sort one of them.
are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), sorted_data.begin());
CHECK(are_equal);
are_equal = std::equal(data1.begin(), data1.end(), unsorted_data.begin());
@ -888,7 +886,7 @@ namespace
data0.splice_after(idata_destination, data1);
compare0.splice_after(icompare_destination, compare1);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -907,7 +905,7 @@ namespace
data0.splice_after(idata_destination, data0);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -943,7 +941,7 @@ namespace
data0.splice_after(idata_destination, data1, idata_begin, idata_end);
compare0.splice_after(icompare_destination, compare1, icompare_begin, icompare_end);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -978,7 +976,7 @@ namespace
data0.splice_after(idata_destination, data0, idata_begin, idata_end);
compare0.splice_after(icompare_destination, compare0, icompare_begin, icompare_end);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -996,7 +994,7 @@ namespace
data0.merge(data1);
compare0.merge(compare1);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -1015,7 +1013,7 @@ namespace
data0.merge(data2);
compare0.merge(compare2);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -1034,7 +1032,7 @@ namespace
data0.merge(data3);
compare0.merge(compare3);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -1053,7 +1051,7 @@ namespace
data0.merge(data4);
compare0.merge(compare4);
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());
@ -1078,7 +1076,7 @@ namespace
data0.merge(data1, std::greater<ItemNDCNode>());
compare0.merge(compare1, std::greater<ItemNDCNode>());
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
bool are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
CHECK_EQUAL(size_t(std::distance(compare0.begin(), compare0.end())), data0.size());

View File

@ -640,25 +640,25 @@ namespace
//*************************************************************************
TEST(test_create_copy)
{
struct Test : etl::create_copy<Test>
struct Object : etl::create_copy<Object>
{
std::string text;
};
char buffer[sizeof(Test)];
char buffer[sizeof(Object)];
Test test1;
test1.text = "12345678";
test1.create_copy_at(buffer);
test1.text = "87654321";
Object object1;
object1.text = "12345678";
object1.create_copy_at(buffer);
object1.text = "87654321";
Test& test2 = *reinterpret_cast<Test*>(buffer);
Object& object2 = *reinterpret_cast<Object*>(buffer);
CHECK_EQUAL(std::string("87654321"), test1.text);
CHECK_EQUAL(std::string("12345678"), test2.text);
CHECK_EQUAL(std::string("87654321"), object1.text);
CHECK_EQUAL(std::string("12345678"), object2.text);
int count = 0;
test1.create_copy_at(buffer, count);
object1.create_copy_at(buffer, count);
CHECK_EQUAL(1, count);
}
@ -666,23 +666,23 @@ namespace
//*************************************************************************
TEST(test_create_make_copy)
{
struct Test : etl::create_copy<Test>
struct Object : etl::create_copy<Object>
{
std::string text;
};
char buffer[sizeof(Test)];
char buffer[sizeof(Object)];
Test test1;
test1.text = "12345678";
Test& test2 = test1.make_copy_at(buffer);
test1.text = "87654321";
Object object1;
object1.text = "12345678";
Object& object2 = object1.make_copy_at(buffer);
object1.text = "87654321";
CHECK_EQUAL(std::string("87654321"), test1.text);
CHECK_EQUAL(std::string("12345678"), test2.text);
CHECK_EQUAL(std::string("87654321"), object1.text);
CHECK_EQUAL(std::string("12345678"), object2.text);
int count = 0;
test1.make_copy_at(buffer, count);
object1.make_copy_at(buffer, count);
CHECK_EQUAL(1, count);
}

View File

@ -35,17 +35,17 @@ SOFTWARE.
namespace
{
class Test
class Object
{
public:
Test()
Object()
: p(new int())
{
*p = 4;
}
~Test()
~Object()
{
delete p;
}
@ -53,18 +53,18 @@ namespace
int* p;
};
class Test2 : public Test
class Object2 : public Object
{
};
}
namespace etl
{
// Test2 is a value parameter type.
// Object2 is a value parameter type.
template <>
struct parameter_type<Test2>
struct parameter_type<Object2>
{
typedef Test2 type;
typedef Object2 type;
};
}
@ -80,10 +80,10 @@ namespace
b = !etl::is_reference<etl::parameter_type<int>::type>::value;
CHECK(b);
b = etl::is_reference<etl::parameter_type<Test>::type>::value;
b = etl::is_reference<etl::parameter_type<Object>::type>::value;
CHECK(b);
b = !etl::is_reference<etl::parameter_type<Test2>::type>::value;
b = !etl::is_reference<etl::parameter_type<Object2>::type>::value;
CHECK(b);
}
};

View File

@ -352,7 +352,7 @@ namespace
//*************************************************************************
TEST(test_type_error)
{
struct Test
struct Object
{
uint64_t a;
uint64_t b;
@ -362,7 +362,7 @@ namespace
etl::ipool& ip = pool;
CHECK_THROW(ip.allocate<Test>(), etl::pool_element_size);
CHECK_THROW(ip.allocate<Object>(), etl::pool_element_size);
}
//*************************************************************************

View File

@ -388,7 +388,7 @@ namespace
//*************************************************************************
TEST(test_type_error)
{
struct Test
struct Object
{
uint64_t a;
uint64_t b;
@ -400,7 +400,7 @@ namespace
etl::ipool& ip = pool;
CHECK_THROW(ip.allocate<Test>(), etl::pool_element_size);
CHECK_THROW(ip.allocate<Object>(), etl::pool_element_size);
delete[] buffer;
}

View File

@ -612,12 +612,7 @@ namespace
}
// Try to insert when set is full should throw etl::set_full
try
{
data_result = data.insert(MAX_SIZE);
}
catch(const etl::set_full &e)
{}
CHECK_THROW(data_result = data.insert(MAX_SIZE), etl::set_full);
// Try adding a duplicate (should return iterator pointing to duplicate) not throw error
for (size_t i = 0; i < MAX_SIZE; ++i)
@ -639,7 +634,7 @@ namespace
}
//*************************************************************************
////*************************************************************************
//TEST_FIXTURE(SetupFixture, test_emplace_value)
//{
// Compare_Data compare_data;

View File

@ -153,12 +153,6 @@ namespace
using pool_message_parameters = etl::atomic_counted_message_pool::pool_message_parameters<Message1, Message2>;
etl::fixed_sized_memory_block_allocator<pool_message_parameters::max_size,
pool_message_parameters::max_alignment,
4U> memory_allocator;
etl::atomic_counted_message_pool message_pool(memory_allocator);
//*************************************************************************
class Message2Allocator : public etl::ireference_counted_message_pool
{
@ -182,6 +176,11 @@ namespace
//*************************************************************************
TEST(test_move_constructor)
{
etl::fixed_sized_memory_block_allocator<pool_message_parameters::max_size,
pool_message_parameters::max_alignment, 4U> memory_allocator;
etl::atomic_counted_message_pool message_pool(memory_allocator);
#include "etl/private/diagnostic_pessimizing_move_push.h"
etl::shared_message sm1(std::move(etl::shared_message(message_pool, Message1(1))));
#include "etl/private/diagnostic_pop.h"
@ -191,6 +190,12 @@ namespace
//*************************************************************************
TEST(test_default_message_constructor)
{
etl::fixed_sized_memory_block_allocator<pool_message_parameters::max_size,
pool_message_parameters::max_alignment,
4U> memory_allocator;
etl::atomic_counted_message_pool message_pool(memory_allocator);
etl::reference_counted_message<Message2, etl::atomic_int>* prcm = message_pool.allocate<Message2>();
Message2& m2 = prcm->get_message(); // Check that we can get a non-const reference to the message.
@ -214,6 +219,12 @@ namespace
//*************************************************************************
TEST(test_move_assignment)
{
etl::fixed_sized_memory_block_allocator<pool_message_parameters::max_size,
pool_message_parameters::max_alignment,
4U> memory_allocator;
etl::atomic_counted_message_pool message_pool(memory_allocator);
etl::shared_message sm2 = etl::shared_message(message_pool, Message1(2));
#include "etl/private/diagnostic_pessimizing_move_push.h"
sm2 = std::move(etl::shared_message(message_pool, Message1(3)));
@ -231,6 +242,12 @@ namespace
router1.clear();
router2.clear();
etl::fixed_sized_memory_block_allocator<pool_message_parameters::max_size,
pool_message_parameters::max_alignment,
4U> memory_allocator;
etl::atomic_counted_message_pool message_pool(memory_allocator);
etl::shared_message sm1(message_pool, Message1(1)); // sm1 holds a Message1 that is owned by message_pool.
etl::shared_message sm2(message_pool, Message2()); // sm2 holds a Message2 that is owned by message_pool.
etl::shared_message sm3(Message2Allocator::Get()); // sm3 holds a Message2 that is owned by a statically allocated message pool.
@ -263,8 +280,6 @@ namespace
//*************************************************************************
TEST(test_reference_counted_pool_exceptions)
{
using pool_message_parameters = etl::atomic_counted_message_pool::pool_message_parameters<Message1, Message2>;
etl::fixed_sized_memory_block_allocator<pool_message_parameters::max_size,
pool_message_parameters::max_alignment,
4U> memory_allocator;
@ -278,27 +293,12 @@ namespace
CHECK_NO_THROW(prcm = message_pool.allocate<Message1>(4));
(void)prcm;
try
{
prcm = message_pool.allocate<Message1>(5);
}
catch (etl::exception e)
{
CHECK_EQUAL(std::string("reference_counted_message_pool:allocation failure"), std::string(e.what()));
}
CHECK_THROW(prcm = message_pool.allocate<Message1>(5), etl::reference_counted_message_pool_allocation_failure);
Message1 message1(6);
etl::reference_counted_message<Message1, etl::atomic_int> temp(message1, message_pool);
try
{
message_pool.release(temp);
}
catch (etl::exception e)
{
CHECK_EQUAL(std::string("reference_counted_message_pool:release failure"), std::string(e.what()));
}
CHECK_THROW(message_pool.release(temp), etl::reference_counted_message_pool_release_failure);
}
}
}

View File

@ -45,7 +45,7 @@ namespace etl
namespace
{
// A class to test non-fundamental types.
struct Test
struct Object
{
int a;
};
@ -671,7 +671,7 @@ namespace
//*************************************************************************
TEST(test_alignment_of)
{
struct Test
struct Object
{
int a;
char b;
@ -690,7 +690,7 @@ namespace
CHECK(std::alignment_of<unsigned long long>::value == etl::alignment_of<unsigned long long>::value);
CHECK(std::alignment_of<float>::value == etl::alignment_of<float>::value);
CHECK(std::alignment_of<double>::value == etl::alignment_of<double>::value);
CHECK(std::alignment_of<Test>::value == etl::alignment_of<Test>::value);
CHECK(std::alignment_of<Object>::value == etl::alignment_of<Object>::value);
}
//*************************************************************************

View File

@ -1365,7 +1365,7 @@ namespace
}
S(int i): i(i){}
S(int i_): i(i_){}
int i;
};
@ -1398,7 +1398,7 @@ namespace
}
S(int i): i(i){}
S(int i_): i(i_){}
int i;
};

View File

@ -1199,7 +1199,7 @@ namespace
}
S(int i): i(i){}
S(int i_): i(i_){}
int i;
};
@ -1235,7 +1235,7 @@ namespace
}
S(int i): i(i){}
S(int i_): i(i_){}
int i;
};

View File

@ -213,7 +213,6 @@ namespace
//*************************************************************************
TEST(test_move_constructor)
{
const size_t SIZE = 10U;
typedef etl::vector<std::unique_ptr<uint32_t>, SIZE> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
@ -256,7 +255,6 @@ namespace
//*************************************************************************
TEST(test_move_assignment)
{
const size_t SIZE = 10U;
typedef etl::vector<std::unique_ptr<uint32_t>, SIZE> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
@ -303,7 +301,6 @@ namespace
//*************************************************************************
TEST(test_move_assignment_interface)
{
const size_t SIZE = 10U;
typedef etl::vector<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::ivector<std::unique_ptr<uint32_t>> IData;

View File

@ -1231,7 +1231,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1257,7 +1257,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_FORCE_TEST_CPP03_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1283,7 +1283,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_MESSAGES_ARE_NOT_VIRTUAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1309,7 +1309,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_IMESSAGE_IS_NON_VIRTUAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1335,7 +1335,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1360,7 +1360,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1385,7 +1385,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1409,7 +1409,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1433,7 +1433,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1457,7 +1457,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1481,7 +1481,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
@ -1691,7 +1691,7 @@
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>./;../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>