This is a follow-up question for std::array and std::vector Type Arbitrary Nested Iterable Generator Functions Implementation in C++ and std::deque and std::list Type Arbitrary Nested Iterable Generator Functions Implementation in C++. The only thing different in the previous implemented n_dim_vector_generator
, n_dim_array_generator
, n_dim_deque_generator
and n_dim_list_generator
functions is the type of container. After checking G. Sliepen's answer in the question Non-nested std::deque and std::list Generator Function for arithmetic_mean Function Testing in C++, I found that there is a way to implement a more generic template function n_dim_container_generator
.
The usage description
For example, auto test_vector = n_dim_container_generator<std::vector, 2, 3, int>(1);
is expected to create a "test_vector" object which type is std::vector<std::vector<int>>
. The content of this test_vector
should as same as the following code.
std::vector<int> vector1;
vector1.push_back(1);
vector1.push_back(1);
vector1.push_back(1);
std::vector<std::vector<int>> test_vector;
test_vector.push_back(vector1);
test_vector.push_back(vector1);
test_vector.push_back(vector1);
There are five key parameters in the usage of n_dim_container_generator
. With the mentioned example above, the first one std::vector
is the type of the container in output structure, the second one 2
represents the nested layers, the third parameter 3
represents the element count in each layer, the fourth parameter int
represents the type of base elements and the final one 1
represents the base element input which would be filled in.
The experimental implementation
The experimental implementation of n_dim_container_generator
template function is as follows.
template<template<class...> class Container = std::vector, std::size_t dim, std::size_t times, class T>
constexpr auto n_dim_container_generator(T input)
{
if constexpr (dim == 0)
{
return input;
}
else
{
Container<decltype(n_dim_container_generator<Container, dim - 1, times, T>(input))> output;
output.resize(times);
std::fill(std::begin(output), std::end(output), n_dim_container_generator<Container, dim - 1, times, T>(input));
return output;
}
}
Test cases
With the recursive_print
template function (refer to the previous question A recursive_print Function For Various Type Arbitrary Nested Iterable Implementation in C++), the n_dim_container_generator
template function could be tested as the following code.
auto test_vector = n_dim_container_generator<std::vector, 2, 3, int>(1);
recursive_print(test_vector);
The output is as below.
Level 0:
Level 1:
1
1
1
Level 1:
1
1
1
Level 1:
1
1
1
In order to make sure the functionality of n_dim_container_generator
, the various test cases have been implemented.
- The use cases of
std::vector
With Boost.Test tool, the various use cases of nested std::vector
structure are implemented as below.
BOOST_AUTO_TEST_CASE(vector_test_1dimension_char)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_int)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_short)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_long)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_long_long_int)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_unsigned_char)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_float)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_double)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_1dimension_long_double)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_char)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_int)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_short)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_long)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_long_long_int)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_unsigned_char)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_float)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_double)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_2dimension_long_double)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_char)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_int)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_short)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_long)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_long_long_int)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_unsigned_char)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_float)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_double)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_3dimension_long_double)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_char)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_int)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_short)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_long)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_long_long_int)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_unsigned_char)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_float)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_double)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_4dimension_long_double)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_char)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_int)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_short)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_long)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_long_long_int)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_unsigned_char)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_float)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_double)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_5dimension_long_double)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_char)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_int)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_short)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_long)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_long_long_int)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_unsigned_char)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_float)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_double)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_6dimension_long_double)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_char)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_int)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_short)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_long)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_long_long_int)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_unsigned_char)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_float)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_double)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_7dimension_long_double)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_char)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_int)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_short)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_long)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_long_long_int)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_unsigned_char)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_float)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_double)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_8dimension_long_double)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_char)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_int)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_short)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_long)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_long_long_int)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_unsigned_char)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_float)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_double)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(vector_test_9dimension_long_double)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
A Godbolt link (std::vector
part) is here.
Note: The compiling output from Godbolt is <Compilation failed>
and the error messages are Killed - processing time exceeded
and virtual memory exhausted: Cannot allocate memory
. This issue seems to be caused by Boost.Test tool is too large and the multidimensional container structure is too complex. If the enough memory and compile time resource is available, the test output is like:
Running 90 test cases...
*** No errors detected
- The use cases of
std::deque
andstd::list
When it comes to the cases of std::deque
and std::list
, the test code can get based on the above code by replacing the keyword vector
into deque
and list
. The result can be checked as follows.
BOOST_AUTO_TEST_CASE(deque_test_1dimension_char)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_int)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_short)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_long)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_long_long_int)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_unsigned_char)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_float)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_double)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(deque_test_1dimension_long_double)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_char)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_int)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_short)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef short TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_long)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_long_long_int)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long long int TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_unsigned_char)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef unsigned char TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_float)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef float TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_double)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE(list_test_1dimension_long_double)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef long double TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
Furthermore, with Test case template with automated registration, the various element type can be listed in boost::mpl::list
and the test cases can be generated automatically.
typedef boost::mpl::list<char, int, short, long, long long int, unsigned char, unsigned int, unsigned short int, unsigned long int, float, double, long double> test_types;
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_1dimension, T, test_types)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_2dimension, T, test_types)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_3dimension, T, test_types)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_4dimension, T, test_types)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_5dimension, T, test_types)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_6dimension, T, test_types)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_7dimension, T, test_types)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_8dimension, T, test_types)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_9dimension, T, test_types)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(vector_test_10dimension, T, test_types)
{
constexpr int nested_layer = 10;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::vector, nested_layer, element_count, TestType>(input)) ==
(n_dim_vector_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_1dimension, T, test_types)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_2dimension, T, test_types)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_3dimension, T, test_types)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_4dimension, T, test_types)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_5dimension, T, test_types)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_6dimension, T, test_types)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_7dimension, T, test_types)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_8dimension, T, test_types)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_9dimension, T, test_types)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(deque_test_10dimension, T, test_types)
{
constexpr int nested_layer = 10;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::deque, nested_layer, element_count, TestType>(input)) ==
(n_dim_deque_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_1dimension, T, test_types)
{
constexpr int nested_layer = 1;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_2dimension, T, test_types)
{
constexpr int nested_layer = 2;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_3dimension, T, test_types)
{
constexpr int nested_layer = 3;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_4dimension, T, test_types)
{
constexpr int nested_layer = 4;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_5dimension, T, test_types)
{
constexpr int nested_layer = 5;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_6dimension, T, test_types)
{
constexpr int nested_layer = 6;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_7dimension, T, test_types)
{
constexpr int nested_layer = 7;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_8dimension, T, test_types)
{
constexpr int nested_layer = 8;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_9dimension, T, test_types)
{
constexpr int nested_layer = 9;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(list_test_10dimension, T, test_types)
{
constexpr int nested_layer = 10;
constexpr int element_count = 3;
typedef T TestType;
TestType input = 1;
BOOST_TEST((n_dim_container_generator<std::list, nested_layer, element_count, TestType>(input)) ==
(n_dim_list_generator<nested_layer, TestType>(input, element_count)));
BOOST_TEST(true);
}
All suggestions are welcome.
The summary information:
Which question it is a follow-up to?
std::array and std::vector Type Arbitrary Nested Iterable Generator Functions Implementation in C++ and
std::deque and std::list Type Arbitrary Nested Iterable Generator Functions Implementation in C++
What changes has been made in the code since last question?
I am trying to implement a
n_dim_container_generator
function which can generate various container type arbitrary nested iterables in this question.Why a new review is being asked for?
Although there are a lot of test cases above, I still think that it is hard to verify
n_dim_container_generator
template function. There are too many possible usages and if there is any potential defect existed, please let me know.