Macros | Functions
event_start_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "art/Framework/Art/detail/event_start.h"
#include "canvas/Utilities/Exception.h"
#include <string_view>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (event start test)
 
#define VERIFY_EXCEPTION_WITH_MSG(spec)
 

Functions

 BOOST_AUTO_TEST_CASE (well_formed)
 
 BOOST_AUTO_TEST_CASE (well_formed_first_values)
 
 BOOST_AUTO_TEST_CASE (well_formed_max_valid_values)
 
 BOOST_AUTO_TEST_CASE (leading_and_trailing_spaces_allowed)
 
 BOOST_AUTO_TEST_CASE (out_of_range_run)
 
 BOOST_AUTO_TEST_CASE (out_of_range_subrun)
 
 BOOST_AUTO_TEST_CASE (out_of_range_event)
 
 BOOST_AUTO_TEST_CASE (wrong_number_of_colons)
 
 BOOST_AUTO_TEST_CASE (bad_fields)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (event start test)

Definition at line 1 of file event_start_t.cc.

#define VERIFY_EXCEPTION_WITH_MSG (   spec)
Value:
BOOST_CHECK_EXCEPTION(event_start(spec), art::Exception, [](auto const& e) { \
return invalid_event_id(e, spec); \
})
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
Definition: event_start.cc:72
const double e
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Definition at line 67 of file event_start_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( well_formed  )

Definition at line 24 of file event_start_t.cc.

25 {
26  auto const [r, sr, e] = event_start("1:2:3");
27  BOOST_TEST(r == 1u);
28  BOOST_TEST(sr == 2u);
29  BOOST_TEST(e == 3u);
30 }
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
Definition: event_start.cc:72
const double e
static constexpr double sr
Definition: Units.h:166
BOOST_AUTO_TEST_CASE ( well_formed_first_values  )

Definition at line 32 of file event_start_t.cc.

33 {
34  using std::to_string;
35  auto const r_first = art::IDNumber<art::Level::Run>::first();
36  auto const sr_first = art::IDNumber<art::Level::SubRun>::first();
37  auto const e_first = art::IDNumber<art::Level::Event>::first();
38  auto const [r, sr, e] = event_start(
39  to_string(r_first) + ':' + to_string(sr_first) + ':' + to_string(e_first));
40  BOOST_TEST(r == r_first);
41  BOOST_TEST(sr == sr_first);
42  BOOST_TEST(e == e_first);
43 }
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
Definition: event_start.cc:72
const double e
static constexpr double sr
Definition: Units.h:166
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
BOOST_AUTO_TEST_CASE ( well_formed_max_valid_values  )

Definition at line 45 of file event_start_t.cc.

46 {
47  using std::to_string;
48  auto const r_max_valid = art::IDNumber<art::Level::Run>::max_valid();
49  auto const sr_max_valid = art::IDNumber<art::Level::SubRun>::max_valid();
50  auto const e_max_valid = art::IDNumber<art::Level::Event>::max_valid();
51  auto const [r, sr, e] =
52  event_start(to_string(r_max_valid) + ':' + to_string(sr_max_valid) + ':' +
53  to_string(e_max_valid));
54  BOOST_TEST(r == r_max_valid);
55  BOOST_TEST(sr == sr_max_valid);
56  BOOST_TEST(e == e_max_valid);
57 }
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
Definition: event_start.cc:72
const double e
static constexpr double sr
Definition: Units.h:166
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
BOOST_AUTO_TEST_CASE ( leading_and_trailing_spaces_allowed  )

Definition at line 59 of file event_start_t.cc.

60 {
61  auto const [r, sr, e] = event_start(" 1:2 : 3");
62  BOOST_TEST(r == 1u);
63  BOOST_TEST(sr == 2u);
64  BOOST_TEST(e == 3u);
65 }
std::tuple< RunNumber_t, SubRunNumber_t, EventNumber_t > event_start(std::string const &str_num)
Definition: event_start.cc:72
const double e
static constexpr double sr
Definition: Units.h:166
BOOST_AUTO_TEST_CASE ( out_of_range_run  )

Definition at line 72 of file event_start_t.cc.

73 {
74  VERIFY_EXCEPTION_WITH_MSG("-1:0:0");
76  VERIFY_EXCEPTION_WITH_MSG("4294967295:0:0");
77 }
#define VERIFY_EXCEPTION_WITH_MSG(spec)
BOOST_AUTO_TEST_CASE ( out_of_range_subrun  )

Definition at line 79 of file event_start_t.cc.

80 {
81  VERIFY_EXCEPTION_WITH_MSG("1:-1:0");
82  VERIFY_EXCEPTION_WITH_MSG("1:4294967295:0");
83 }
#define VERIFY_EXCEPTION_WITH_MSG(spec)
BOOST_AUTO_TEST_CASE ( out_of_range_event  )

Definition at line 85 of file event_start_t.cc.

86 {
87  VERIFY_EXCEPTION_WITH_MSG("1:0:-1");
88  VERIFY_EXCEPTION_WITH_MSG("1:0:4294967295");
89 }
#define VERIFY_EXCEPTION_WITH_MSG(spec)
BOOST_AUTO_TEST_CASE ( wrong_number_of_colons  )

Definition at line 91 of file event_start_t.cc.

92 {
94  VERIFY_EXCEPTION_WITH_MSG("1:1:1:2");
95 }
#define VERIFY_EXCEPTION_WITH_MSG(spec)
BOOST_AUTO_TEST_CASE ( bad_fields  )

Definition at line 97 of file event_start_t.cc.

98 {
99  VERIFY_EXCEPTION_WITH_MSG("1: - 2:3");
101  VERIFY_EXCEPTION_WITH_MSG("1:hello billy:3");
102  VERIFY_EXCEPTION_WITH_MSG("1:2.8:3");
103 }
#define VERIFY_EXCEPTION_WITH_MSG(spec)