Macros | Functions
LocalSignal_t.cc File Reference
#include "boost/test/tools/output_test_stream.hpp"
#include "boost/test/unit_test.hpp"
#include "art/Framework/Services/Registry/LocalSignal.h"
#include "art/Utilities/ScheduleID.h"
#include <ostream>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (LocalSignal_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)
 
 BOOST_AUTO_TEST_CASE (TestSignal1_All_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal2_All_t)
 
 BOOST_AUTO_TEST_CASE (TestSignal0_All_t)
 
 BOOST_AUTO_TEST_CASE (watchFail)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (LocalSignal_t)

Definition at line 1 of file LocalSignal_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( TestSignal2_t  )

Definition at line 53 of file LocalSignal_t.cc.

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

Definition at line 67 of file LocalSignal_t.cc.

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

Definition at line 81 of file LocalSignal_t.cc.

82 {
83  TestSignal2 s{nSchedules};
84  std::string const test_text{"Test text"};
85  boost::test_tools::output_test_stream os;
86  CallBackClass cbc;
87  BOOST_CHECK_NO_THROW(s.watch(sID, &CallBackClass::func, cbc));
88  BOOST_CHECK_NO_THROW(s.invoke(sID, os, test_text));
89  BOOST_TEST(os.is_equal(test_text));
90 }
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 92 of file LocalSignal_t.cc.

93 {
94  TestSignal2 s{nSchedules};
95  std::string const test_text{"Test text"};
96  boost::test_tools::output_test_stream os;
97  CallBackClass const cbc;
98  BOOST_CHECK_NO_THROW(s.watch(sID, &CallBackClass::cfunc, cbc));
99  BOOST_CHECK_NO_THROW(s.invoke(sID, os, test_text));
100  BOOST_TEST(os.is_equal(test_text));
101 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal1_t  )

Definition at line 103 of file LocalSignal_t.cc.

104 {
105  TestSignal1 s{nSchedules};
106  std::string const test_text{"Test text"};
107  boost::test_tools::output_test_stream os;
108  BOOST_CHECK_NO_THROW(
109  s.watch(sID, [&test_text](auto& x) { testCallback<0>(x, test_text); }));
110  BOOST_CHECK_NO_THROW(s.invoke(sID, os));
111  BOOST_TEST(os.is_equal(test_text));
112 }
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 114 of file LocalSignal_t.cc.

115 {
116  TestSignal0 s{nSchedules};
117  std::string const test_text{"Test text"};
118  boost::test_tools::output_test_stream os;
119  BOOST_CHECK_NO_THROW(
120  s.watch(sID, [&os, &test_text] { testCallback<0>(os, test_text); }));
121  BOOST_CHECK_NO_THROW(s.invoke(sID));
122  BOOST_TEST(os.is_equal(test_text));
123 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal1_All_t  )

Definition at line 125 of file LocalSignal_t.cc.

126 {
127  TestSignal1 s{nSchedules};
128  std::string const test_text{"Test text"};
129  boost::test_tools::output_test_stream os;
130  BOOST_CHECK_NO_THROW(
131  s.watchAll([&test_text](auto& x) { testCallback<0>(x, test_text); }));
132  BOOST_CHECK_NO_THROW(s.invoke(sID, os));
133  BOOST_TEST(os.is_equal(test_text));
134 }
std::string string
Definition: nybbler.cc:12
list x
Definition: train.py:276
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal2_All_t  )

Definition at line 136 of file LocalSignal_t.cc.

137 {
138  TestSignal2 s{nSchedules};
139  std::string const test_text{"Test text"};
140  boost::test_tools::output_test_stream os;
141  BOOST_CHECK_NO_THROW(s.watchAll(testCallback<0>));
142  BOOST_CHECK_NO_THROW(s.invoke(sID, os, test_text));
143  BOOST_TEST(os.is_equal(test_text));
144 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( TestSignal0_All_t  )

Definition at line 146 of file LocalSignal_t.cc.

147 {
148  TestSignal0 s{nSchedules};
149  std::string const test_text{"Test text"};
150  boost::test_tools::output_test_stream os;
151  BOOST_CHECK_NO_THROW(
152  s.watchAll([&os, &test_text] { testCallback<0>(os, test_text); }));
153  BOOST_CHECK_NO_THROW(s.invoke(sID));
154  BOOST_TEST(os.is_equal(test_text));
155 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( watchFail  )

Definition at line 157 of file LocalSignal_t.cc.

158 {
159  TestSignal0 s{nSchedules};
160  std::string const test_text{"Test text"};
161  boost::test_tools::output_test_stream os;
162  BOOST_CHECK_THROW(
163  (s.watch(art::ScheduleID{4},
164  [&os, &test_text] { testCallback<0>(os, test_text); })),
165  std::out_of_range);
166 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042