mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Mostly updated comments
Some extra tests
This commit is contained in:
parent
843ba72d9d
commit
9c2619ddfd
2
array.h
2
array.h
@ -83,7 +83,7 @@ namespace etl
|
||||
{
|
||||
private:
|
||||
|
||||
typedef typename parameter_type<T, is_fundamental<T>::value || is_pointer<T>::value>::type parameter_t;
|
||||
typedef typename parameter_type<T>::type parameter_t;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
64
bitset.h
64
bitset.h
@ -213,11 +213,22 @@ namespace etl
|
||||
/// Set the bit at the position.
|
||||
//*************************************************************************
|
||||
bitset<N>& set(size_t position, bool value = true)
|
||||
{
|
||||
{
|
||||
if (position < N)
|
||||
{
|
||||
size_t index = position / BITS_PER_ELEMENT;
|
||||
element_type bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
size_t index;
|
||||
element_type bit;
|
||||
|
||||
if (ARRAY_SIZE == 1)
|
||||
{
|
||||
index = 0;
|
||||
bit = element_type(1) << position;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = position / BITS_PER_ELEMENT;
|
||||
bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
}
|
||||
|
||||
if (value)
|
||||
{
|
||||
@ -248,8 +259,19 @@ namespace etl
|
||||
{
|
||||
if (position < N)
|
||||
{
|
||||
size_t index = position / BITS_PER_ELEMENT;
|
||||
element_type bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
size_t index;
|
||||
element_type bit;
|
||||
|
||||
if (ARRAY_SIZE == 1)
|
||||
{
|
||||
index = 0;
|
||||
bit = element_type(1) << position;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = position / BITS_PER_ELEMENT;
|
||||
bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
}
|
||||
|
||||
data[index] &= ~bit;
|
||||
}
|
||||
@ -279,8 +301,20 @@ namespace etl
|
||||
{
|
||||
if (position < N)
|
||||
{
|
||||
size_t index = position / BITS_PER_ELEMENT;
|
||||
element_type bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
size_t index;
|
||||
element_type bit;
|
||||
|
||||
if (ARRAY_SIZE == 1)
|
||||
{
|
||||
index = 0;
|
||||
bit = element_type(1) << position;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = position / BITS_PER_ELEMENT;
|
||||
bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
}
|
||||
|
||||
data[index] ^= bit;
|
||||
}
|
||||
|
||||
@ -311,19 +345,21 @@ namespace etl
|
||||
{
|
||||
if (position < N)
|
||||
{
|
||||
size_t index;
|
||||
element_type bit;
|
||||
|
||||
if (ARRAY_SIZE == 1)
|
||||
{
|
||||
element_type bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
|
||||
return (data[0] & bit) != 0;
|
||||
index = 0;
|
||||
bit = element_type(1) << position;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t index = position / BITS_PER_ELEMENT;
|
||||
element_type bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
|
||||
return (data[index] & bit) != 0;
|
||||
index = position / BITS_PER_ELEMENT;
|
||||
bit = element_type(1) << position % BITS_PER_ELEMENT;
|
||||
}
|
||||
|
||||
return (data[index] & bit) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -42,47 +42,15 @@ SOFTWARE.
|
||||
|
||||
namespace etl
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
//***************************************************************************
|
||||
///\ingroup cyclic_value
|
||||
/// The base class for cyclic_value exceptions.
|
||||
//***************************************************************************
|
||||
class cyclic_value_exception : public exception
|
||||
{
|
||||
public:
|
||||
|
||||
cyclic_value_exception(const char* what)
|
||||
: exception(what)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
///\ingroup cyclic_value
|
||||
/// The illegal range exception.
|
||||
//***************************************************************************
|
||||
class cyclic_value_illegal_range : public cyclic_value_exception
|
||||
{
|
||||
public:
|
||||
|
||||
cyclic_value_illegal_range()
|
||||
: cyclic_value_exception("cyclic_value illegal range")
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Provides a value that cycles between two limits.
|
||||
/// Supports incrementing and decrementing.
|
||||
///\tparam T The type of the variable.
|
||||
///\tparam FIRST The first value of the range.
|
||||
///\tparam LAST The last value of the range.
|
||||
///\tparam STEP The amount to increment or decrement. Default = 1.
|
||||
///\note LAST - FIRST + 1 must be a multiple of STEP.
|
||||
///\ingroup cyclic_value
|
||||
//***************************************************************************
|
||||
template <typename T, const T FIRST = 0, const T LAST = 0, const T STEP = 1>
|
||||
template <typename T, const T FIRST = T(), const T LAST = T()>
|
||||
class cyclic_value
|
||||
{
|
||||
public:
|
||||
@ -95,10 +63,8 @@ namespace etl
|
||||
cyclic_value()
|
||||
: value(FIRST),
|
||||
first_value(FIRST),
|
||||
last_value(LAST),
|
||||
step_value(STEP)
|
||||
last_value(LAST)
|
||||
{
|
||||
STATIC_ASSERT(((LAST - FIRST + 1) % STEP) == 0, "LAST - FIRST + 1 is not a multiple of STEP");
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -110,45 +76,21 @@ namespace etl
|
||||
cyclic_value(const T& first_, const T& last_)
|
||||
: value(first_),
|
||||
first_value(first_),
|
||||
last_value(last_),
|
||||
step_value(STEP)
|
||||
last_value(last_)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Constructor.
|
||||
/// Sets the value to the first of the range.
|
||||
///\param first The first value in the range.
|
||||
///\param last The last value in the range.
|
||||
//*************************************************************************
|
||||
cyclic_value(const T& first_, const T& last_, const T& step_)
|
||||
: value(first_),
|
||||
first_value(first_),
|
||||
last_value(last_),
|
||||
step_value(step_)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Sets the range.
|
||||
/// Sets the value to the first of the range.
|
||||
///\param first The first value in the range.
|
||||
///\param last The last value in the range.
|
||||
///\param step The step value. Default = 1.
|
||||
//*************************************************************************
|
||||
void set(const T& first_, const T& last_, const T& step_ = 1)
|
||||
//*************************************************************************
|
||||
void set(const T& first_, const T& last_)
|
||||
{
|
||||
first_value = first_;
|
||||
last_value = last_;
|
||||
step_value = step_;
|
||||
value = first_;
|
||||
|
||||
#if ETL_USE_EXCEPTIONS
|
||||
if (((last_value - first_value + 1) % step_value) != 0)
|
||||
{
|
||||
throw cyclic_value_illegal_range();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -218,7 +160,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
value += step_value;
|
||||
++value;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -247,7 +189,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
value -= step_value;
|
||||
--value;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -281,28 +223,11 @@ namespace etl
|
||||
return last_value;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the last value.
|
||||
//*************************************************************************
|
||||
const T& step() const
|
||||
{
|
||||
return step_value;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the number of steps in a cycle.
|
||||
//*************************************************************************
|
||||
size_t number_of_steps() const
|
||||
{
|
||||
return (last_value - first_value + 1) / step_value;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T value; ///< The current value.
|
||||
T first_value; ///< The first value in the range.
|
||||
T last_value; ///< The last value in the range.
|
||||
T step_value; ///< The value to step.
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
2
ideque.h
2
ideque.h
@ -59,7 +59,7 @@ namespace etl
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename parameter_type<T, is_fundamental<T>::value || is_pointer<T>::value>::type parameter_t;
|
||||
typedef typename parameter_type<T>::type parameter_t;
|
||||
|
||||
//*************************************************************************
|
||||
/// Test for an iterator.
|
||||
|
||||
102
iqueue.h
102
iqueue.h
@ -54,68 +54,19 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
typedef queue_base::size_type size_type; ///< The type used for determining the size of the queue.
|
||||
typedef T value_type; ///< The type stored in the queue.
|
||||
typedef T& reference; ///< A reference to the type used in the queue.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the queue.
|
||||
typedef T* pointer; ///< A pointer to the type used in the queue.
|
||||
typedef const T* const_pointer; ///< A const pointer to the type used in the qu
|
||||
typedef queue_base::size_type size_type; ///< The type used for determining the size of the queue.
|
||||
|
||||
private:
|
||||
|
||||
typedef typename parameter_type<T, is_fundamental<T>::value || is_pointer<T>::value>::type parameter_t;
|
||||
typedef typename parameter_type<T>::type parameter_t;
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Adds an item to the queue.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::queue_full is the queue is already full,
|
||||
/// otherwise does nothing if full.
|
||||
///\param item The item to push to the queue.
|
||||
//*************************************************************************
|
||||
void push(parameter_t item)
|
||||
{
|
||||
if (!full())
|
||||
{
|
||||
buffer[in] = item;
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
else
|
||||
{
|
||||
throw queue_full();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allows a possibly more efficient 'push' by moving to the next input item
|
||||
/// and returning a reference to it.
|
||||
/// This may eliminate a copy by allowing direct construction in-place.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::queue_full is the queue is already full,
|
||||
/// otherwise does nothing if full.
|
||||
/// \return A reference to the position to 'push' to.
|
||||
//*************************************************************************
|
||||
reference push()
|
||||
{
|
||||
const size_type next = in;
|
||||
|
||||
if (!full())
|
||||
{
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
else
|
||||
{
|
||||
throw queue_full();
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer[next];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets a reference to the item at the front of the queue.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::queue_empty if the queue is empty.<br>
|
||||
@ -188,6 +139,55 @@ namespace etl
|
||||
return buffer[in == 0 ? MAX_SIZE - 1 : in - 1];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Adds an item to the queue.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::queue_full is the queue is already full,
|
||||
/// otherwise does nothing if full.
|
||||
///\param item The item to push to the queue.
|
||||
//*************************************************************************
|
||||
void push(parameter_t item)
|
||||
{
|
||||
if (!full())
|
||||
{
|
||||
buffer[in] = item;
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
else
|
||||
{
|
||||
throw queue_full();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allows a possibly more efficient 'push' by moving to the next input item
|
||||
/// and returning a reference to it.
|
||||
/// This may eliminate a copy by allowing direct construction in-place.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::queue_full is the queue is already full,
|
||||
/// otherwise does nothing if full.
|
||||
/// \return A reference to the position to 'push' to.
|
||||
//*************************************************************************
|
||||
reference push()
|
||||
{
|
||||
const size_type next = in;
|
||||
|
||||
if (!full())
|
||||
{
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
else
|
||||
{
|
||||
throw queue_full();
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer[next];
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
40
istack.h
40
istack.h
@ -54,19 +54,37 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
typedef stack_base::size_type size_type; ///< The type used for determining the size of the stack.
|
||||
typedef T value_type; ///< The type stored in the stack.
|
||||
typedef T& reference; ///< A reference to the type used in the stack.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the stack.
|
||||
typedef T* pointer; ///< A pointer to the type used in the stack.
|
||||
typedef const T* const_pointer; ///< A const pointer to the type used in the stack.
|
||||
typedef stack_base::size_type size_type; ///< The type used for determining the size of the stack.
|
||||
|
||||
private:
|
||||
|
||||
typedef typename parameter_type<T, is_fundamental<T>::value || is_pointer<T>::value>::type parameter_t;
|
||||
typedef typename parameter_type<T>::type parameter_t;
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets a reference to the item at the top of the stack.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::stack_empty if the stack is empty.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is not defined and the stack is empty, the return value is undefined.
|
||||
/// \return A reference to the item at the top of the stack.
|
||||
//*************************************************************************
|
||||
reference top()
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
if (empty())
|
||||
{
|
||||
throw stack_empty();
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer[top_index];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Adds an item to the stack.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::stack_full is the stack is already full,
|
||||
@ -112,24 +130,6 @@ namespace etl
|
||||
return buffer[top_index];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets a reference to the item at the top of the stack.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::stack_empty if the stack is empty.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is not defined and the stack is empty, the return value is undefined.
|
||||
/// \return A reference to the item at the top of the stack.
|
||||
//*************************************************************************
|
||||
reference top()
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
if (empty())
|
||||
{
|
||||
throw stack_empty();
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer[top_index];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets a const reference to the item at the top of the stack.<br>
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws an etl::stack_empty if the stack is empty.<br>
|
||||
|
||||
435
ivector.h
435
ivector.h
@ -51,24 +51,43 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef T value_type;
|
||||
typedef typename std::iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename parameter_type<T, is_fundamental<T>::value || is_pointer<T>::value>::type parameter_t;
|
||||
typedef typename parameter_type<T>::type parameter_t;
|
||||
|
||||
public:
|
||||
|
||||
// Use the base class void push_back().
|
||||
using vector_base::push_back;
|
||||
|
||||
//*********************************************************************
|
||||
/// Assignment operator.
|
||||
/// The source vector can be larger than the destination, but
|
||||
/// only the elements that will fit in the destination will be copied.
|
||||
///\param other The other vector.
|
||||
//*********************************************************************
|
||||
ivector& operator = (ivector& other)
|
||||
{
|
||||
const size_t length = std::min(MAX_SIZE, other.size());
|
||||
|
||||
std::copy(other.begin(), other.begin() + length, p_buffer);
|
||||
current_size = length;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the vector.
|
||||
///\return An iterator to the beginning of the vector.
|
||||
@ -87,6 +106,24 @@ namespace etl
|
||||
return &p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the end of the vector.
|
||||
///\return An iterator to the end of the vector.
|
||||
//*********************************************************************
|
||||
iterator end()
|
||||
{
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const_iterator to the end of the vector.
|
||||
///\return A const iterator to the end of the vector.
|
||||
//*********************************************************************
|
||||
const_iterator end() const
|
||||
{
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const_iterator to the beginning of the vector.
|
||||
///\return A const iterator to the beginning of the vector.
|
||||
@ -96,6 +133,15 @@ namespace etl
|
||||
return &p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const_iterator to the end of the vector.
|
||||
///\return A const iterator to the end of the vector.
|
||||
//*********************************************************************
|
||||
const_iterator cend() const
|
||||
{
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an reverse iterator to the reverse beginning of the vector.
|
||||
///\return Iterator to the reverse beginning of the vector.
|
||||
@ -114,6 +160,24 @@ namespace etl
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reverse iterator to the end + 1 of the vector.
|
||||
///\return Reverse iterator to the end + 1 of the vector.
|
||||
//*********************************************************************
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reverse iterator to the end + 1 of the vector.
|
||||
///\return Const reverse iterator to the end + 1 of the vector.
|
||||
//*********************************************************************
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reverse iterator to the reverse beginning of the vector.
|
||||
///\return Const reverse iterator to the reverse beginning of the vector.
|
||||
@ -123,51 +187,6 @@ namespace etl
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the end of the vector.
|
||||
///\return An iterator to the end of the vector.
|
||||
//*********************************************************************
|
||||
iterator end()
|
||||
{
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const_iterator to the end of the vector.
|
||||
///\return A const iterator to the end of the vector.
|
||||
//*********************************************************************
|
||||
const_iterator end() const
|
||||
{
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const_iterator to the end of the vector.
|
||||
///\return A const iterator to the end of the vector.
|
||||
//*********************************************************************
|
||||
const_iterator cend() const
|
||||
{
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reverse iterator to the end + 1 of the vector.
|
||||
///\return Reverse iterator to the end + 1 of the vector.
|
||||
//*********************************************************************
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reverse iterator to the end + 1 of the vector.
|
||||
///\return Const reverse iterator to the end + 1 of the vector.
|
||||
//*********************************************************************
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reverse iterator to the end + 1 of the vector.
|
||||
///\return Const reverse iterator to the end + 1 of the vector.
|
||||
@ -177,24 +196,6 @@ namespace etl
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a pointer to the beginning of the vector data.
|
||||
///\return A pointer to the beginning of the vector data.
|
||||
//*********************************************************************
|
||||
pointer data()
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const pointer to the beginning of the vector data.
|
||||
///\return A const pointer to the beginning of the vector data.
|
||||
//*********************************************************************
|
||||
const_pointer data() const
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Resizes the vector.
|
||||
/// If ETL_USE_EXCEPTIONS is defined and the new size is larger than the
|
||||
@ -220,12 +221,113 @@ namespace etl
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Clears the vector.
|
||||
/// Does not call the destructor for any elements.
|
||||
/// Returns a reference to the value at index 'i'
|
||||
///\param i The index.
|
||||
///\return A reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
void clear()
|
||||
reference operator [](size_t i)
|
||||
{
|
||||
current_size = 0;
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the value at index 'i'
|
||||
///\param i The index.
|
||||
///\return A const reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
const_reference operator [](size_t i) const
|
||||
{
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the value at index 'i'
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws a std::range_error if the index is out of range.
|
||||
///\param i The index.
|
||||
///\return A reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
reference at(size_t i)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
if (i >= current_size)
|
||||
{
|
||||
throw vector_out_of_bounds();
|
||||
}
|
||||
#endif
|
||||
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the value at index 'i'
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws a std::range_error if the index is out of range.
|
||||
///\param i The index.
|
||||
///\return A const reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
const_reference at(size_t i) const
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
if (i >= current_size)
|
||||
{
|
||||
throw vector_out_of_bounds();
|
||||
}
|
||||
#endif
|
||||
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the first element.
|
||||
///\return A reference to the first element.
|
||||
//*********************************************************************
|
||||
reference front()
|
||||
{
|
||||
return p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the first element.
|
||||
///\return A const reference to the first element.
|
||||
//*********************************************************************
|
||||
const_reference front() const
|
||||
{
|
||||
return p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the last element.
|
||||
///\return A reference to the last element.
|
||||
//*********************************************************************
|
||||
reference back()
|
||||
{
|
||||
return p_buffer[current_size - 1];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the last element.
|
||||
///\return A const reference to the last element.
|
||||
//*********************************************************************
|
||||
const_reference back() const
|
||||
{
|
||||
return p_buffer[current_size - 1];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a pointer to the beginning of the vector data.
|
||||
///\return A pointer to the beginning of the vector data.
|
||||
//*********************************************************************
|
||||
pointer data()
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const pointer to the beginning of the vector data.
|
||||
///\return A const pointer to the beginning of the vector data.
|
||||
//*********************************************************************
|
||||
const_pointer data() const
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -281,6 +383,25 @@ namespace etl
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Inserts a value at the end of the vector.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws vector_full if the vector is already full.
|
||||
///\param value The value to add.
|
||||
//*********************************************************************
|
||||
void push_back(parameter_t value)
|
||||
{
|
||||
if (current_size == MAX_SIZE)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
throw vector_full();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
p_buffer[current_size++] = value;
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Inserts a value to the vector.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws vector_full if the vector is already full.
|
||||
@ -362,55 +483,6 @@ namespace etl
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Inserts a value at the end of the vector.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws vector_full if the vector is already full.
|
||||
///\param value The value to add.
|
||||
//*********************************************************************
|
||||
void push_back(parameter_t value)
|
||||
{
|
||||
if (current_size == MAX_SIZE)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
throw vector_full();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
p_buffer[current_size++] = value;
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Increases the size of the vector by one, but does not initialise the new element.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws vector_full if the vector is already full.
|
||||
//*********************************************************************
|
||||
void push_back()
|
||||
{
|
||||
if (current_size == MAX_SIZE)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
throw vector_full();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
++current_size;
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Removes an element from the end of the vector.
|
||||
/// Does nothing if the vector is empty.
|
||||
//*********************************************************************
|
||||
void pop_back()
|
||||
{
|
||||
if (current_size > 0)
|
||||
{
|
||||
--current_size;
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Erases an element.
|
||||
///\param iElement Iterator to the element.
|
||||
@ -418,10 +490,10 @@ namespace etl
|
||||
//*********************************************************************
|
||||
iterator erase(iterator iElement)
|
||||
{
|
||||
std::copy(iElement + 1, end(), iElement);
|
||||
--current_size;
|
||||
std::copy(iElement + 1, end(), iElement);
|
||||
--current_size;
|
||||
|
||||
return iElement;
|
||||
return iElement;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -434,118 +506,19 @@ namespace etl
|
||||
//*********************************************************************
|
||||
iterator erase(iterator first, iterator last)
|
||||
{
|
||||
std::copy(last, end(), first);
|
||||
current_size -= std::distance(first, last);
|
||||
std::copy(last, end(), first);
|
||||
current_size -= std::distance(first, last);
|
||||
|
||||
return first;
|
||||
return first;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the first element.
|
||||
///\return A reference to the first element.
|
||||
/// Clears the vector.
|
||||
/// Does not call the destructor for any elements.
|
||||
//*********************************************************************
|
||||
reference front()
|
||||
void clear()
|
||||
{
|
||||
return p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the first element.
|
||||
///\return A const reference to the first element.
|
||||
//*********************************************************************
|
||||
const_reference front() const
|
||||
{
|
||||
return p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the last element.
|
||||
///\return A reference to the last element.
|
||||
//*********************************************************************
|
||||
reference back()
|
||||
{
|
||||
return p_buffer[current_size - 1];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the last element.
|
||||
///\return A const reference to the last element.
|
||||
//*********************************************************************
|
||||
const_reference back() const
|
||||
{
|
||||
return p_buffer[current_size - 1];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the value at index 'i'
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws a std::range_error if the index is out of range.
|
||||
///\param i The index.
|
||||
///\return A reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
reference at(size_t i)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
if (i >= current_size)
|
||||
{
|
||||
throw vector_out_of_bounds();
|
||||
}
|
||||
#endif
|
||||
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the value at index 'i'
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws a std::range_error if the index is out of range.
|
||||
///\param i The index.
|
||||
///\return A const reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
const_reference at(size_t i) const
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
if (i >= current_size)
|
||||
{
|
||||
throw vector_out_of_bounds();
|
||||
}
|
||||
#endif
|
||||
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a reference to the value at index 'i'
|
||||
///\param i The index.
|
||||
///\return A reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
reference operator [](size_t i)
|
||||
{
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const reference to the value at index 'i'
|
||||
///\param i The index.
|
||||
///\return A const reference to the value at index 'i'
|
||||
//*********************************************************************
|
||||
const_reference operator [](size_t i) const
|
||||
{
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Assignment operator.
|
||||
/// The source vector can be larger than the destination, but
|
||||
/// only the elements that will fit in the destination will be copied.
|
||||
///\param other The other vector.
|
||||
//*********************************************************************
|
||||
ivector& operator = (ivector& other)
|
||||
{
|
||||
const size_t length = std::min(MAX_SIZE, other.size());
|
||||
|
||||
std::copy(other.begin(), other.begin() + length, p_buffer);
|
||||
current_size = length;
|
||||
|
||||
return *this;
|
||||
current_size = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
20
queue_base.h
20
queue_base.h
@ -117,16 +117,6 @@ namespace etl
|
||||
return MAX_SIZE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Clears the queue to the empty state.
|
||||
//*************************************************************************
|
||||
void clear()
|
||||
{
|
||||
in = 0;
|
||||
out = 0;
|
||||
current_size = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Checks to see if the queue is empty.
|
||||
/// \return <b>true</b> if the queue is empty, otherwise <b>false</b>
|
||||
@ -145,6 +135,16 @@ namespace etl
|
||||
return current_size == MAX_SIZE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Clears the queue to the empty state.
|
||||
//*************************************************************************
|
||||
void clear()
|
||||
{
|
||||
in = 0;
|
||||
out = 0;
|
||||
current_size = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Removes the oldest item from the back of the queue.
|
||||
/// Does nothing if the queue is already empty.
|
||||
|
||||
36
stack_base.h
36
stack_base.h
@ -94,6 +94,24 @@ namespace etl
|
||||
|
||||
typedef size_t size_type; ///< The type used for determining the size of stack.
|
||||
|
||||
//*************************************************************************
|
||||
/// Checks to see if the stack is empty.
|
||||
/// \return <b>true</b> if the stack is empty, otherwise <b>false</b>
|
||||
//*************************************************************************
|
||||
bool empty() const
|
||||
{
|
||||
return current_size == 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Checks to see if the stack is full.
|
||||
/// \return <b>true</b> if the stack is full, otherwise <b>false</b>
|
||||
//*************************************************************************
|
||||
bool full() const
|
||||
{
|
||||
return current_size == MAX_SIZE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Returns the current number of items top the stack.
|
||||
//*************************************************************************
|
||||
@ -127,24 +145,6 @@ namespace etl
|
||||
current_size = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Checks to see if the stack is empty.
|
||||
/// \return <b>true</b> if the stack is empty, otherwise <b>false</b>
|
||||
//*************************************************************************
|
||||
bool empty() const
|
||||
{
|
||||
return current_size == 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Checks to see if the stack is full.
|
||||
/// \return <b>true</b> if the stack is full, otherwise <b>false</b>
|
||||
//*************************************************************************
|
||||
bool full() const
|
||||
{
|
||||
return current_size == MAX_SIZE;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Removes the oldest item from the top of the stack.
|
||||
/// Does nothing if the stack is already empty.
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<TabInfoArray Name="TabInfoArray">
|
||||
<TabInfo>
|
||||
<wxString Value="U:\Users\John\Documents\Programming\GitHub\etl\array.h" Name="FileName"/>
|
||||
<int Value="61" Name="FirstVisibleLine"/>
|
||||
<int Value="54" Name="FirstVisibleLine"/>
|
||||
<int Value="55" Name="CurrentLine"/>
|
||||
<wxArrayString Name="Bookmarks"/>
|
||||
<IntVector Name="CollapsedFolds"/>
|
||||
@ -97,7 +97,7 @@
|
||||
<TabInfo>
|
||||
<wxString Value="U:\Users\John\Documents\Programming\GitHub\etl\test\test_variant.cpp" Name="FileName"/>
|
||||
<int Value="81" Name="FirstVisibleLine"/>
|
||||
<int Value="90" Name="CurrentLine"/>
|
||||
<int Value="96" Name="CurrentLine"/>
|
||||
<wxArrayString Name="Bookmarks"/>
|
||||
<IntVector Name="CollapsedFolds"/>
|
||||
</TabInfo>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ CurrentFileName :=
|
||||
CurrentFilePath :=
|
||||
CurrentFileFullPath :=
|
||||
User :=John
|
||||
Date :=11/19/14
|
||||
Date :=11/21/14
|
||||
CodeLitePath :="C:\Program Files (x86)\CodeLite"
|
||||
LinkerName :=C:/MinGW/bin/g++.exe
|
||||
SharedObjectLinkerName :=C:/MinGW/bin/g++.exe -shared -fPIC
|
||||
@ -65,9 +65,9 @@ CodeLiteDir:=C:\Program Files (x86)\CodeLite
|
||||
UNIT_TEST_PP_SRC_DIR:=C:\UnitTest++-1.3
|
||||
Objects0=$(IntermediateDirectory)/UnitTest++_AssertException.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_Checks.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_CompositeTestReporter.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_CurrentTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_DeferredTestReporter.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_DeferredTestResult.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_MemoryOutStream.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_ReportAssert.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_Test.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_TestDetails.cpp$(ObjectSuffix) \
|
||||
$(IntermediateDirectory)/UnitTest++_TestList.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_TestReporter.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_TestReporterStdout.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_TestResults.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_TestRunner.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_TimeConstraint.cpp$(ObjectSuffix) $(IntermediateDirectory)/UnitTest++_XmlTestReporter.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_main.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_array.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_container.cpp$(ObjectSuffix) \
|
||||
$(IntermediateDirectory)/test_test_crc.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_cyclic_value.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_deque.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_enum_type.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_exception.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_function.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_largest.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_list.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_math.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_numeric.cpp$(ObjectSuffix) \
|
||||
$(IntermediateDirectory)/test_test_observer.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_queue.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_stack.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_type_traits.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_vector.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_visitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_bitset.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_forward_list.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_integral_limits.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_variant.cpp$(ObjectSuffix) \
|
||||
$(IntermediateDirectory)/test_test_smallest.cpp$(ObjectSuffix)
|
||||
$(IntermediateDirectory)/test_test_crc.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_cyclic_value.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_deque.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_enum_type.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_exception.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_function.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_largest.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_list.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_numeric.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_observer.cpp$(ObjectSuffix) \
|
||||
$(IntermediateDirectory)/test_test_queue.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_stack.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_type_traits.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_vector.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_visitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_bitset.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_forward_list.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_integral_limits.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_variant.cpp$(ObjectSuffix) $(IntermediateDirectory)/test_test_smallest.cpp$(ObjectSuffix) \
|
||||
$(IntermediateDirectory)/test_test_maths.cpp$(ObjectSuffix)
|
||||
|
||||
Objects1=$(IntermediateDirectory)/etl_crc8_ccitt.cpp$(ObjectSuffix) $(IntermediateDirectory)/etl_crc16.cpp$(ObjectSuffix) $(IntermediateDirectory)/etl_crc16_ccitt.cpp$(ObjectSuffix) $(IntermediateDirectory)/etl_crc32.cpp$(ObjectSuffix) $(IntermediateDirectory)/etl_crc64_ecma.cpp$(ObjectSuffix) $(IntermediateDirectory)/etl_crc16_kermit.cpp$(ObjectSuffix) $(IntermediateDirectory)/Win32_TimeHelpers.cpp$(ObjectSuffix)
|
||||
|
||||
@ -326,14 +326,6 @@ $(IntermediateDirectory)/test_test_list.cpp$(DependSuffix): ../test_list.cpp
|
||||
$(IntermediateDirectory)/test_test_list.cpp$(PreprocessSuffix): ../test_list.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/test_test_list.cpp$(PreprocessSuffix) "../test_list.cpp"
|
||||
|
||||
$(IntermediateDirectory)/test_test_math.cpp$(ObjectSuffix): ../test_math.cpp $(IntermediateDirectory)/test_test_math.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "U:/Users/John/Documents/Programming/GitHub/etl/test/test_math.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/test_test_math.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/test_test_math.cpp$(DependSuffix): ../test_math.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/test_test_math.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/test_test_math.cpp$(DependSuffix) -MM "../test_math.cpp"
|
||||
|
||||
$(IntermediateDirectory)/test_test_math.cpp$(PreprocessSuffix): ../test_math.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/test_test_math.cpp$(PreprocessSuffix) "../test_math.cpp"
|
||||
|
||||
$(IntermediateDirectory)/test_test_numeric.cpp$(ObjectSuffix): ../test_numeric.cpp $(IntermediateDirectory)/test_test_numeric.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "U:/Users/John/Documents/Programming/GitHub/etl/test/test_numeric.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/test_test_numeric.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/test_test_numeric.cpp$(DependSuffix): ../test_numeric.cpp
|
||||
@ -430,6 +422,14 @@ $(IntermediateDirectory)/test_test_smallest.cpp$(DependSuffix): ../test_smallest
|
||||
$(IntermediateDirectory)/test_test_smallest.cpp$(PreprocessSuffix): ../test_smallest.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/test_test_smallest.cpp$(PreprocessSuffix) "../test_smallest.cpp"
|
||||
|
||||
$(IntermediateDirectory)/test_test_maths.cpp$(ObjectSuffix): ../test_maths.cpp $(IntermediateDirectory)/test_test_maths.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "U:/Users/John/Documents/Programming/GitHub/etl/test/test_maths.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/test_test_maths.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/test_test_maths.cpp$(DependSuffix): ../test_maths.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/test_test_maths.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/test_test_maths.cpp$(DependSuffix) -MM "../test_maths.cpp"
|
||||
|
||||
$(IntermediateDirectory)/test_test_maths.cpp$(PreprocessSuffix): ../test_maths.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/test_test_maths.cpp$(PreprocessSuffix) "../test_maths.cpp"
|
||||
|
||||
$(IntermediateDirectory)/etl_crc8_ccitt.cpp$(ObjectSuffix): ../../crc8_ccitt.cpp $(IntermediateDirectory)/etl_crc8_ccitt.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "U:/Users/John/Documents/Programming/GitHub/etl/crc8_ccitt.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/etl_crc8_ccitt.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/etl_crc8_ccitt.cpp$(DependSuffix): ../../crc8_ccitt.cpp
|
||||
|
||||
@ -85,7 +85,6 @@
|
||||
<File Name="../test_function.cpp"/>
|
||||
<File Name="../test_largest.cpp"/>
|
||||
<File Name="../test_list.cpp"/>
|
||||
<File Name="../test_math.cpp"/>
|
||||
<File Name="../test_numeric.cpp"/>
|
||||
<File Name="../test_observer.cpp"/>
|
||||
<File Name="../test_queue.cpp"/>
|
||||
@ -98,6 +97,7 @@
|
||||
<File Name="../test_integral_limits.cpp"/>
|
||||
<File Name="../test_variant.cpp"/>
|
||||
<File Name="../test_smallest.cpp"/>
|
||||
<File Name="../test_maths.cpp"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ETL">
|
||||
<File Name="../../array.h"/>
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
./Debug/UnitTest++_AssertException.cpp.o ./Debug/UnitTest++_Checks.cpp.o ./Debug/UnitTest++_CompositeTestReporter.cpp.o ./Debug/UnitTest++_CurrentTest.cpp.o ./Debug/UnitTest++_DeferredTestReporter.cpp.o ./Debug/UnitTest++_DeferredTestResult.cpp.o ./Debug/UnitTest++_MemoryOutStream.cpp.o ./Debug/UnitTest++_ReportAssert.cpp.o ./Debug/UnitTest++_Test.cpp.o ./Debug/UnitTest++_TestDetails.cpp.o ./Debug/UnitTest++_TestList.cpp.o ./Debug/UnitTest++_TestReporter.cpp.o ./Debug/UnitTest++_TestReporterStdout.cpp.o ./Debug/UnitTest++_TestResults.cpp.o ./Debug/UnitTest++_TestRunner.cpp.o ./Debug/UnitTest++_TimeConstraint.cpp.o ./Debug/UnitTest++_XmlTestReporter.cpp.o ./Debug/test_main.cpp.o ./Debug/test_test_array.cpp.o ./Debug/test_test_container.cpp.o ./Debug/test_test_crc.cpp.o ./Debug/test_test_cyclic_value.cpp.o ./Debug/test_test_deque.cpp.o ./Debug/test_test_enum_type.cpp.o ./Debug/test_test_exception.cpp.o ./Debug/test_test_function.cpp.o ./Debug/test_test_largest.cpp.o ./Debug/test_test_list.cpp.o ./Debug/test_test_math.cpp.o ./Debug/test_test_numeric.cpp.o ./Debug/test_test_observer.cpp.o ./Debug/test_test_queue.cpp.o ./Debug/test_test_stack.cpp.o ./Debug/test_test_type_traits.cpp.o ./Debug/test_test_vector.cpp.o ./Debug/test_test_visitor.cpp.o ./Debug/test_test_bitset.cpp.o ./Debug/test_test_forward_list.cpp.o ./Debug/test_test_integral_limits.cpp.o ./Debug/test_test_variant.cpp.o ./Debug/test_test_smallest.cpp.o
|
||||
./Debug/UnitTest++_AssertException.cpp.o ./Debug/UnitTest++_Checks.cpp.o ./Debug/UnitTest++_CompositeTestReporter.cpp.o ./Debug/UnitTest++_CurrentTest.cpp.o ./Debug/UnitTest++_DeferredTestReporter.cpp.o ./Debug/UnitTest++_DeferredTestResult.cpp.o ./Debug/UnitTest++_MemoryOutStream.cpp.o ./Debug/UnitTest++_ReportAssert.cpp.o ./Debug/UnitTest++_Test.cpp.o ./Debug/UnitTest++_TestDetails.cpp.o ./Debug/UnitTest++_TestList.cpp.o ./Debug/UnitTest++_TestReporter.cpp.o ./Debug/UnitTest++_TestReporterStdout.cpp.o ./Debug/UnitTest++_TestResults.cpp.o ./Debug/UnitTest++_TestRunner.cpp.o ./Debug/UnitTest++_TimeConstraint.cpp.o ./Debug/UnitTest++_XmlTestReporter.cpp.o ./Debug/test_main.cpp.o ./Debug/test_test_array.cpp.o ./Debug/test_test_container.cpp.o ./Debug/test_test_crc.cpp.o ./Debug/test_test_cyclic_value.cpp.o ./Debug/test_test_deque.cpp.o ./Debug/test_test_enum_type.cpp.o ./Debug/test_test_exception.cpp.o ./Debug/test_test_function.cpp.o ./Debug/test_test_largest.cpp.o ./Debug/test_test_list.cpp.o ./Debug/test_test_numeric.cpp.o ./Debug/test_test_observer.cpp.o ./Debug/test_test_queue.cpp.o ./Debug/test_test_stack.cpp.o ./Debug/test_test_type_traits.cpp.o ./Debug/test_test_vector.cpp.o ./Debug/test_test_visitor.cpp.o ./Debug/test_test_bitset.cpp.o ./Debug/test_test_forward_list.cpp.o ./Debug/test_test_integral_limits.cpp.o ./Debug/test_test_variant.cpp.o ./Debug/test_test_smallest.cpp.o ./Debug/test_test_maths.cpp.o
|
||||
./Debug/etl_crc8_ccitt.cpp.o ./Debug/etl_crc16.cpp.o ./Debug/etl_crc16_ccitt.cpp.o ./Debug/etl_crc32.cpp.o ./Debug/etl_crc64_ecma.cpp.o ./Debug/etl_crc16_kermit.cpp.o ./Debug/Win32_TimeHelpers.cpp.o
|
||||
|
||||
@ -39,7 +39,7 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestBitset)
|
||||
SUITE(test_bitset)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_constructor)
|
||||
|
||||
@ -32,7 +32,7 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(ContainerTest)
|
||||
SUITE(test_container)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_stl_style_container)
|
||||
|
||||
@ -41,7 +41,7 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestCRC)
|
||||
SUITE(test_crc)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_crc8_ccitt_constructor)
|
||||
|
||||
@ -32,10 +32,10 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestCyclicValue)
|
||||
SUITE(test_cyclic_value)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(CompileTimeInitialisation)
|
||||
TEST(test_compile_time_initialisation)
|
||||
{
|
||||
etl::cyclic_value<int, 2, 7> value;
|
||||
|
||||
@ -45,9 +45,9 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(RunTimeInitialisation)
|
||||
TEST(test_run_time_initialisation)
|
||||
{
|
||||
etl::cyclic_value<int> value(2, 7, 1);
|
||||
etl::cyclic_value<int> value(2, 7);
|
||||
|
||||
CHECK_EQUAL(2, value);
|
||||
CHECK_EQUAL(2, value.first());
|
||||
@ -55,7 +55,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(set)
|
||||
TEST(test_set)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -67,7 +67,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(ToFirst)
|
||||
TEST(test_to_first)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -79,7 +79,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(ToLast)
|
||||
TEST(test_to_last)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -90,7 +90,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Increment)
|
||||
TEST(test_increment)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -104,7 +104,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Decrement)
|
||||
TEST(test_decrement)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -119,7 +119,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(IncrementWrap)
|
||||
TEST(test_increment_wrap)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -135,7 +135,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(DecrementWrap)
|
||||
TEST(test_decrement_wrap)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
@ -151,21 +151,9 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(NumberOfSteps)
|
||||
TEST(test_advance_positive)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
value.set(2, 7, 1);
|
||||
CHECK_EQUAL(7 - 2 + 1, value.number_of_steps());
|
||||
|
||||
value.set(2, 7, 2);
|
||||
CHECK_EQUAL((7 - 2 + 1) / 2, value.number_of_steps());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(AdvancePositive)
|
||||
{
|
||||
etl::cyclic_value<int, 2, 7, 1> value;
|
||||
etl::cyclic_value<int, 2, 7> value;
|
||||
|
||||
value.advance(2);
|
||||
|
||||
@ -173,22 +161,14 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(AdvanceNegative)
|
||||
TEST(test_advance_negative)
|
||||
{
|
||||
etl::cyclic_value<int, 2, 7, 1> value;
|
||||
etl::cyclic_value<int, 2, 7> value;
|
||||
|
||||
value.to_last();
|
||||
value.advance(-2);
|
||||
|
||||
CHECK_EQUAL(5, value);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(TestException)
|
||||
{
|
||||
etl::cyclic_value<int> value;
|
||||
|
||||
CHECK_THROW(value.set(2, 7, 4), etl::cyclic_value_illegal_range);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ struct enum_test
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestEnumType)
|
||||
SUITE(test_enum_type)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(Values)
|
||||
@ -60,7 +60,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Strings)
|
||||
TEST(test_c_str)
|
||||
{
|
||||
enum_test value;
|
||||
|
||||
@ -83,7 +83,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Assignment)
|
||||
TEST(test_assignment)
|
||||
{
|
||||
enum_test value1 = enum_test::ZERO;
|
||||
enum_test value2 = enum_test::ONE;
|
||||
@ -94,7 +94,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(GetValue)
|
||||
TEST(test_get_value)
|
||||
{
|
||||
enum_test actual = enum_test::THREE;
|
||||
enum_test::value_type expected = enum_test::THREE;
|
||||
@ -103,7 +103,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(GetEnum)
|
||||
TEST(test_get_enum)
|
||||
{
|
||||
enum_test actual = enum_test::THREE;
|
||||
enum_test::enum_type expected = enum_test::THREE;
|
||||
|
||||
@ -31,10 +31,10 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestException)
|
||||
SUITE(test_exception)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(Constructor)
|
||||
TEST(test_constructor)
|
||||
{
|
||||
etl::exception e("An exception");
|
||||
|
||||
@ -42,7 +42,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Exception)
|
||||
TEST(test_exception)
|
||||
{
|
||||
etl::exception e("An exception");
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestForwardList)
|
||||
SUITE(test_forward_list)
|
||||
{
|
||||
const size_t SIZE = 10;
|
||||
|
||||
@ -65,7 +65,7 @@ namespace
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, DefaultConstructor)
|
||||
TEST_FIXTURE(SetupFixture, test_default_constructor)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -74,7 +74,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorSize)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
Data data(INITIAL_SIZE);
|
||||
@ -83,13 +83,13 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorSizeExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size_excess)
|
||||
{
|
||||
CHECK_THROW(Data data(SIZE + 1), etl::forward_list_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorSizeValue)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const int INITIAL_VALUE = 1;
|
||||
@ -107,7 +107,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorRange)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_range)
|
||||
{
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
@ -115,7 +115,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, CopyConstructor)
|
||||
TEST_FIXTURE(SetupFixture, test_copy_constructor)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -125,7 +125,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Iterator)
|
||||
TEST_FIXTURE(SetupFixture, test_iterator)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(compare_data.begin(), compare_data.end());
|
||||
@ -136,7 +136,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstIterator)
|
||||
TEST_FIXTURE(SetupFixture, test_const_iterator)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(compare_data.begin(), compare_data.end());
|
||||
@ -147,7 +147,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeUpValue)
|
||||
TEST_FIXTURE(SetupFixture, test_resize_up_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const size_t NEW_SIZE = 8;
|
||||
@ -165,7 +165,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_resize_excess)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
Data data(INITIAL_SIZE);
|
||||
@ -174,7 +174,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Clear)
|
||||
TEST_FIXTURE(SetupFixture, test_clear)
|
||||
{
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
data.clear();
|
||||
@ -183,7 +183,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignRange)
|
||||
TEST_FIXTURE(SetupFixture, test_assign_range)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data;
|
||||
@ -198,7 +198,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignSizeValue)
|
||||
TEST_FIXTURE(SetupFixture, test_assign_size_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const int VALUE = 1;
|
||||
@ -216,7 +216,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignSizeValueExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_assign_size_value_excess)
|
||||
{
|
||||
const int VALUE = 1;
|
||||
|
||||
@ -226,7 +226,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, InsertAfterPositionValue)
|
||||
TEST_FIXTURE(SetupFixture, test_insert_after_position_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const int VALUE = 1;
|
||||
@ -267,7 +267,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, InsertAfterRange)
|
||||
TEST_FIXTURE(SetupFixture, test_insert_after_range)
|
||||
{
|
||||
std::vector<int> test1 = { 1, 2, 3, 4, 5 };
|
||||
std::vector<int> test2 = { 6, 7, 8, 9, 10 };
|
||||
@ -300,7 +300,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFront)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front)
|
||||
{
|
||||
CompareData compare_data;
|
||||
Data data;
|
||||
@ -325,7 +325,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFrontExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front_excess)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -344,7 +344,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFrontPopFront)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front_pop_front)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -358,7 +358,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, EraseAfterSingle)
|
||||
TEST_FIXTURE(SetupFixture, test_erase_after_single)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -404,7 +404,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, EraseAfterRange)
|
||||
TEST_FIXTURE(SetupFixture, test_erase_after_range)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -431,7 +431,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, EraseAfterAll)
|
||||
TEST_FIXTURE(SetupFixture, test_erase_after_all)
|
||||
{
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
@ -441,7 +441,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Front)
|
||||
TEST_FIXTURE(SetupFixture, test_front)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -450,7 +450,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Assignment)
|
||||
TEST_FIXTURE(SetupFixture, test_assignment)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -466,7 +466,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Unique)
|
||||
TEST_FIXTURE(SetupFixture, test_unique)
|
||||
{
|
||||
CompareData compare_data(non_unique_data.begin(), non_unique_data.end());
|
||||
Data data(non_unique_data.begin(), non_unique_data.end());
|
||||
@ -480,7 +480,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Remove)
|
||||
TEST_FIXTURE(SetupFixture, test_remove)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -494,7 +494,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, RemoveIf)
|
||||
TEST_FIXTURE(SetupFixture, test_remove_if)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -508,7 +508,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Reverse)
|
||||
TEST_FIXTURE(SetupFixture, test_reverse)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -522,7 +522,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Sort)
|
||||
TEST_FIXTURE(SetupFixture, test_sort)
|
||||
{
|
||||
CompareData compare_data(unsorted_data.begin(), unsorted_data.end());
|
||||
Data data(unsorted_data.begin(), unsorted_data.end());
|
||||
@ -536,7 +536,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Swap)
|
||||
TEST_FIXTURE(SetupFixture, test_swap)
|
||||
{
|
||||
Data first(unsorted_data.begin(), unsorted_data.end());
|
||||
Data second(small_data.begin(), small_data.end());
|
||||
|
||||
@ -30,8 +30,8 @@ SOFTWARE.
|
||||
|
||||
//*****************************************************************************
|
||||
const int VALUE = 1;
|
||||
bool functionCalled = false;
|
||||
bool parameterCorrect = false;
|
||||
bool function_called = false;
|
||||
bool parameter_correct = false;
|
||||
|
||||
//*****************************************************************************
|
||||
// Test data structure.
|
||||
@ -44,7 +44,7 @@ struct Data
|
||||
//*****************************************************************************
|
||||
// Call the function taking no parameters.
|
||||
//*****************************************************************************
|
||||
void Call(etl::ifunction<void>& function)
|
||||
void call(etl::ifunction<void>& function)
|
||||
{
|
||||
function();
|
||||
}
|
||||
@ -52,7 +52,7 @@ void Call(etl::ifunction<void>& function)
|
||||
//*****************************************************************************
|
||||
// Call the function taking an int parameter.
|
||||
//*****************************************************************************
|
||||
void Call(etl::ifunction<int>& function)
|
||||
void call(etl::ifunction<int>& function)
|
||||
{
|
||||
function(VALUE);
|
||||
}
|
||||
@ -60,7 +60,7 @@ void Call(etl::ifunction<int>& function)
|
||||
//*****************************************************************************
|
||||
// Call the function taking a Data parameter.
|
||||
//*****************************************************************************
|
||||
void Call(etl::ifunction<const Data&>& function)
|
||||
void call(etl::ifunction<const Data&>& function)
|
||||
{
|
||||
Data data;
|
||||
data.d = VALUE;
|
||||
@ -70,27 +70,27 @@ void Call(etl::ifunction<const Data&>& function)
|
||||
//*****************************************************************************
|
||||
// The free function taking no parameters.
|
||||
//*****************************************************************************
|
||||
void FreeVoid()
|
||||
void free_void()
|
||||
{
|
||||
functionCalled = true;
|
||||
function_called = true;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// The free function taking an int parameter.
|
||||
//*****************************************************************************
|
||||
void FreeInt(int i)
|
||||
void free_int(int i)
|
||||
{
|
||||
functionCalled = true;
|
||||
parameterCorrect = (i == VALUE);
|
||||
function_called = true;
|
||||
parameter_correct = (i == VALUE);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// The free function taking a Data reference parameter.
|
||||
//*****************************************************************************
|
||||
void FreeReference(const Data& data)
|
||||
void free_reference(const Data& data)
|
||||
{
|
||||
functionCalled = true;
|
||||
parameterCorrect = (data.d == VALUE);
|
||||
function_called = true;
|
||||
parameter_correct = (data.d == VALUE);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
@ -100,21 +100,21 @@ class Test
|
||||
{
|
||||
public:
|
||||
|
||||
void MemberVoid()
|
||||
void member_void()
|
||||
{
|
||||
functionCalled = true;
|
||||
function_called = true;
|
||||
}
|
||||
|
||||
void MemberInt(int i)
|
||||
void member_int(int i)
|
||||
{
|
||||
functionCalled = true;
|
||||
parameterCorrect = (i == VALUE);
|
||||
function_called = true;
|
||||
parameter_correct = (i == VALUE);
|
||||
}
|
||||
|
||||
void MemberReference(const Data& data)
|
||||
void member_reference(const Data& data)
|
||||
{
|
||||
functionCalled = true;
|
||||
parameterCorrect = (data.d == VALUE);
|
||||
function_called = true;
|
||||
parameter_correct = (data.d == VALUE);
|
||||
}
|
||||
};
|
||||
|
||||
@ -125,80 +125,80 @@ struct SetupFixture
|
||||
{
|
||||
SetupFixture()
|
||||
{
|
||||
functionCalled = false;
|
||||
parameterCorrect = false;
|
||||
function_called = false;
|
||||
parameter_correct = false;
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestFunction)
|
||||
SUITE(test_function)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, TestFreeVoid)
|
||||
TEST_FIXTURE(SetupFixture, test_free_void)
|
||||
{
|
||||
etl::function<void, void> function(FreeVoid);
|
||||
etl::function<void, void> function(free_void);
|
||||
|
||||
Call(function);
|
||||
call(function);
|
||||
|
||||
CHECK(functionCalled);
|
||||
CHECK(function_called);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, TestFreeInt)
|
||||
TEST_FIXTURE(SetupFixture, test_free_int)
|
||||
{
|
||||
etl::function<void, int> function(FreeInt);
|
||||
etl::function<void, int> function(free_int);
|
||||
|
||||
Call(function);
|
||||
call(function);
|
||||
|
||||
CHECK(functionCalled);
|
||||
CHECK(parameterCorrect);
|
||||
CHECK(function_called);
|
||||
CHECK(parameter_correct);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, TestFreeReference)
|
||||
TEST_FIXTURE(SetupFixture, test_free_reference)
|
||||
{
|
||||
etl::function<void, const Data&> function(FreeReference);
|
||||
etl::function<void, const Data&> function(free_reference);
|
||||
|
||||
Call(function);
|
||||
call(function);
|
||||
|
||||
CHECK(functionCalled);
|
||||
CHECK(parameterCorrect);
|
||||
CHECK(function_called);
|
||||
CHECK(parameter_correct);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, TestMemberVoid)
|
||||
TEST_FIXTURE(SetupFixture, test_member_void)
|
||||
{
|
||||
Test test;
|
||||
etl::function<Test, void> function(test, &Test::MemberVoid);
|
||||
etl::function<Test, void> function(test, &Test::member_void);
|
||||
|
||||
Call(function);
|
||||
call(function);
|
||||
|
||||
CHECK(functionCalled);
|
||||
CHECK(function_called);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, TestMemberInt)
|
||||
TEST_FIXTURE(SetupFixture, test_member_int)
|
||||
{
|
||||
Test test;
|
||||
etl::function<Test, int> function(test, &Test::MemberInt);
|
||||
etl::function<Test, int> function(test, &Test::member_int);
|
||||
|
||||
Call(function);
|
||||
call(function);
|
||||
|
||||
CHECK(functionCalled);
|
||||
CHECK(parameterCorrect);
|
||||
CHECK(function_called);
|
||||
CHECK(parameter_correct);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, TestMemberReference)
|
||||
TEST_FIXTURE(SetupFixture, test_member_reference)
|
||||
{
|
||||
Test test;
|
||||
etl::function<Test, const Data&> function(test, &Test::MemberReference);
|
||||
etl::function<Test, const Data&> function(test, &Test::member_reference);
|
||||
|
||||
Call(function);
|
||||
call(function);
|
||||
|
||||
CHECK(functionCalled);
|
||||
CHECK(parameterCorrect);
|
||||
CHECK(function_called);
|
||||
CHECK(parameter_correct);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -37,10 +37,10 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestIntegralLimits)
|
||||
SUITE(test_integral_limits)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(MinTest)
|
||||
TEST(test_min)
|
||||
{
|
||||
CHECK_EQUAL(std::numeric_limits<char>::min(), (char)etl::integral_limits<char>::min);
|
||||
CHECK_EQUAL(std::numeric_limits<signed char>::min(), (signed char)etl::integral_limits<signed char>::min);
|
||||
@ -56,7 +56,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(MaxTest)
|
||||
TEST(test_max)
|
||||
{
|
||||
CHECK_EQUAL(std::numeric_limits<char>::max(), (char)etl::integral_limits<char>::max);
|
||||
CHECK_EQUAL(std::numeric_limits<signed char>::max(), (signed char)etl::integral_limits<signed char>::max);
|
||||
@ -72,7 +72,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(BitsTest)
|
||||
TEST(test_bits)
|
||||
{
|
||||
CHECK_EQUAL(std::numeric_limits<std::make_unsigned<char>::type>::digits, (int)etl::integral_limits<char>::bits);
|
||||
CHECK_EQUAL(std::numeric_limits<std::make_unsigned<signed char>::type>::digits, (int)etl::integral_limits<signed char>::bits);
|
||||
@ -88,7 +88,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(IsSignedTest)
|
||||
TEST(test_is_signed)
|
||||
{
|
||||
CHECK_EQUAL(std::numeric_limits<char>::is_signed, (bool)etl::integral_limits<char>::is_signed);
|
||||
CHECK_EQUAL(std::numeric_limits<signed char>::is_signed, (bool)etl::integral_limits<signed char>::is_signed);
|
||||
|
||||
@ -32,7 +32,7 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestLargest)
|
||||
SUITE(test_largest)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_pod_type)
|
||||
|
||||
@ -36,7 +36,7 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestList)
|
||||
SUITE(test_list)
|
||||
{
|
||||
const size_t SIZE = 10;
|
||||
|
||||
@ -65,7 +65,7 @@ namespace
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, DefaultConstructor)
|
||||
TEST_FIXTURE(SetupFixture, test_default_constructor)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -75,7 +75,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorSize)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
Data data(INITIAL_SIZE);
|
||||
@ -85,13 +85,13 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorSizeExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size_excess)
|
||||
{
|
||||
CHECK_THROW(Data data(SIZE + 1), etl::list_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorSizeValue)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const int INITIAL_VALUE = 1;
|
||||
@ -110,7 +110,13 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstructorRange)
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_size_value_excess)
|
||||
{
|
||||
CHECK_THROW(Data data(SIZE + 1, 1), etl::list_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_constructor_range)
|
||||
{
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
@ -119,7 +125,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, CopyConstructor)
|
||||
TEST_FIXTURE(SetupFixture, test_copy_constructor)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -139,7 +145,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Iterator)
|
||||
TEST_FIXTURE(SetupFixture, test_iterator)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(compare_data.begin(), compare_data.end());
|
||||
@ -150,7 +156,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstIterator)
|
||||
TEST_FIXTURE(SetupFixture, test_const_iterator)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(compare_data.begin(), compare_data.end());
|
||||
@ -161,7 +167,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ReverseIterator)
|
||||
TEST_FIXTURE(SetupFixture, test_reverse_iterator)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(compare_data.begin(), compare_data.end());
|
||||
@ -172,7 +178,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ConstReverseIterator)
|
||||
TEST_FIXTURE(SetupFixture, test_const_reverse_iterator)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(compare_data.begin(), compare_data.end());
|
||||
@ -183,7 +189,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeUp)
|
||||
TEST_FIXTURE(SetupFixture, test_resize_up)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const size_t NEW_SIZE = 8;
|
||||
@ -195,7 +201,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeUpValue)
|
||||
TEST_FIXTURE(SetupFixture, test_resize_up_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const size_t NEW_SIZE = 8;
|
||||
@ -213,7 +219,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_resize_excess)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
Data data(INITIAL_SIZE);
|
||||
@ -222,7 +228,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeDown)
|
||||
TEST_FIXTURE(SetupFixture, test_resize_down)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const size_t NEW_SIZE = 2;
|
||||
@ -234,7 +240,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Clear)
|
||||
TEST_FIXTURE(SetupFixture, test_clear)
|
||||
{
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
data.clear();
|
||||
@ -243,7 +249,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignRange)
|
||||
TEST_FIXTURE(SetupFixture, test_assign_range)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data;
|
||||
@ -260,7 +266,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignSizeValue)
|
||||
TEST_FIXTURE(SetupFixture, test_assign_size_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const int VALUE = 1;
|
||||
@ -280,7 +286,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignSizeValueExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_assign_size_value_excess)
|
||||
{
|
||||
const int VALUE = 1;
|
||||
|
||||
@ -290,7 +296,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, InsertPositionValue)
|
||||
TEST_FIXTURE(SetupFixture, test_insert_position_value)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 4;
|
||||
const int VALUE = 1;
|
||||
@ -341,7 +347,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, InsertRange)
|
||||
TEST_FIXTURE(SetupFixture, test_insert_range)
|
||||
{
|
||||
std::vector<int> test1 = { 1, 2, 3, 4, 5 };
|
||||
std::vector<int> test2 = { 6, 7, 8, 9, 10 };
|
||||
@ -384,7 +390,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFront)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front)
|
||||
{
|
||||
CompareData compare_data;
|
||||
Data data;
|
||||
@ -409,7 +415,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFrontExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front_excess)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -428,7 +434,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFrontPopFront)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front_pop_front)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -442,7 +448,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushFrontPopBack)
|
||||
TEST_FIXTURE(SetupFixture, test_push_front_pop_back)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -456,7 +462,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushBackPopFront)
|
||||
TEST_FIXTURE(SetupFixture, test_push_back_pop_front)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -470,7 +476,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushBackPopBack)
|
||||
TEST_FIXTURE(SetupFixture, test_push_back_pop_back)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -484,7 +490,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushBack)
|
||||
TEST_FIXTURE(SetupFixture, test_push_back)
|
||||
{
|
||||
CompareData compare_data;
|
||||
Data data;
|
||||
@ -509,7 +515,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PushBackExcess)
|
||||
TEST_FIXTURE(SetupFixture, test_push_back_excess)
|
||||
{
|
||||
Data data;
|
||||
|
||||
@ -528,7 +534,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, PopBack)
|
||||
TEST_FIXTURE(SetupFixture, test_pop_back)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -545,7 +551,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, EraseSingle)
|
||||
TEST_FIXTURE(SetupFixture, test_erase_single)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -591,7 +597,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, EraseRange)
|
||||
TEST_FIXTURE(SetupFixture, test_erase_range)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -618,7 +624,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, EraseAll)
|
||||
TEST_FIXTURE(SetupFixture, test_erase_all)
|
||||
{
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
@ -633,7 +639,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Front)
|
||||
TEST_FIXTURE(SetupFixture, test_front)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -642,7 +648,16 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Back)
|
||||
TEST_FIXTURE(SetupFixture, test_front_const)
|
||||
{
|
||||
const CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
const Data data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
CHECK_EQUAL(compare_data.front(), data.front());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_back)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -651,7 +666,16 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Assignment)
|
||||
TEST_FIXTURE(SetupFixture, test_back_const)
|
||||
{
|
||||
const CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
const Data data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
CHECK_EQUAL(compare_data.back(), data.back());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_assignment)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -667,7 +691,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Unique)
|
||||
TEST_FIXTURE(SetupFixture, test_unique)
|
||||
{
|
||||
CompareData compare_data(non_unique_data.begin(), non_unique_data.end());
|
||||
Data data(non_unique_data.begin(), non_unique_data.end());
|
||||
@ -681,7 +705,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Remove)
|
||||
TEST_FIXTURE(SetupFixture, test_remove)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -695,7 +719,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, RemoveIf)
|
||||
TEST_FIXTURE(SetupFixture, test_remove_if)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -709,7 +733,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Reverse)
|
||||
TEST_FIXTURE(SetupFixture, test_reverse)
|
||||
{
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
Data data(sorted_data.begin(), sorted_data.end());
|
||||
@ -723,7 +747,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Sort)
|
||||
TEST_FIXTURE(SetupFixture, test_sort)
|
||||
{
|
||||
CompareData compare_data(unsorted_data.begin(), unsorted_data.end());
|
||||
Data data(unsorted_data.begin(), unsorted_data.end());
|
||||
@ -737,7 +761,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Swap)
|
||||
TEST_FIXTURE(SetupFixture, test_swap)
|
||||
{
|
||||
Data first(unsorted_data.begin(), unsorted_data.end());
|
||||
Data second(small_data.begin(), small_data.end());
|
||||
|
||||
@ -33,10 +33,10 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestNumeric)
|
||||
SUITE(test_numeric)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(IOTA)
|
||||
TEST(test_iota)
|
||||
{
|
||||
int data1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
@ -196,10 +196,10 @@ public:
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestObserver)
|
||||
SUITE(test_observer)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(Test2Observables2Observers3Notifications)
|
||||
TEST(test_2_observables_2_observers_3_notifications)
|
||||
{
|
||||
// The observable objects.
|
||||
Observable1 observable1;
|
||||
@ -282,7 +282,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test8Notifications)
|
||||
TEST(test_8_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>, Notification<3>, Notification<4>, Notification<5>, Notification<6>, Notification<7>, Notification<8>> Observer;
|
||||
|
||||
@ -295,7 +295,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test7Notifications)
|
||||
TEST(test_7_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>, Notification<3>, Notification<4>, Notification<5>, Notification<6>, Notification<7>> Observer;
|
||||
|
||||
@ -308,7 +308,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test6Notifications)
|
||||
TEST(test_6_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>, Notification<3>, Notification<4>, Notification<5>, Notification<6>> Observer;
|
||||
|
||||
@ -321,7 +321,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test5Notifications)
|
||||
TEST(test_5_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>, Notification<3>, Notification<4>, Notification<5>> Observer;
|
||||
|
||||
@ -334,7 +334,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test4Notifications)
|
||||
TEST(test_4_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>, Notification<3>, Notification<4>> Observer;
|
||||
|
||||
@ -347,7 +347,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test3Notifications)
|
||||
TEST(test_3_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>, Notification<3>> Observer;
|
||||
|
||||
@ -360,7 +360,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test2Notifications)
|
||||
TEST(test_2_notifications)
|
||||
{
|
||||
typedef etl::observer<Notification<1>, Notification<2>> Observer;
|
||||
|
||||
@ -373,7 +373,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test1Notification)
|
||||
TEST(test_1_notification)
|
||||
{
|
||||
typedef etl::observer<Notification<1>> Observer;
|
||||
|
||||
@ -386,7 +386,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(TestObserverList)
|
||||
TEST(test_observer_list)
|
||||
{
|
||||
class Observer : public etl::observer<Notification1>
|
||||
{
|
||||
|
||||
@ -32,10 +32,10 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestQueue)
|
||||
SUITE(test_queue)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(Size)
|
||||
TEST(test_size)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Capacity)
|
||||
TEST(test_capacity)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -55,7 +55,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Clear)
|
||||
TEST(test_clear)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -66,7 +66,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Empty)
|
||||
TEST(test_empty)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -78,7 +78,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Full)
|
||||
TEST(test_full)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -93,65 +93,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Push)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
queue.push(1);
|
||||
CHECK_EQUAL(1, queue.size());
|
||||
|
||||
queue.push(2);
|
||||
CHECK_EQUAL(2, queue.size());
|
||||
|
||||
CHECK_EQUAL(1, queue.front());
|
||||
|
||||
queue.pop();
|
||||
CHECK_EQUAL(2, queue.front());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(PushVoid)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
queue.push() = 1;
|
||||
CHECK_EQUAL(1, queue.size());
|
||||
|
||||
queue.push() = 2;
|
||||
CHECK_EQUAL(2, queue.size());
|
||||
|
||||
CHECK_EQUAL(1, queue.front());
|
||||
|
||||
queue.pop();
|
||||
CHECK_EQUAL(2, queue.front());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(PushExcess)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
for (size_t i = 0; i < queue.capacity(); ++i)
|
||||
{
|
||||
queue.push(1);
|
||||
}
|
||||
|
||||
CHECK_THROW(queue.push(1), etl::queue_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Pop)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
queue.push(1);
|
||||
queue.push(2);
|
||||
queue.pop();
|
||||
CHECK_EQUAL(1, queue.size());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Front)
|
||||
TEST(test_front)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -169,7 +111,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(FrontConst)
|
||||
TEST(test_front_const)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
const etl::queue<int, 4>& constQueue = queue;
|
||||
@ -188,7 +130,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(FrontException)
|
||||
TEST(test_front_exception)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -196,7 +138,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Back)
|
||||
TEST(test_back)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -211,7 +153,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(BackConst)
|
||||
TEST(test_back_const)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
const etl::queue<int, 4>& constQueue = queue;
|
||||
@ -220,14 +162,14 @@ namespace
|
||||
CHECK_EQUAL(1, constQueue.back());
|
||||
|
||||
queue.push(2);
|
||||
CHECK_EQUAL(2, constQueue.back());
|
||||
|
||||
CHECK_EQUAL(2, constQueue.back());
|
||||
|
||||
queue.push(3);
|
||||
CHECK_EQUAL(3, constQueue.back());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(BackException)
|
||||
TEST(test_back_exception)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -235,7 +177,54 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(CheckMultiplePush)
|
||||
TEST(test_push)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
queue.push(1);
|
||||
CHECK_EQUAL(1, queue.size());
|
||||
|
||||
queue.push(2);
|
||||
CHECK_EQUAL(2, queue.size());
|
||||
|
||||
CHECK_EQUAL(1, queue.front());
|
||||
|
||||
queue.pop();
|
||||
CHECK_EQUAL(2, queue.front());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_push_void)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
queue.push() = 1;
|
||||
CHECK_EQUAL(1, queue.size());
|
||||
|
||||
queue.push() = 2;
|
||||
CHECK_EQUAL(2, queue.size());
|
||||
|
||||
CHECK_EQUAL(1, queue.front());
|
||||
|
||||
queue.pop();
|
||||
CHECK_EQUAL(2, queue.front());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_push_excess)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
for (size_t i = 0; i < queue.capacity(); ++i)
|
||||
{
|
||||
queue.push(1);
|
||||
}
|
||||
|
||||
CHECK_THROW(queue.push(1), etl::queue_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_multiple_push)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -268,7 +257,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(CheckMultiplePushVoid)
|
||||
TEST(test_multiple_push_void)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
@ -301,7 +290,18 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Swap)
|
||||
TEST(test_pop)
|
||||
{
|
||||
etl::queue<int, 4> queue;
|
||||
|
||||
queue.push(1);
|
||||
queue.push(2);
|
||||
queue.pop();
|
||||
CHECK_EQUAL(1, queue.size());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_swap)
|
||||
{
|
||||
std::queue<int> compare1;
|
||||
std::queue<int> compare2;
|
||||
|
||||
@ -32,41 +32,10 @@ SOFTWARE.
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestStack)
|
||||
SUITE(test_stack)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(Size)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
stack.push(1);
|
||||
stack.push(2);
|
||||
stack.push(3);
|
||||
|
||||
CHECK_EQUAL(3, stack.size());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Capacity)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
CHECK_EQUAL(4, stack.capacity());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Clear)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
stack.push(1);
|
||||
stack.push(2);
|
||||
stack.clear();
|
||||
CHECK_EQUAL(0, stack.size());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Empty)
|
||||
TEST(test_empty)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -78,7 +47,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Full)
|
||||
TEST(test_full)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -93,7 +62,38 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Push)
|
||||
TEST(test_size)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
stack.push(1);
|
||||
stack.push(2);
|
||||
stack.push(3);
|
||||
|
||||
CHECK_EQUAL(3, stack.size());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_capacity)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
CHECK_EQUAL(4, stack.capacity());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_clear)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
stack.push(1);
|
||||
stack.push(2);
|
||||
stack.clear();
|
||||
CHECK_EQUAL(0, stack.size());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_push)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -110,7 +110,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(PushVoid)
|
||||
TEST(test_push_void)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -127,7 +127,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(PushExcess)
|
||||
TEST(test_push_excess)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -140,7 +140,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Pop)
|
||||
TEST(test_pop)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -151,7 +151,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Top)
|
||||
TEST(test_top)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -169,7 +169,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(TopConst)
|
||||
TEST(test_top_const)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
const etl::stack<int, 4>& constQueue = stack;
|
||||
@ -188,7 +188,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(TopException)
|
||||
TEST(test_top_exception)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -196,7 +196,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(CheckMultiplePush)
|
||||
TEST(test_multiple_push)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -229,7 +229,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(CheckMultiplePushVoid)
|
||||
TEST(test_multiple_push_void)
|
||||
{
|
||||
etl::stack<int, 4> stack;
|
||||
|
||||
@ -262,7 +262,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Swap)
|
||||
TEST(test_swap)
|
||||
{
|
||||
std::stack<int> compare1;
|
||||
std::stack<int> compare2;
|
||||
|
||||
@ -26,13 +26,13 @@ SOFTWARE.
|
||||
|
||||
#include <UnitTest++/UnitTest++.h>
|
||||
|
||||
#if (__GNUC__)
|
||||
#if (COMPILER_GCC)
|
||||
#define __GXX_EXPERIMENTAL_CXX0X__
|
||||
#endif
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#if (__GNUC__)
|
||||
#if (COMPILER_GCC)
|
||||
namespace std
|
||||
{
|
||||
template <typename T>
|
||||
@ -52,10 +52,10 @@ struct Test
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestTypeTraits)
|
||||
SUITE(test_type_traits)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(is_integral)
|
||||
TEST(test_is_integral)
|
||||
{
|
||||
CHECK(etl::is_integral<bool>::value == std::is_integral<bool>::value);
|
||||
CHECK(etl::is_integral<char>::value == std::is_integral<char>::value);
|
||||
@ -85,7 +85,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_signed)
|
||||
TEST(test_is_signed)
|
||||
{
|
||||
CHECK(etl::is_signed<bool>::value == std::is_signed<bool>::value);
|
||||
CHECK(etl::is_signed<char>::value == std::is_signed<char>::value);
|
||||
@ -115,7 +115,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_unsigned)
|
||||
TEST(test_is_unsigned)
|
||||
{
|
||||
CHECK(etl::is_unsigned<bool>::value == std::is_unsigned<bool>::value);
|
||||
CHECK(etl::is_unsigned<char>::value == std::is_unsigned<char>::value);
|
||||
@ -146,7 +146,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_floating_point)
|
||||
TEST(test_is_floating_point)
|
||||
{
|
||||
CHECK(etl::is_floating_point<bool>::value == std::is_floating_point<bool>::value);
|
||||
CHECK(etl::is_floating_point<char>::value == std::is_floating_point<char>::value);
|
||||
@ -176,7 +176,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_pointer)
|
||||
TEST(test_is_pointer)
|
||||
{
|
||||
CHECK(etl::is_pointer<int>::value == std::is_pointer<int>::value);
|
||||
CHECK(etl::is_pointer<int*>::value == std::is_pointer<int*>::value);
|
||||
@ -186,7 +186,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_reference)
|
||||
TEST(test_is_reference)
|
||||
{
|
||||
CHECK(etl::is_reference<int>::value == std::is_reference<int>::value);
|
||||
CHECK(etl::is_reference<int&>::value == std::is_reference<int&>::value);
|
||||
@ -196,21 +196,21 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_same)
|
||||
TEST(test_is_same)
|
||||
{
|
||||
CHECK((etl::is_same<int, int>::value == std::is_same<int, int>::value));
|
||||
CHECK((etl::is_same<char, int>::value == std::is_same<char, int>::value));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_array)
|
||||
TEST(test_is_array)
|
||||
{
|
||||
CHECK(etl::is_array<int>::value == std::is_array<int>::value);
|
||||
CHECK(etl::is_array<int[10]>::value == std::is_array<int[10]>::value);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_pointer)
|
||||
TEST(test_remove_pointer)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_pointer<int>::type, std::remove_pointer<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_pointer<int*>::type, std::remove_pointer<int*>::type>::value));
|
||||
@ -220,7 +220,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(add_pointer)
|
||||
TEST(test_add_pointer)
|
||||
{
|
||||
CHECK((std::is_same<etl::add_pointer<int>::type, std::add_pointer<int>::type>::value));
|
||||
CHECK((std::is_same<etl::add_pointer<int*>::type, std::add_pointer<int*>::type>::value));
|
||||
@ -230,7 +230,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_reference)
|
||||
TEST(test_remove_reference)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_reference<int>::type, std::remove_reference<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_reference<int&>::type, std::remove_reference<int&>::type>::value));
|
||||
@ -240,7 +240,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(add_reference)
|
||||
TEST(test_add_reference)
|
||||
{
|
||||
CHECK((std::is_same<etl::add_reference<int>::type, std::add_lvalue_reference<int>::type>::value));
|
||||
CHECK((std::is_same<etl::add_reference<int&>::type, std::add_reference<int&>::type>::value));
|
||||
@ -251,7 +251,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_const)
|
||||
TEST(test_remove_const)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_const<int>::type, std::remove_const<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_const<const int>::type, std::remove_const<const int>::type>::value));
|
||||
@ -259,7 +259,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(add_const)
|
||||
TEST(test_add_const)
|
||||
{
|
||||
CHECK((std::is_same<etl::add_const<int>::type, std::add_const<int>::type>::value));
|
||||
CHECK((std::is_same<etl::add_const<const int>::type, std::add_const<const int>::type>::value));
|
||||
@ -267,7 +267,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_const)
|
||||
TEST(test_is_const)
|
||||
{
|
||||
CHECK(etl::is_const<int>::value == std::is_const<int>::value);
|
||||
CHECK(etl::is_const<const int>::value == std::is_const<const int>::value);
|
||||
@ -275,7 +275,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_volatile)
|
||||
TEST(test_is_volatile)
|
||||
{
|
||||
CHECK(etl::is_volatile<int>::value == std::is_volatile<int>::value);
|
||||
CHECK(etl::is_volatile<volatile int>::value == std::is_volatile<volatile int>::value);
|
||||
@ -283,7 +283,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_volatile)
|
||||
TEST(test_remove_volatile)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_volatile<int>::type, std::remove_volatile<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_volatile<volatile int>::type, std::remove_volatile<volatile int>::type>::value));
|
||||
@ -291,7 +291,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(add_volatile)
|
||||
TEST(test_add_volatile)
|
||||
{
|
||||
CHECK((std::is_same<etl::add_volatile<int>::type, std::add_volatile<int>::type>::value));
|
||||
CHECK((std::is_same<etl::add_volatile<volatile int>::type, std::add_volatile<volatile int>::type>::value));
|
||||
@ -299,7 +299,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_cv)
|
||||
TEST(test_remove_cv)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_cv<int>::type, std::remove_cv<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_cv<const int>::type, std::remove_cv<const int>::type>::value));
|
||||
@ -308,7 +308,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(add_cv)
|
||||
TEST(test_add_cv)
|
||||
{
|
||||
|
||||
typedef etl::add_cv<int>::type t1;
|
||||
@ -324,7 +324,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_arithmetic)
|
||||
TEST(test_is_arithmetic)
|
||||
{
|
||||
CHECK(etl::is_arithmetic<bool>::value == std::is_arithmetic<bool>::value);
|
||||
CHECK(etl::is_arithmetic<char>::value == std::is_arithmetic<char>::value);
|
||||
@ -354,7 +354,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_fundamental)
|
||||
TEST(test_is_fundamental)
|
||||
{
|
||||
CHECK(etl::is_fundamental<void>::value == std::is_fundamental<void>::value);
|
||||
CHECK(etl::is_fundamental<bool>::value == std::is_fundamental<bool>::value);
|
||||
@ -385,14 +385,45 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(is_void)
|
||||
TEST(test_is_compound)
|
||||
{
|
||||
CHECK(etl::is_compound<void>::value == std::is_compound<void>::value);
|
||||
CHECK(etl::is_compound<bool>::value == std::is_compound<bool>::value);
|
||||
CHECK(etl::is_compound<char>::value == std::is_compound<char>::value);
|
||||
CHECK(etl::is_compound<signed char>::value == std::is_compound<signed char>::value);
|
||||
CHECK(etl::is_compound<unsigned char>::value == std::is_compound<unsigned char>::value);
|
||||
CHECK(etl::is_compound<wchar_t>::value == std::is_compound<wchar_t>::value);
|
||||
CHECK(etl::is_compound<short>::value == std::is_compound<short>::value);
|
||||
CHECK(etl::is_compound<signed short>::value == std::is_compound<signed short>::value);
|
||||
CHECK(etl::is_compound<unsigned short>::value == std::is_compound<unsigned short>::value);
|
||||
CHECK(etl::is_compound<int>::value == std::is_compound<int>::value);
|
||||
CHECK(etl::is_compound<signed int>::value == std::is_compound<signed int>::value);
|
||||
CHECK(etl::is_compound<unsigned int>::value == std::is_compound<unsigned int>::value);
|
||||
CHECK(etl::is_compound<long>::value == std::is_compound<long>::value);
|
||||
CHECK(etl::is_compound<signed long>::value == std::is_compound<signed long>::value);
|
||||
CHECK(etl::is_compound<unsigned long>::value == std::is_compound<unsigned long>::value);
|
||||
CHECK(etl::is_compound<long long>::value == std::is_compound<long long>::value);
|
||||
CHECK(etl::is_compound<signed long long>::value == std::is_compound<signed long long>::value);
|
||||
CHECK(etl::is_compound<unsigned long long>::value == std::is_compound<unsigned long long>::value);
|
||||
CHECK(etl::is_compound<const int>::value == std::is_compound<const int>::value);
|
||||
CHECK(etl::is_compound<volatile int>::value == std::is_compound<volatile int>::value);
|
||||
CHECK(etl::is_compound<const int>::value == std::is_compound<const int>::value);
|
||||
CHECK(etl::is_compound<const volatile int>::value == std::is_compound<const volatile int>::value);
|
||||
CHECK(etl::is_compound<float>::value == std::is_compound<float>::value);
|
||||
CHECK(etl::is_compound<double>::value == std::is_compound<double>::value);
|
||||
CHECK(etl::is_compound<long double>::value == std::is_compound<long double>::value);
|
||||
CHECK(etl::is_compound<Test>::value == std::is_compound<Test>::value);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_is_void)
|
||||
{
|
||||
CHECK(etl::is_void<int>::value == std::is_void<int>::value);
|
||||
CHECK(etl::is_void<void>::value == std::is_void<void>::value);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(make_signed)
|
||||
TEST(test_make_signed)
|
||||
{
|
||||
CHECK((std::is_same<etl::make_signed<char>::type, std::make_signed<char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed char>::type, std::make_signed<signed char>::type>::value));
|
||||
@ -417,7 +448,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(make_unsigned)
|
||||
TEST(test_make_unsigned)
|
||||
{
|
||||
CHECK((std::is_same<etl::make_unsigned<char>::type, std::make_unsigned<char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed char>::type, std::make_unsigned<signed char>::type>::value));
|
||||
@ -442,7 +473,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(extent)
|
||||
TEST(test_extent)
|
||||
{
|
||||
CHECK((std::is_same<etl::extent<int>::type, std::extent<int>::type>::value));
|
||||
CHECK((std::is_same<etl::extent<int[]>::type, std::extent<int[]>::type>::value));
|
||||
@ -450,7 +481,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_extent)
|
||||
TEST(test_remove_extent)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_extent<int>::type, std::remove_extent<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_extent<int[]>::type, std::remove_extent<int[]>::type>::value));
|
||||
@ -458,7 +489,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(remove_all_extents)
|
||||
TEST(test_remove_all_extents)
|
||||
{
|
||||
CHECK((std::is_same<etl::remove_all_extents<int>::type, std::remove_all_extents<int>::type>::value));
|
||||
CHECK((std::is_same<etl::remove_all_extents<int[10]>::type, std::remove_all_extents<int[10]>::type>::value));
|
||||
@ -466,7 +497,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(rank)
|
||||
TEST(test_rank)
|
||||
{
|
||||
CHECK(etl::rank<int>::value == std::rank<int>::value);
|
||||
CHECK(etl::rank<int[10]>::value == std::rank<int[10]>::value);
|
||||
@ -474,7 +505,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(alignment_of)
|
||||
TEST(test_alignment_of)
|
||||
{
|
||||
struct Test
|
||||
{
|
||||
|
||||
@ -82,9 +82,9 @@ test_variant_max_types variant_max;
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(test_alignment)
|
||||
SUITE(test_variant)
|
||||
{
|
||||
TEST(test_lignment)
|
||||
TEST(test_alignment)
|
||||
{
|
||||
typedef etl::variant<char, unsigned char> test_variant_a;
|
||||
typedef etl::variant<char, short> test_variant_b;
|
||||
@ -104,7 +104,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(text_constructor_value)
|
||||
TEST(test_constructor_value)
|
||||
{
|
||||
// Char.
|
||||
char c = 'a';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -181,10 +181,10 @@ public:
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(TestVisitor)
|
||||
SUITE(test_visitor)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(TestTwoVisitorsThreeVisitables)
|
||||
TEST(test_two_visitors_three_visitables)
|
||||
{
|
||||
DrawVisitor draw_visitor;
|
||||
LogVisitor log_visitor;
|
||||
@ -231,7 +231,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test1Visitor)
|
||||
TEST(test_1_visitor)
|
||||
{
|
||||
class AShape;
|
||||
class ShapeVisitor1 : public etl::visitor<AShape&>
|
||||
@ -251,7 +251,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test2Visitor)
|
||||
TEST(test_2_visitor)
|
||||
{
|
||||
class AShape;
|
||||
class ShapeVisitor1 : public etl::visitor<AShape&>
|
||||
@ -277,7 +277,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test3Visitor)
|
||||
TEST(test_3_visitor)
|
||||
{
|
||||
class AShape;
|
||||
class ShapeVisitor1 : public etl::visitor<AShape&>
|
||||
@ -309,7 +309,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test4Visitor)
|
||||
TEST(test_4_visitor)
|
||||
{
|
||||
class AShape;
|
||||
class ShapeVisitor1 : public etl::visitor<AShape&>
|
||||
@ -347,7 +347,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test1Visitable)
|
||||
TEST(test_1_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor> >
|
||||
{
|
||||
@ -361,7 +361,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test2Visitables)
|
||||
TEST(test_2_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor> >
|
||||
{
|
||||
@ -376,7 +376,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test3Visitables)
|
||||
TEST(test_3_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor> >
|
||||
{
|
||||
@ -392,7 +392,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test4Visitables)
|
||||
TEST(test_4_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor> >
|
||||
{
|
||||
@ -409,7 +409,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test5Visitables)
|
||||
TEST(test_5_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor> >
|
||||
@ -428,7 +428,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test6Visitables)
|
||||
TEST(test_6_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor> >
|
||||
@ -448,7 +448,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test7Visitables)
|
||||
TEST(test_7_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor> >
|
||||
@ -469,7 +469,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test8Visitables)
|
||||
TEST(test_8_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor> >
|
||||
@ -491,7 +491,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test9Visitables)
|
||||
TEST(test_9_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -515,7 +515,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test10Visitables)
|
||||
TEST(test_10_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -541,7 +541,7 @@ namespace
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test11Visitables)
|
||||
TEST(test_11_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -567,7 +567,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test12Visitables)
|
||||
TEST(test_12_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -594,7 +594,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test13Visitables)
|
||||
TEST(test_13_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -623,7 +623,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test14Visitables)
|
||||
TEST(test_14_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -653,7 +653,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test15Visitables)
|
||||
TEST(test_15_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
@ -684,7 +684,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(Test16Visitables)
|
||||
TEST(test_16_visitable)
|
||||
{
|
||||
class ShapeVisitor : public etl::visitor <Shape<1, ShapeVisitor>, Shape<2, ShapeVisitor>, Shape<3, ShapeVisitor>, Shape<4, ShapeVisitor>,
|
||||
Shape<5, ShapeVisitor>, Shape<6, ShapeVisitor>, Shape<7, ShapeVisitor>, Shape<8, ShapeVisitor>,
|
||||
|
||||
@ -146,6 +146,7 @@
|
||||
<ClInclude Include="..\..\nullptr.h" />
|
||||
<ClInclude Include="..\..\numeric.h" />
|
||||
<ClInclude Include="..\..\observer.h" />
|
||||
<ClInclude Include="..\..\parameter_type.h" />
|
||||
<ClInclude Include="..\..\pow.h" />
|
||||
<ClInclude Include="..\..\queue.h" />
|
||||
<ClInclude Include="..\..\queue_base.h" />
|
||||
@ -202,7 +203,7 @@
|
||||
<ClCompile Include="..\test_integral_limits.cpp" />
|
||||
<ClCompile Include="..\test_largest.cpp" />
|
||||
<ClCompile Include="..\test_list.cpp" />
|
||||
<ClCompile Include="..\test_math.cpp" />
|
||||
<ClCompile Include="..\test_maths.cpp" />
|
||||
<ClCompile Include="..\test_numeric.cpp" />
|
||||
<ClCompile Include="..\test_observer.cpp" />
|
||||
<ClCompile Include="..\test_queue.cpp" />
|
||||
|
||||
@ -267,6 +267,9 @@
|
||||
<ClInclude Include="..\..\aligned_variable.h">
|
||||
<Filter>ETL\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\parameter_type.h">
|
||||
<Filter>ETL\Utilities</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\unittest-cpp\UnitTest++\AssertException.cpp">
|
||||
@ -338,9 +341,6 @@
|
||||
<ClCompile Include="..\test_function.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_math.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_queue.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -413,6 +413,9 @@
|
||||
<ClCompile Include="..\test_smallest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_maths.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Doxyfile">
|
||||
|
||||
134
type_traits.h
134
type_traits.h
@ -79,9 +79,9 @@ namespace etl
|
||||
|
||||
/// is_const
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_const : false_type { };
|
||||
template <typename T> struct is_const<const T> : true_type { };
|
||||
template <typename T> struct is_const<const volatile T> : true_type { };
|
||||
template <typename T> struct is_const : false_type {};
|
||||
template <typename T> struct is_const<const T> : true_type {};
|
||||
template <typename T> struct is_const<const volatile T> : true_type {};
|
||||
|
||||
/// remove_const
|
||||
///\ingroup type_traits
|
||||
@ -95,9 +95,9 @@ namespace etl
|
||||
|
||||
/// is_volatile
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_volatile : false_type { };
|
||||
template <typename T> struct is_volatile<volatile T> : true_type { };
|
||||
template <typename T> struct is_volatile<const volatile T> : true_type { };
|
||||
template <typename T> struct is_volatile : false_type {};
|
||||
template <typename T> struct is_volatile<volatile T> : true_type {};
|
||||
template <typename T> struct is_volatile<const volatile T> : true_type {};
|
||||
|
||||
/// remove_volatile
|
||||
///\ingroup type_traits
|
||||
@ -125,78 +125,78 @@ namespace etl
|
||||
|
||||
/// is_integral
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_integral : false_type { };
|
||||
template <> struct is_integral<bool> : true_type { };
|
||||
template <> struct is_integral<char> : true_type { };
|
||||
template <> struct is_integral<unsigned char> : true_type { };
|
||||
template <> struct is_integral<signed char> : true_type { };
|
||||
template <> struct is_integral<wchar_t> : true_type { };
|
||||
template <> struct is_integral<short> : true_type { };
|
||||
template <> struct is_integral<unsigned short> : true_type { };
|
||||
template <> struct is_integral<int> : true_type { };
|
||||
template <> struct is_integral<unsigned int> : true_type { };
|
||||
template <> struct is_integral<long> : true_type { };
|
||||
template <> struct is_integral<unsigned long> : true_type { };
|
||||
template <> struct is_integral<long long> : true_type { };
|
||||
template <> struct is_integral<unsigned long long> : true_type { };
|
||||
template <typename T> struct is_integral<const T> : is_integral<T> { };
|
||||
template <typename T> struct is_integral<volatile T> : is_integral<T> { };
|
||||
template <typename T> struct is_integral<const volatile T> : is_integral<T> { };
|
||||
template <typename T> struct is_integral : false_type {};
|
||||
template <> struct is_integral<bool> : true_type {};
|
||||
template <> struct is_integral<char> : true_type {};
|
||||
template <> struct is_integral<unsigned char> : true_type {};
|
||||
template <> struct is_integral<signed char> : true_type {};
|
||||
template <> struct is_integral<wchar_t> : true_type {};
|
||||
template <> struct is_integral<short> : true_type {};
|
||||
template <> struct is_integral<unsigned short> : true_type {};
|
||||
template <> struct is_integral<int> : true_type {};
|
||||
template <> struct is_integral<unsigned int> : true_type {};
|
||||
template <> struct is_integral<long> : true_type {};
|
||||
template <> struct is_integral<unsigned long> : true_type {};
|
||||
template <> struct is_integral<long long> : true_type {};
|
||||
template <> struct is_integral<unsigned long long> : true_type {};
|
||||
template <typename T> struct is_integral<const T> : is_integral<T> {};
|
||||
template <typename T> struct is_integral<volatile T> : is_integral<T> {};
|
||||
template <typename T> struct is_integral<const volatile T> : is_integral<T> {};
|
||||
|
||||
/// is_signed
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_signed : false_type { };
|
||||
template <> struct is_signed<char> : true_type { };
|
||||
template <typename T> struct is_signed : false_type {};
|
||||
template <> struct is_signed<char> : true_type {};
|
||||
#ifdef PLATFORM_LINUX
|
||||
template <> struct is_signed<wchar_t> : true_type { };
|
||||
template <> struct is_signed<wchar_t> : true_type {};
|
||||
#endif
|
||||
template <> struct is_signed<signed char> : true_type { };
|
||||
template <> struct is_signed<short> : true_type { };
|
||||
template <> struct is_signed<int> : true_type { };
|
||||
template <> struct is_signed<long> : true_type { };
|
||||
template <> struct is_signed<long long> : true_type { };
|
||||
template <> struct is_signed<signed char> : true_type {};
|
||||
template <> struct is_signed<short> : true_type {};
|
||||
template <> struct is_signed<int> : true_type {};
|
||||
template <> struct is_signed<long> : true_type {};
|
||||
template <> struct is_signed<long long> : true_type {};
|
||||
template <> struct is_signed<float> : true_type{};
|
||||
template <> struct is_signed<double> : true_type{};
|
||||
template <> struct is_signed<long double> : true_type{};
|
||||
template <typename T> struct is_signed<const T> : is_signed<T> { };
|
||||
template <typename T> struct is_signed<volatile T> : is_signed<T> { };
|
||||
template <typename T> struct is_signed<const volatile T> : is_signed<T> { };
|
||||
template <typename T> struct is_signed<const T> : is_signed<T> {};
|
||||
template <typename T> struct is_signed<volatile T> : is_signed<T> {};
|
||||
template <typename T> struct is_signed<const volatile T> : is_signed<T> {};
|
||||
|
||||
/// is_unsigned
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_unsigned : false_type { };
|
||||
template <> struct is_unsigned<bool> : true_type { };
|
||||
template <> struct is_unsigned<unsigned char> : true_type { };
|
||||
template <typename T> struct is_unsigned : false_type {};
|
||||
template <> struct is_unsigned<bool> : true_type {};
|
||||
template <> struct is_unsigned<unsigned char> : true_type {};
|
||||
#ifndef PLATFORM_LINUX
|
||||
template <> struct is_unsigned<wchar_t> : true_type { };
|
||||
template <> struct is_unsigned<wchar_t> : true_type {};
|
||||
#endif
|
||||
template <> struct is_unsigned<unsigned short> : true_type { };
|
||||
template <> struct is_unsigned<unsigned int> : true_type { };
|
||||
template <> struct is_unsigned<unsigned long> : true_type { };
|
||||
template <> struct is_unsigned<unsigned long long> : true_type { };
|
||||
template <typename T> struct is_unsigned<const T> : is_unsigned<T> { };
|
||||
template <typename T> struct is_unsigned<volatile T> : is_unsigned<T> { };
|
||||
template <typename T> struct is_unsigned<const volatile T> : is_unsigned<T> { };
|
||||
template <> struct is_unsigned<unsigned short> : true_type {};
|
||||
template <> struct is_unsigned<unsigned int> : true_type {};
|
||||
template <> struct is_unsigned<unsigned long> : true_type {};
|
||||
template <> struct is_unsigned<unsigned long long> : true_type {};
|
||||
template <typename T> struct is_unsigned<const T> : is_unsigned<T> {};
|
||||
template <typename T> struct is_unsigned<volatile T> : is_unsigned<T> {};
|
||||
template <typename T> struct is_unsigned<const volatile T> : is_unsigned<T> {};
|
||||
|
||||
/// is_floating_point
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_floating_point : false_type { };
|
||||
template <> struct is_floating_point<float> : true_type { };
|
||||
template <> struct is_floating_point<double> : true_type { };
|
||||
template <> struct is_floating_point<long double> : true_type { };
|
||||
template <typename T> struct is_floating_point<const T> : is_floating_point<T> { };
|
||||
template <typename T> struct is_floating_point<volatile T> : is_floating_point<T> { };
|
||||
template <typename T> struct is_floating_point<const volatile T> : is_floating_point<T> { };
|
||||
template <typename T> struct is_floating_point : false_type {};
|
||||
template <> struct is_floating_point<float> : true_type {};
|
||||
template <> struct is_floating_point<double> : true_type {};
|
||||
template <> struct is_floating_point<long double> : true_type {};
|
||||
template <typename T> struct is_floating_point<const T> : is_floating_point<T> {};
|
||||
template <typename T> struct is_floating_point<volatile T> : is_floating_point<T> {};
|
||||
template <typename T> struct is_floating_point<const volatile T> : is_floating_point<T> {};
|
||||
|
||||
/// is_same
|
||||
///\ingroup type_traits
|
||||
template <typename T1, typename T2> struct is_same : public false_type { };
|
||||
template <typename T> struct is_same<T, T> : public true_type { };
|
||||
template <typename T1, typename T2> struct is_same : public false_type {};
|
||||
template <typename T> struct is_same<T, T> : public true_type {};
|
||||
|
||||
/// is_void
|
||||
///\ingroup type_traits
|
||||
template<typename T> struct is_void : false_type { };
|
||||
template<> struct is_void<void> : true_type { };
|
||||
template<typename T> struct is_void : false_type {};
|
||||
template<> struct is_void<void> : true_type {};
|
||||
|
||||
/// is_arithmetic
|
||||
///\ingroup type_traits
|
||||
@ -209,6 +209,10 @@ namespace etl
|
||||
is_same<std::nullptr_t,
|
||||
typename remove_cv<T>::type>::value> {};
|
||||
|
||||
/// is_compound
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_compound : std::integral_constant<bool, !std::is_fundamental<T>::value> {};
|
||||
|
||||
/// is_array
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_array : false_type {};
|
||||
@ -217,8 +221,8 @@ namespace etl
|
||||
|
||||
/// is_pointer
|
||||
///\ingroup type_traits
|
||||
template <typename T> struct is_pointer : false_type { };
|
||||
template <typename T> struct is_pointer<T*> : true_type { };
|
||||
template <typename T> struct is_pointer : false_type {};
|
||||
template <typename T> struct is_pointer<T*> : true_type {};
|
||||
|
||||
/// is_reference
|
||||
///\ingroup type_traits
|
||||
@ -237,9 +241,9 @@ namespace etl
|
||||
template <> struct make_signed<unsigned int> { typedef int type; };
|
||||
template <> struct make_signed<unsigned long> { typedef long type; };
|
||||
template <> struct make_signed<unsigned long long> { typedef long long type; };
|
||||
template <typename T> struct make_signed<const T> : add_const<typename make_signed<T>::type> { };
|
||||
template <typename T> struct make_signed<volatile T> : add_volatile<typename make_signed<T>::type> { };
|
||||
template <typename T> struct make_signed<const volatile T> : add_const<typename add_volatile<typename make_signed<T>::type>::type> { };
|
||||
template <typename T> struct make_signed<const T> : add_const<typename make_signed<T>::type> {};
|
||||
template <typename T> struct make_signed<volatile T> : add_volatile<typename make_signed<T>::type> {};
|
||||
template <typename T> struct make_signed<const volatile T> : add_const<typename add_volatile<typename make_signed<T>::type>::type> {};
|
||||
|
||||
/// make_unsigned
|
||||
///\ingroup type_traits
|
||||
@ -253,13 +257,13 @@ namespace etl
|
||||
template <> struct make_unsigned<int> { typedef unsigned int type; };
|
||||
template <> struct make_unsigned<long> { typedef unsigned long type; };
|
||||
template <> struct make_unsigned<long long> { typedef unsigned long long type; };
|
||||
template <typename T> struct make_unsigned<const T> : add_const<typename make_unsigned<T>::type> { };
|
||||
template <typename T> struct make_unsigned<volatile T> : add_volatile<typename make_unsigned<T>::type> { };
|
||||
template <typename T> struct make_unsigned<const volatile T> : add_const<typename add_volatile<typename make_unsigned<T>::type>::type> { };
|
||||
template <typename T> struct make_unsigned<const T> : add_const<typename make_unsigned<T>::type> {};
|
||||
template <typename T> struct make_unsigned<volatile T> : add_volatile<typename make_unsigned<T>::type> {};
|
||||
template <typename T> struct make_unsigned<const volatile T> : add_const<typename add_volatile<typename make_unsigned<T>::type>::type> {};
|
||||
|
||||
/// enable_if
|
||||
///\ingroup type_traits
|
||||
template <bool B, typename T = void> struct enable_if { };
|
||||
template <bool B, typename T = void> struct enable_if {};
|
||||
template <typename T> struct enable_if<true, T> { typedef T type; };
|
||||
|
||||
/// conditional
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user