#include "boost/test/unit_test.hpp"
#include "cetlib/maybe_ref.h"
Go to the source code of this file.
#define BOOST_TEST_MODULE (maybe_ref test) |
BOOST_AUTO_TEST_CASE |
( |
default_behavior |
| ) |
|
Definition at line 8 of file maybe_ref_test.cc.
14 BOOST_TEST(
m.isValid());
15 BOOST_TEST(
m.ref() == 16);
19 T
const& r2 =
m.ref();
20 BOOST_TEST(
m.ref() == 16);
22 BOOST_TEST(&r2 == &x);
28 BOOST_CHECK_THROW(m.
ref(), std::logic_error);
BOOST_AUTO_TEST_CASE |
( |
copy_behavior |
| ) |
|
Definition at line 32 of file maybe_ref_test.cc.
38 BOOST_TEST(
m.isValid());
39 BOOST_TEST(
m.ref() == 16u);
41 BOOST_TEST(m2.isValid());
42 BOOST_TEST(m2.ref() == 16u);
48 BOOST_TEST(
m.isValid());
49 BOOST_TEST(
m.ref() == 16);
51 BOOST_TEST(!m2.isValid());
53 BOOST_TEST(m2.isValid());
54 BOOST_TEST(m2.ref() == 16);
static constexpr double m2
BOOST_AUTO_TEST_CASE |
( |
const_behavior |
| ) |
|
BOOST_AUTO_TEST_CASE |
( |
reseat_behavior |
| ) |
|
Definition at line 71 of file maybe_ref_test.cc.
78 BOOST_TEST(
m.isValid());
79 BOOST_TEST(
m.ref() == 16);
80 BOOST_TEST(&
m.ref() == &
x);
82 BOOST_TEST(!
m.isValid());
84 BOOST_TEST(
m.isValid());
85 BOOST_TEST(
m.ref() == 48);
86 BOOST_TEST(&
m.ref() == &
y);