14 #define BOOST_TEST_MODULE ( values_test ) 15 #include <boost/test/unit_test.hpp> 29 constexpr std::size_t
N = 7U;
31 std::vector<float>
data(N);
32 std::iota(data.begin(), data.end(), 0.0F);
38 static_assert(std::is_same_v<
40 std::add_lvalue_reference_t<std::vector<float>>
51 BOOST_TEST(
value == data[i]);
52 BOOST_TEST(std::addressof(
value) == std::addressof(data[i]));
55 BOOST_TEST(i == data.size());
64 BOOST_TEST(
value == data[i]);
65 BOOST_TEST(std::addressof(
value) == std::addressof(data[i]));
68 BOOST_TEST(i == data.size());
77 constexpr std::size_t
N = 7U;
79 std::vector<float>
data(N);
80 std::iota(data.begin(), data.end(), 0.0F);
86 static_assert(std::is_same_v<
88 std::add_lvalue_reference_t<std::vector<float>
const>
98 static_assert(std::is_const_v<std::remove_reference_t<decltype(
value)>>);
99 BOOST_TEST(
value == data[i]);
100 BOOST_TEST(std::addressof(
value) == std::addressof(data[i]));
103 BOOST_TEST(i == data.size());
109 template<
template <
typename Key,
typename Value,
typename... Args>
typename Map>
113 constexpr std::size_t
N = 7U;
114 constexpr
double factor = 5.0;
116 std::vector<int>
keys(N);
117 std::iota(keys.begin(), keys.end(), 0U);
118 Map<int, float>
data;
119 for (
int key: keys) data.emplace(
key,
key * factor);
123 static_assert(std::is_same_v<decltype(
value),
float&>);
124 BOOST_TEST(
value == data[i]);
125 BOOST_TEST(std::addressof(
value) == std::addressof(data[i]));
128 BOOST_TEST(i == data.size());
134 template<
template <
typename Key,
typename Value,
typename... Args>
typename Map>
138 constexpr std::size_t
N = 7U;
139 constexpr
double factor = 5.0;
141 std::vector<int>
keys(N);
142 std::iota(keys.begin(), keys.end(), 0U);
143 Map<int, float>
data;
144 for (
int key: keys) data.emplace(
key,
key * factor);
148 static_assert(std::is_same_v<decltype(
value),
float const&>);
149 BOOST_TEST(
value == data[i]);
150 BOOST_TEST(std::addressof(
value) == std::addressof(data[i]));
153 BOOST_TEST(i == data.size());
173 std::map<int, float>
data { { 1, 4.0F }, { 3, 12.0F }, { 2, 8.0F } };
174 std::vector<float>
values;
177 values.push_back(
value);
180 BOOST_TEST(values.size() == 3U);
181 BOOST_TEST(values[0] == 4.0F);
182 BOOST_TEST(values[1] == 8.0F);
183 BOOST_TEST(values[2] == 12.0F);
195 test_values_map<std::map>();
196 test_const_values_map<std::map>();
decltype(auto) const_values(Coll &&coll)
Range-for loop helper iterating across the constant values of the specified collection.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
void test_values_documentation()
Definition of util::values() and util::const_values().
BOOST_AUTO_TEST_CASE(bool_values)
void test_const_values_map()