15#define BOOST_TEST_MODULE Test MCHRaw bitset
16#define BOOST_TEST_MAIN
17#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
23#include <fmt/format.h>
29BOOST_AUTO_TEST_SUITE(o2_mch_raw)
31BOOST_AUTO_TEST_SUITE(bitset)
89 BOOST_CHECK_THROW(bs.
set(-1,
true), std::invalid_argument);
100 BOOST_CHECK_THROW(bs.
get(100), std::out_of_range);
123 BOOST_CHECK_THROW(
BitSet(
"00011x"), std::invalid_argument);
138 BOOST_CHECK_THROW(
BitSet(
"abcd"), std::invalid_argument);
145 std::string
s =
"1111100011111100111111001111111101111111001111110001111100001111";
173 bs.setRangeFromUint(12, 14,
static_cast<uint16_t>(0));
182 bs.setRangeFromUint(28, 30,
static_cast<uint32_t>(0));
191 bs.setRangeFromUint(60, 62,
static_cast<uint64_t>(0));
209 std::vector<uint8_t>
bytes = {0xfe, 0x5a, 0x1e, 0xda};
242 uint64_t v = UINT64_C(0xFFFFFFFFFFFFFFFF);
277 BitSet bs(
"1010110101111");
296 for (
int i = 0;
i <
n;
i++) {
297 if (
i > 0 &&
i % 10 == 0) {
306 std::reverse(begin(line1),
end(line1));
307 std::reverse(begin(line2),
end(line2));
309 std::string spaces(nspaces,
' ');
313 rv = spaces + line1 +
"\n";
315 rv += spaces + line2;
322 auto C = UINT32_C(0XDA1E5AFE);
339 auto C = UINT64_C(0x1555540f00113);
355 for (
int i = 0;
i < 50;
i++) {
368 BOOST_CHECK_THROW(bs.
append(
a, 9), std::invalid_argument);
394 if (
s1.size() != s2.size()) {
395 std::cout <<
"sizes differ\n";
398 std::vector<int> dif;
400 for (
auto i = 0;
i <
s1.size();
i++) {
401 if (
s1[
i] != s2[
i]) {
406 std::cout <<
"indices of " << dif.size() <<
" differences:\n";
408 std::cout <<
d <<
" ";
416 std::string
expected =
"11010101010110010101011011100011000011101000010110010100101100010100001001100100110010110100000000111100110110101101101110001111010110010010000101101111101110101011011111100101101010111011011111000010011010000100111111001000011010100111101101011110110001010";
426 std::cout <<
"diff\n";
437 std::srand(std::time(
nullptr));
439 bool bit =
static_cast<bool>(
rand() % 2);
452 BOOST_CHECK_THROW(
BitSet bs(
static_cast<uint8_t>(123), 9), std::invalid_argument);
460 uint64_t syncValue = 0x1555540F00113;
462 BitSet sync(syncValue, 50);
475 BitSet expected(
"110010001000000000001111000000101010101010101010101100100010000000000011110000001010101010101010101011001000100000000000111100000010101010101010101010110010001000000000001111000000101010101010101");
480BOOST_AUTO_TEST_SUITE_END()
481BOOST_AUTO_TEST_SUITE_END()
unsigned short int uint16_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
uint8_t uint8(int a, int b) const
uint16_t uint16(int a, int b) const
uint64_t uint64(int a, int b) const
void setFromBytes(gsl::span< uint8_t > bytes)
std::string stringLSBLeft() const
void setRangeFromString(int a, int b, std::string_view s)
void setRangeFromUint(int a, int b, uint8_t v)
uint32_t uint32(int a, int b) const
BitSet subset(int a, int b) const
void set(int pos, bool val)
std::string stringLSBRight() const
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat v2
int circularAppend(BitSet &bs, const BitSet &ringBuffer, int startBit, int n)
BOOST_AUTO_TEST_CASE(FlatHisto)
std::string to_string(gsl::span< T, Size > span)
std::string bitNumberScale(int n, int nspaces, bool right2left)
void compare(std::string_view s1, std::string_view s2)
std::map< std::string, ID > expected
BOOST_CHECK_NO_THROW(algorithm::merge(target, other))
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())