1 #define BOOST_TEST_MODULE (map_vector test) 2 #include "boost/test/unit_test.hpp" 6 #include <boost/test/tools/output_test_stream.hpp> 15 BOOST_AUTO_TEST_SUITE(map_vector_test)
30 boost::test_tools::output_test_stream
output;
36 BOOST_TEST(output.is_equal(
"3\n"));
58 BOOST_TEST(m.
empty());
59 BOOST_TEST(m.
size() == 0u);
60 BOOST_TEST(!m.
has(k));
62 BOOST_TEST(m.
find(k) == m.
end());
71 BOOST_TEST(m.
empty());
72 BOOST_TEST(m.
size() == 0u);
73 BOOST_TEST(!m.
has(k));
75 BOOST_TEST(m.
find(k) == m.
end());
91 value_t v(10 + k.
asInt());
93 BOOST_TEST(!m.empty());
94 BOOST_TEST(m.size() == ++sz);
95 BOOST_TEST(m.begin() != m.end());
97 BOOST_TEST(m.find(k)->second == v);
98 BOOST_TEST(*m.getOrNull(k) == v);
99 BOOST_TEST(m.getOrThrow(k) == v);
104 value_t v(10 + k.
asInt());
106 BOOST_TEST(!m.empty());
107 BOOST_TEST(m.size() == ++sz);
108 BOOST_TEST(m.begin() != m.end());
109 BOOST_TEST(m.has(k));
110 BOOST_TEST(m.find(k)->second == v);
111 BOOST_TEST(*m.getOrNull(k) == v);
112 BOOST_TEST(m.getOrThrow(k) == v);
117 value_t v(10 + k.
asInt());
119 BOOST_TEST(!m.empty());
120 BOOST_TEST(m.size() == ++sz);
121 BOOST_TEST(m.begin() != m.end());
122 BOOST_TEST(m.has(k));
123 BOOST_TEST(m.find(k)->second == v);
124 BOOST_TEST(*m.getOrNull(k) == v);
125 BOOST_TEST(m.getOrThrow(k) == v);
130 value_t v(10 + k.
asInt());
132 BOOST_TEST(!m.empty());
133 BOOST_TEST(m.size() == ++sz);
134 BOOST_TEST(m.begin() != m.end());
135 BOOST_TEST(m.has(k));
136 BOOST_TEST(m.find(k)->second == v);
137 BOOST_TEST(*m.getOrNull(k) == v);
138 BOOST_TEST(m.getOrThrow(k) == v);
144 BOOST_TEST(
m2.size() == sz);
147 BOOST_TEST(result.second);
154 BOOST_TEST(
m2.size() == sz);
157 BOOST_TEST(!result.second);
158 BOOST_TEST(result.first->second == 12);
163 BOOST_TEST(
m2.size() == m.
size());
170 m3.insert(
m2.begin(),
m2.end());
174 auto b = m.
begin(), b2 = m3.begin();
176 for (;
b !=
e; ++
b, ++b2) {
177 BOOST_TEST(
b->second == b2->second);
178 BOOST_TEST(
b->first.asInt() == b2->first.asInt());
185 auto const offset = m.
delta();
186 auto const old_size = m.
size();
189 m.
append(new_m.cbegin(), new_m.cend());
190 BOOST_TEST(m.
size() == old_size + new_m.size());
194 BOOST_AUTO_TEST_SUITE_END()
bool empty() const noexcept
BOOST_AUTO_TEST_CASE(key_test)
bool has(key_type key) const
iterator find(key_type key)
static constexpr double m2
void append(InIter b, InIter e)
value_type const & front() const
static constexpr double m3
iterator begin() noexcept
value_type const & back() const
auto for_all(FwdCont &, Func)
constexpr unsigned long asInt() const noexcept
mapped_type & getOrThrow(key_type key)
size_type size() const noexcept
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
cout_redirect(std::streambuf *new_buf)
mapped_type * getOrNull(key_type key)