Re-enabled ETL_IN_UNIT_TEST macros

This commit is contained in:
John Wellbelove 2017-12-23 13:08:04 +00:00
parent 6779f87562
commit 03f9f05a76
4 changed files with 28 additions and 12 deletions

View File

@ -1797,9 +1797,17 @@ namespace etl
//*********************************************************************
void initialise()
{
while (current_size > 0)
if (etl::is_trivially_destructible<T>::value)
{
destroy_element_back();
current_size = 0;
construct_count.clear();
}
else
{
while (current_size > 0)
{
destroy_element_back();
}
}
_begin = iterator(0, *this, p_buffer);

View File

@ -1442,13 +1442,21 @@ namespace etl
{
if (!empty())
{
node_t* p_first = terminal_node.next;
node_t* p_last = &terminal_node;
while (p_first != p_last)
if (etl::is_trivially_destructible<T>::value)
{
destroy_data_node(static_cast<data_node_t&>(*p_first)); // Destroy the current node.
p_first = p_first->next; // Move to the next node.
p_node_pool->release_all();
construct_count.clear();
}
else
{
node_t* p_first = terminal_node.next;
node_t* p_last = &terminal_node;
while (p_first != p_last)
{
destroy_data_node(static_cast<data_node_t&>(*p_first)); // Destroy the current node.
p_first = p_first->next; // Move to the next node.
}
}
}

View File

@ -269,14 +269,14 @@ namespace etl
/// is_pod
/// For C++03, only fundamental and pointers types are recognised.
///\ingroup type_traits
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO))// && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO)) && !defined(ETL_IN_UNIT_TEST)
// For compilers that support C++11
template <typename T> struct is_pod : std::is_pod<T> {};
#else
template <typename T> struct is_pod : etl::integral_constant<bool, etl::is_fundamental<T>::value || etl::is_pointer<T>::value> {};
#endif
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) // && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_IN_UNIT_TEST)
/// is_trivially_constructible
///\ingroup type_traits
template <typename T> struct is_trivially_constructible : std::is_trivially_constructible<T> {};

View File

@ -281,14 +281,14 @@ namespace etl
/// is_pod
/// For C++03, only fundamental and pointers types are recognised.
///\ingroup type_traits
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO))// && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO)) && !defined(ETL_IN_UNIT_TEST)
// For compilers that support C++11
template <typename T> struct is_pod : std::is_pod<T> {};
#else
template <typename T> struct is_pod : etl::integral_constant<bool, etl::is_fundamental<T>::value || etl::is_pointer<T>::value> {};
#endif
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) // && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_IN_UNIT_TEST)
/// is_trivially_constructible
///\ingroup type_traits
template <typename T> struct is_trivially_constructible : std::is_trivially_constructible<T> {};