Macros | Functions
GlobalSignal_t.cc File Reference
#include "boost/test/tools/output_test_stream.hpp"
#include "boost/test/unit_test.hpp"
#include "art/Framework/Services/Registry/GlobalSignal.h"
#include <ostream>
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (GlobalSignal_t)
 

Functions

 BOOST_AUTO_TEST_CASE (TestSignal2_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal2a_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal2_func_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal2_cfunc_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal1_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal0_t)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (GlobalSignal_t)

Definition at line 1 of file GlobalSignal_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( TestSignal2_t  )

Definition at line 48 of file GlobalSignal_t.cc.

49 {
50  TestSignal2 s;
51  std::string const test_text{"Test text.\n"};
52  boost::test_tools::output_test_stream os;
53  s.watch(testCallback<1>);
54  s.watch(testCallback<2>);
55  s.watch(testCallback<3>);
56  std::string const cmp_text{std::string("1: ") + test_text +
57  "2: " + test_text + "3: " + test_text};
58  BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
59  BOOST_TEST(os.is_equal(cmp_text));
60 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal2a_t  )

Definition at line 62 of file GlobalSignal_t.cc.

63 {
64  TestSignal2a s;
65  std::string const test_text{"Test text.\n"};
66  boost::test_tools::output_test_stream os;
67  s.watch(testCallback<1>);
68  s.watch(testCallback<2>);
69  s.watch(testCallback<3>);
70  std::string const cmp_text{std::string("3: ") + test_text +
71  "2: " + test_text + "1: " + test_text};
72  BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
73  BOOST_TEST(os.is_equal(cmp_text));
74 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal2_func_t  )

Definition at line 76 of file GlobalSignal_t.cc.

77 {
78  TestSignal2 s;
79  std::string const test_text{"Test text"};
80  boost::test_tools::output_test_stream os;
81  CallBackClass cbc;
82  s.watch(&CallBackClass::func, cbc);
83  BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
84  BOOST_TEST(os.is_equal(test_text));
85 }
std::string string
Definition: nybbler.cc:12
def func()
Definition: docstring.py:7
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal2_cfunc_t  )

Definition at line 87 of file GlobalSignal_t.cc.

88 {
89  TestSignal2 s;
90  std::string const test_text{"Test text"};
91  boost::test_tools::output_test_stream os;
92  CallBackClass const cbc;
93  s.watch(&CallBackClass::cfunc, cbc);
94  BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
95  BOOST_TEST(os.is_equal(test_text));
96 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal1_t  )

Definition at line 98 of file GlobalSignal_t.cc.

99 {
100  TestSignal1 s;
101  std::string const test_text{"Test text"};
102  boost::test_tools::output_test_stream os;
103  s.watch([&test_text](auto& x) { testCallback<0>(x, test_text); });
104  BOOST_CHECK_NO_THROW(s.invoke(os));
105  BOOST_TEST(os.is_equal(test_text));
106 }
std::string string
Definition: nybbler.cc:12
list x
Definition: train.py:276
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal0_t  )

Definition at line 108 of file GlobalSignal_t.cc.

109 {
110  TestSignal0 s;
111  std::string const test_text{"Test text"};
112  boost::test_tools::output_test_stream os;
113  // 2012/02/13 CG This explicit reference to base clase below is
114  // necessary because std::ref(os) fails due to a private typedef
115  // output_test_stream::result_type (in Boost <=1.53.0 at least)
116  // screwing up std::ref's attempt to determine whether
117  // output_test_stream is a callable entity.
118  std::ostringstream& osr [[maybe_unused]]{os};
119  s.watch([&osr, &test_text] { testCallback<0>(osr, test_text); });
120  BOOST_CHECK_NO_THROW(s.invoke());
121  BOOST_TEST(os.is_equal(test_text));
122 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042