Compare commits

..

3 Commits

Author SHA1 Message Date
Patrick 797cab9d42 added tests for operator= 2024-01-06 23:38:00 +01:00
Patrick 8bbddf74fe added overloads to and bugfixed operator= 2024-01-06 23:37:44 +01:00
Patrick a89e03fb94 renamed include guard 2024-01-06 18:27:30 +01:00
2 changed files with 291 additions and 51 deletions

View File

@ -2,8 +2,8 @@
// Created by Patrick Maschek on 19.12.2023.
//
#ifndef UDIFF_IMMARRAY_H_
#define UDIFF_IMMARRAY_H_
#ifndef CONST_CONTAINER_CONST_VEC_H_
#define CONST_CONTAINER_CONST_VEC_H_
#include <algorithm>
#include <initializer_list>
@ -58,9 +58,13 @@ namespace cc {
constexpr ~const_vector() = default; // elements in static array should be destroyed automatically
constexpr const_vector<T, N>& operator=(const const_vector& other);
constexpr const_vector<T, N>& operator=(const const_vector& other); // needed to handle *this = *this
template <std::size_t N2>
constexpr const_vector<T, N>& operator=(const const_vector<value_type, N2>& other);
constexpr const_vector<T, N>& operator=(const_vector&& other) noexcept;
constexpr const_vector<T, N>& operator=(const value_type (&array)[N]) noexcept;
//constexpr const_vector<T, N>& operator=(const value_type (&array)[N]) noexcept; // not needed as functionally equivalent to templated overload
template <std::size_t N2>
constexpr const_vector<T, N>& operator=(const value_type (&array)[N2]) noexcept;
constexpr void assign(size_type count, const value_type& value) noexcept;
template<std::input_iterator InputIt>
@ -253,19 +257,33 @@ namespace cc {
constexpr const_vector<T, N> &const_vector<T, N>::operator=(const const_vector &other)
{
if (this == &other) return *this;
static_assert(N == other._len, "Cannot assign const_vector to other with different size");
assign(other.begin(), other.end());
return *this;
}
template<typename T, std::size_t N>
template<std::size_t N2>
constexpr const_vector<T, N> &const_vector<T, N>::operator=(const const_vector<const_vector::value_type, N2> &other)
{
if (other.size() > _len) throw std::invalid_argument("size of other has to be equal to or smaller than this");
// this is not necessary, as it should call the non templated operator=
// (and it throws an error without a cast)
//if (this == &other) return *this;
assign(other.begin(), other.end());
return *this;
}
template<typename T, std::size_t N>
constexpr const_vector<T, N> &const_vector<T, N>::operator=(const_vector &&other) noexcept
{
static_assert(N == other._len, "Cannot assign const_vector to other with different size");
if (N != other._len) throw std::exception();
// cannot occur, otherwise signature would differ
//static_assert(N == other._len, "Cannot assign const_vector to other with different size");
//if (N != other._len) throw std::exception();
clear();
std::move(other.begin(), other.end(), _arr);
@ -275,7 +293,8 @@ namespace cc {
}
template<typename T, std::size_t N>
constexpr const_vector<T, N> &const_vector<T, N>::operator=(const value_type (&array)[N]) noexcept
template<std::size_t N2>
constexpr const_vector<T, N> &const_vector<T, N>::operator=(const value_type (&array)[N2]) noexcept
{
assign(std::begin(array), std::end(array));
return *this;
@ -464,4 +483,4 @@ namespace cc {
}; // cc
#endif //UDIFF_IMMARRAY_H_
#endif //CONST_CONTAINER_CONST_VEC_H_

View File

@ -31,21 +31,22 @@ class test_const_vector;
#define ASSERT_RANGE_VEC_ARR_EQ(vec, startI, endI, eq) ASSERT_ARR_EQ((vec._arr + startI), (vec._arr + endI), eq)
class test_const_vector {
public:
struct TestStruct {
int x = 0;
char c = 0;
const char * s = "This is a string";
struct TestStruct {
int x = 0;
char c = 0;
const char * s = "This is a string";
constexpr bool operator==(const TestStruct &other) const { return x == other.x && c == other.c && std::string_view(s) == other.s; }
};
constexpr bool operator==(const TestStruct &other) const { return x == other.x && c == other.c && std::string_view(s) == other.s; }
};
class test_defs {
public:
#define GEN_TEST_STRUCT_ARR(nr, i) TestStruct(C_VI_TEST_ARR##nr[i], C_VC_TEST_ARR##nr[i], C_VS_TEST_ARR##nr[i])
#define TEST_VEC1_CAPACITY 5
#define TEST_VEC2_CAPACITY 10
@ -59,30 +60,12 @@ class test_const_vector {
#define VI_TEST_ARR1 { 1, 2, 3, 4 }
#define VI_TEST_ARR2 { 5, 6, 7, 8, 9, 10, 11, 12 }
static constexpr const int C_VI_TEST_ARR1[] = VI_TEST_ARR1;
static constexpr const int C_VI_TEST_ARR2[] = VI_TEST_ARR2;
static constexpr const std::array STD_VI_TEST_ARR1 = VI_TEST_ARR1;
static constexpr const std::array STD_VI_TEST_ARR2 = VI_TEST_ARR2;
static constexpr const std::size_t VI_TEST_ARR1_LEN = C_ARR_LEN(C_VI_TEST_ARR1);
static constexpr const std::size_t VI_TEST_ARR2_LEN = C_ARR_LEN(C_VI_TEST_ARR2);
#define VC_TEST_ARR1 { 'a', 'B', 'c', 'D' }
#define VC_TEST_ARR2 { 'e', 'F', 'g', 'H', 'i', 'J', '\n', '\0' }
static constexpr const char C_VC_TEST_ARR1[] = VC_TEST_ARR1;
static constexpr const char C_VC_TEST_ARR2[] = VC_TEST_ARR2;
static constexpr const std::array STD_VC_TEST_ARR1 = VC_TEST_ARR1;
static constexpr const std::array STD_VC_TEST_ARR2 = VC_TEST_ARR2;
static constexpr const std::size_t VC_TEST_ARR1_LEN = C_ARR_LEN(C_VC_TEST_ARR1);
static constexpr const std::size_t VC_TEST_ARR2_LEN = C_ARR_LEN(C_VC_TEST_ARR2);
#define VS_TEST_ARR1 { "Lorem", "ipsum", "dolor", "sit" }
#define VS_TEST_ARR2 { "amet", "consetetur", "sadipscing", "elitr", "sed", "diam", "nonumy", "eirmod", "tempor", "\0" }
static constexpr const char * C_VS_TEST_ARR1[] = VS_TEST_ARR1;
static constexpr const char * C_VS_TEST_ARR2[] = VS_TEST_ARR2;
static constexpr const std::array STD_VS_TEST_ARR1 = VS_TEST_ARR1;
static constexpr const std::array STD_VS_TEST_ARR2 = VS_TEST_ARR2;
static constexpr const std::size_t VS_TEST_ARR1_LEN = C_ARR_LEN(C_VS_TEST_ARR1);
static constexpr const std::size_t VS_TEST_ARR2_LEN = C_ARR_LEN(C_VS_TEST_ARR2);
#define VO_TEST_ARR1 { GEN_TEST_STRUCT_ARR(1, 0), \
GEN_TEST_STRUCT_ARR(1, 1), \
@ -96,28 +79,87 @@ class test_const_vector {
GEN_TEST_STRUCT_ARR(2, 5), \
GEN_TEST_STRUCT_ARR(2, 6), \
GEN_TEST_STRUCT_ARR(2, 7) }
static constexpr TestStruct C_VO_TEST_ARR1[] = VO_TEST_ARR1;
static constexpr TestStruct C_VO_TEST_ARR2[] = VO_TEST_ARR2;
static constexpr const std::array STD_VO_TEST_ARR1 = VO_TEST_ARR1;
static constexpr const std::array STD_VO_TEST_ARR2 = VO_TEST_ARR2;
static constexpr const std::size_t VO_TEST_ARR1_LEN = C_ARR_LEN(C_VO_TEST_ARR1);
static constexpr const std::size_t VO_TEST_ARR2_LEN = C_ARR_LEN(C_VO_TEST_ARR2);
static constexpr const int C_VI_TEST_ARR1[] = VI_TEST_ARR1;
static constexpr const int C_VI_TEST_ARR2[] = VI_TEST_ARR2;
static constexpr const std::array STD_VI_TEST_ARR1 = VI_TEST_ARR1;
static constexpr const std::array STD_VI_TEST_ARR2 = VI_TEST_ARR2;
static constexpr const std::size_t VI_TEST_ARR1_LEN = C_ARR_LEN(C_VI_TEST_ARR1);
static constexpr const std::size_t VI_TEST_ARR2_LEN = C_ARR_LEN(C_VI_TEST_ARR2);
static constexpr const char C_VC_TEST_ARR1[] = VC_TEST_ARR1;
static constexpr const char C_VC_TEST_ARR2[] = VC_TEST_ARR2;
static constexpr const std::array STD_VC_TEST_ARR1 = VC_TEST_ARR1;
static constexpr const std::array STD_VC_TEST_ARR2 = VC_TEST_ARR2;
static constexpr const std::size_t VC_TEST_ARR1_LEN = C_ARR_LEN(C_VC_TEST_ARR1);
static constexpr const std::size_t VC_TEST_ARR2_LEN = C_ARR_LEN(C_VC_TEST_ARR2);
static constexpr const char * C_VS_TEST_ARR1[] = VS_TEST_ARR1;
static constexpr const char * C_VS_TEST_ARR2[] = VS_TEST_ARR2;
static constexpr const std::array STD_VS_TEST_ARR1 = VS_TEST_ARR1;
static constexpr const std::array STD_VS_TEST_ARR2 = VS_TEST_ARR2;
static constexpr const std::size_t VS_TEST_ARR1_LEN = C_ARR_LEN(C_VS_TEST_ARR1);
static constexpr const std::size_t VS_TEST_ARR2_LEN = C_ARR_LEN(C_VS_TEST_ARR2);
static constexpr TestStruct C_VO_TEST_ARR1[] = VO_TEST_ARR1;
static constexpr TestStruct C_VO_TEST_ARR2[] = VO_TEST_ARR2;
static constexpr const std::array STD_VO_TEST_ARR1 = VO_TEST_ARR1;
static constexpr const std::array STD_VO_TEST_ARR2 = VO_TEST_ARR2;
static constexpr const std::size_t VO_TEST_ARR1_LEN = C_ARR_LEN(C_VO_TEST_ARR1);
static constexpr const std::size_t VO_TEST_ARR2_LEN = C_ARR_LEN(C_VO_TEST_ARR2);
template<typename T>
struct get_test_def {
template<unsigned long long int nr>
static consteval auto& get_arr_for_type();
template<unsigned long long int nr>
static consteval unsigned long long int get_arr_len_for_type();
};
};
using int_defs = test_defs::get_test_def<int>;
using char_defs = test_defs::get_test_def<char>;
using string_defs = test_defs::get_test_def<const char *>;
using obj_defs = test_defs::get_test_def<TestStruct>;
template<> template<> consteval auto& int_defs::get_arr_for_type<1>() { return C_VI_TEST_ARR1; }
template<> template<> consteval auto& int_defs::get_arr_for_type<2>() { return C_VI_TEST_ARR2; }
template<> template<> consteval auto& char_defs::get_arr_for_type<1>() { return C_VC_TEST_ARR1; }
template<> template<> consteval auto& char_defs::get_arr_for_type<2>() { return C_VC_TEST_ARR2; }
template<> template<> consteval auto& string_defs::get_arr_for_type<1>() { return C_VS_TEST_ARR1; }
template<> template<> consteval auto& string_defs::get_arr_for_type<2>() { return C_VS_TEST_ARR2; }
template<> template<> consteval auto& obj_defs::get_arr_for_type<1>() { return C_VO_TEST_ARR1; }
template<> template<> consteval auto& obj_defs::get_arr_for_type<2>() { return C_VO_TEST_ARR2; }
template<> template<> consteval std::size_t int_defs::get_arr_len_for_type<1>() { return VI_TEST_ARR1_LEN; }
template<> template<> consteval std::size_t int_defs::get_arr_len_for_type<2>() { return VI_TEST_ARR2_LEN; }
template<> template<> consteval std::size_t char_defs::get_arr_len_for_type<1>() { return VC_TEST_ARR1_LEN; }
template<> template<> consteval std::size_t char_defs::get_arr_len_for_type<2>() { return VC_TEST_ARR2_LEN; }
template<> template<> consteval std::size_t string_defs::get_arr_len_for_type<1>() { return VS_TEST_ARR1_LEN; }
template<> template<> consteval std::size_t string_defs::get_arr_len_for_type<2>() { return VS_TEST_ARR2_LEN; }
template<> template<> consteval std::size_t obj_defs::get_arr_len_for_type<1>() { return VO_TEST_ARR1_LEN; }
template<> template<> consteval std::size_t obj_defs::get_arr_len_for_type<2>() { return VO_TEST_ARR2_LEN; }
class test_const_vector : public test_defs {
public:
static consteval bool test_constructor_default() {
#pragma message("Testing default constructor")
constexpr cc::const_vector<int, TEST_VEC1_CAPACITY> vi1;
constexpr cc::const_vector<int, TEST_VEC2_CAPACITY> vi2;
ASSERT(vi1._len == TEST_VEC1_CAPACITY)
ASSERT(vi2._len == TEST_VEC2_CAPACITY)
ASSERT(vi1._size == 0)
ASSERT(vi2._size == 0)
ASSERT_ALL_VEC_EQ(vi1, int())
ASSERT_ALL_VEC_EQ(vi2, int())
constexpr cc::const_vector<char, TEST_VEC1_CAPACITY> vc1;
constexpr cc::const_vector<char, TEST_VEC2_CAPACITY> vc2;
@ -128,7 +170,7 @@ class test_const_vector {
ASSERT(vc2._size == 0)
ASSERT_ALL_VEC_EQ(vc1, char())
ASSERT_ALL_VEC_EQ(vc2, char())
constexpr cc::const_vector<const char *, TEST_VEC1_CAPACITY> vs1;
constexpr cc::const_vector<const char *, TEST_VEC2_CAPACITY> vs2;
@ -138,7 +180,7 @@ class test_const_vector {
ASSERT(vs1._size == 0)
ASSERT(vs2._size == 0)
constexpr cc::const_vector<TestStruct, TEST_VEC1_CAPACITY> vo1;
constexpr cc::const_vector<TestStruct, TEST_VEC2_CAPACITY> vo2;
@ -693,6 +735,184 @@ class test_const_vector {
return true;
}
static consteval bool test_operator_eq() {
#pragma message("Testing operator=")
#define DEFINE_APPLICATOR(type) DEFINE_APPLICATOR_EXT(type, type)
#define DEFINE_APPLICATOR_EXT(type_abbr, type) constexpr auto type_abbr##_applicator = []() consteval { \
constexpr auto& arr1 = type_abbr##_defs::get_arr_for_type<1>(); \
constexpr auto& arr2 = type_abbr##_defs::get_arr_for_type<2>(); \
constexpr auto arr1_len = type_abbr##_defs::get_arr_len_for_type<1>(); \
constexpr auto arr2_len = type_abbr##_defs::get_arr_len_for_type<2>(); \
cc::const_vector v1o(arr1); \
cc::const_vector v2o(arr2); \
\
struct { \
decltype(v1o) v1cs; \
decltype(v2o) v2cs; \
cc::const_vector<type, TEST_VEC1_CAPACITY> v1cd; \
cc::const_vector<type, TEST_VEC2_CAPACITY> v2cd; \
decltype(v1o) v1m; \
decltype(v2o) v2m; \
cc::const_vector<type, TEST_VEC1_CAPACITY> v1a; \
cc::const_vector<type, TEST_VEC2_CAPACITY> v2a; \
} ret; \
\
ret.v1cs = v1o; \
ret.v2cs = v2o; \
ret.v1cd = v1o; \
ret.v2cd = v2o; \
ret.v1m = const_cast<cc::const_vector<decltype(v1o)::value_type, decltype(v1o)::_len>&&>(v1o); \
ret.v2m = const_cast<cc::const_vector<decltype(v2o)::value_type, decltype(v2o)::_len>&&>(v2o); \
ret.v1a = arr1; \
ret.v2a = arr2; \
\
return ret; \
}
DEFINE_APPLICATOR(int);
DEFINE_APPLICATOR(char);
DEFINE_APPLICATOR_EXT(string, const char *);
DEFINE_APPLICATOR_EXT(obj, TestStruct);
/*auto int_applicator = []() consteval {
cc::const_vector vi1o(C_VI_TEST_ARR1);
cc::const_vector vi2o(C_VI_TEST_ARR2);
struct {
decltype(vi1o) vi1cs;
decltype(vi2o) vi2cs;
cc::const_vector<int, TEST_VEC1_CAPACITY> vi1cd;
cc::const_vector<int, TEST_VEC2_CAPACITY> vi2cd;
decltype(vi1o) vi1m;
decltype(vi2o) vi2m;
cc::const_vector<int, int_defs::get_arr_len_for_type<1>()> vi1a;
cc::const_vector<int, VI_TEST_ARR2_LEN> vi2a;
} ret;
ret.vi1cs = vi1o;
ret.vi2cs = vi2o;
ret.vi1cd = vi1o;
ret.vi2cd = vi2o;
ret.vi1m = vi1o;
ret.vi2m = vi2o;
ret.vi1a = C_VI_TEST_ARR1;
ret.vi2a = C_VI_TEST_ARR2;
return ret;
};*/
constexpr auto int_res = int_applicator();
constexpr auto char_res = char_applicator();
constexpr auto string_res = string_applicator();
constexpr auto obj_res = obj_applicator();
ASSERT(int_res.v1cs._len == VI_TEST_ARR1_LEN)
ASSERT(int_res.v2cs._len == VI_TEST_ARR2_LEN)
ASSERT(int_res.v1cs._size == VI_TEST_ARR1_LEN)
ASSERT(int_res.v2cs._size == VI_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(int_res.v1cs, C_VI_TEST_ARR1)
ASSERT_VEC_ARR_EQ(int_res.v2cs, C_VI_TEST_ARR2)
ASSERT(int_res.v1cd._len == TEST_VEC1_CAPACITY)
ASSERT(int_res.v2cd._len == TEST_VEC2_CAPACITY)
ASSERT(int_res.v1cd._size == VI_TEST_ARR1_LEN)
ASSERT(int_res.v2cd._size == VI_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(int_res.v1cd, C_VI_TEST_ARR1)
ASSERT_VEC_ARR_EQ(int_res.v2cd, C_VI_TEST_ARR2)
ASSERT(int_res.v1m._len == VI_TEST_ARR1_LEN)
ASSERT(int_res.v2m._len == VI_TEST_ARR2_LEN)
ASSERT(int_res.v1m._size == VI_TEST_ARR1_LEN)
ASSERT(int_res.v2m._size == VI_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(int_res.v1m, C_VI_TEST_ARR1)
ASSERT_VEC_ARR_EQ(int_res.v2m, C_VI_TEST_ARR2)
ASSERT(int_res.v1a._len == TEST_VEC1_CAPACITY)
ASSERT(int_res.v2a._len == TEST_VEC2_CAPACITY)
ASSERT(int_res.v1a._size == VI_TEST_ARR1_LEN)
ASSERT(int_res.v2a._size == VI_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(int_res.v1a, C_VI_TEST_ARR1)
ASSERT_VEC_ARR_EQ(int_res.v2a, C_VI_TEST_ARR2)
ASSERT(char_res.v1cs._len == VC_TEST_ARR1_LEN)
ASSERT(char_res.v2cs._len == VC_TEST_ARR2_LEN)
ASSERT(char_res.v1cs._size == VC_TEST_ARR1_LEN)
ASSERT(char_res.v2cs._size == VC_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(char_res.v1cs, C_VC_TEST_ARR1)
ASSERT_VEC_ARR_EQ(char_res.v2cs, C_VC_TEST_ARR2)
ASSERT(char_res.v1cd._len == TEST_VEC1_CAPACITY)
ASSERT(char_res.v2cd._len == TEST_VEC2_CAPACITY)
ASSERT(char_res.v1cd._size == VC_TEST_ARR1_LEN)
ASSERT(char_res.v2cd._size == VC_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(char_res.v1cd, C_VC_TEST_ARR1)
ASSERT_VEC_ARR_EQ(char_res.v2cd, C_VC_TEST_ARR2)
ASSERT(char_res.v1m._len == VC_TEST_ARR1_LEN)
ASSERT(char_res.v2m._len == VC_TEST_ARR2_LEN)
ASSERT(char_res.v1m._size == VC_TEST_ARR1_LEN)
ASSERT(char_res.v2m._size == VC_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(char_res.v1m, C_VC_TEST_ARR1)
ASSERT_VEC_ARR_EQ(char_res.v2m, C_VC_TEST_ARR2)
ASSERT(char_res.v1a._len == TEST_VEC1_CAPACITY)
ASSERT(char_res.v2a._len == TEST_VEC2_CAPACITY)
ASSERT(char_res.v1a._size == VC_TEST_ARR1_LEN)
ASSERT(char_res.v2a._size == VC_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(char_res.v1a, C_VC_TEST_ARR1)
ASSERT_VEC_ARR_EQ(char_res.v2a, C_VC_TEST_ARR2)
ASSERT(string_res.v1cs._len == VS_TEST_ARR1_LEN)
ASSERT(string_res.v2cs._len == VS_TEST_ARR2_LEN)
ASSERT(string_res.v1cs._size == VS_TEST_ARR1_LEN)
ASSERT(string_res.v2cs._size == VS_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(string_res.v1cs, C_VS_TEST_ARR1)
ASSERT_VEC_ARR_EQ(string_res.v2cs, C_VS_TEST_ARR2)
ASSERT(string_res.v1cd._len == TEST_VEC1_CAPACITY)
ASSERT(string_res.v2cd._len == TEST_VEC2_CAPACITY)
ASSERT(string_res.v1cd._size == VS_TEST_ARR1_LEN)
ASSERT(string_res.v2cd._size == VS_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(string_res.v1cd, C_VS_TEST_ARR1)
ASSERT_VEC_ARR_EQ(string_res.v2cd, C_VS_TEST_ARR2)
ASSERT(string_res.v1m._len == VS_TEST_ARR1_LEN)
ASSERT(string_res.v2m._len == VS_TEST_ARR2_LEN)
ASSERT(string_res.v1m._size == VS_TEST_ARR1_LEN)
ASSERT(string_res.v2m._size == VS_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(string_res.v1m, C_VS_TEST_ARR1)
ASSERT_VEC_ARR_EQ(string_res.v2m, C_VS_TEST_ARR2)
ASSERT(string_res.v1a._len == TEST_VEC1_CAPACITY)
ASSERT(string_res.v2a._len == TEST_VEC2_CAPACITY)
ASSERT(string_res.v1a._size == VS_TEST_ARR1_LEN)
ASSERT(string_res.v2a._size == VS_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(string_res.v1a, C_VS_TEST_ARR1)
ASSERT_VEC_ARR_EQ(string_res.v2a, C_VS_TEST_ARR2)
ASSERT(obj_res.v1cs._len == VO_TEST_ARR1_LEN)
ASSERT(obj_res.v2cs._len == VO_TEST_ARR2_LEN)
ASSERT(obj_res.v1cs._size == VO_TEST_ARR1_LEN)
ASSERT(obj_res.v2cs._size == VO_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(obj_res.v1cs, C_VO_TEST_ARR1)
ASSERT_VEC_ARR_EQ(obj_res.v2cs, C_VO_TEST_ARR2)
ASSERT(obj_res.v1cd._len == TEST_VEC1_CAPACITY)
ASSERT(obj_res.v2cd._len == TEST_VEC2_CAPACITY)
ASSERT(obj_res.v1cd._size == VO_TEST_ARR1_LEN)
ASSERT(obj_res.v2cd._size == VO_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(obj_res.v1cd, C_VO_TEST_ARR1)
ASSERT_VEC_ARR_EQ(obj_res.v2cd, C_VO_TEST_ARR2)
ASSERT(obj_res.v1m._len == VO_TEST_ARR1_LEN)
ASSERT(obj_res.v2m._len == VO_TEST_ARR2_LEN)
ASSERT(obj_res.v1m._size == VO_TEST_ARR1_LEN)
ASSERT(obj_res.v2m._size == VO_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(obj_res.v1m, C_VO_TEST_ARR1)
ASSERT_VEC_ARR_EQ(obj_res.v2m, C_VO_TEST_ARR2)
ASSERT(obj_res.v1a._len == TEST_VEC1_CAPACITY)
ASSERT(obj_res.v2a._len == TEST_VEC2_CAPACITY)
ASSERT(obj_res.v1a._size == VO_TEST_ARR1_LEN)
ASSERT(obj_res.v2a._size == VO_TEST_ARR2_LEN)
ASSERT_VEC_ARR_EQ(obj_res.v1a, C_VO_TEST_ARR1)
ASSERT_VEC_ARR_EQ(obj_res.v2a, C_VO_TEST_ARR2)
return true;
}
};
@ -709,7 +929,8 @@ int main(int, char *[])
std::cout << "Test of constructor 'const_vector(InputIt first, InputIt last)': " << test_const_vector::test_constructor_iterator() << std::endl;
std::cout << "Test of copy constructors: " << test_const_vector::test_constructor_copy() << std::endl;
std::cout << "Test of move constructor: " << test_const_vector::test_constructor_move() << std::endl;
std::cout << "Test of move constructor: " << test_const_vector::test_operator_eq() << std::endl;
return 0;
}