Belle II Software  release-08-01-10
SVDModeByte.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <svd/dataobjects/SVDModeByte.h>
9 #include <gtest/gtest.h>
10 #include <string>
11 #include <cstdint>
12 
13 using namespace std;
14 
15 namespace Belle2 {
20  namespace SVD {
21 
23  TEST(SVDModeByte, Constructor)
24  {
25  // Default construct
26  SVDModeByte s0;
27  SVDModeByte s_def(151);
28  SVDModeByte s_en(SVDRunType::zero_suppressed, SVDEventType::global_run,
29  SVDDAQModeType::daq_6samples, uint8_t(7));
30  SVDModeByte s_num(2, 0, 2, 7);
31 
32  EXPECT_EQ(s0, s_def);
33  EXPECT_EQ(s_def, s_en);
34  EXPECT_EQ(s_en, s_num);
35  // Empty
36  EXPECT_EQ(uint8_t(151), s0.getID());
37  EXPECT_EQ((string)s0, "0-suppr/global/6 samples/???");
38  // Malformed
39  s0.setTriggerBin(3);
40  EXPECT_EQ((string)s0, "0-suppr/global/6 samples/3");
41  s0.setDAQMode(1);
42  EXPECT_EQ((string)s0, "0-suppr/global/3 samples/3");
43  }
44 
46  TEST(SVDModeByte, getters)
47  {
48  // Construct
49  SVDModeByte s(3, 1, 1, 3);
50  EXPECT_EQ(s.getTriggerBin(), 3);
51  EXPECT_EQ(s.getDAQMode(), SVDDAQModeType::daq_3samples);
52  EXPECT_EQ(s.getEventType(), SVDEventType::local_run);
53  EXPECT_EQ(s.getRunType(), SVDRunType::zero_suppressed_timefit);
54  // Default
55  SVDModeByte s0;
56  EXPECT_EQ(s0.getTriggerBin(), 7);
57  EXPECT_EQ(s0.getDAQMode(), SVDDAQModeType::daq_6samples);
58  }
59  }
61 } // Belle2::SVD namespace
Class to store SVD mode information.
Definition: SVDModeByte.h:69
void setTriggerBin(baseType triggerBin)
Set the triggerBin id.
Definition: SVDModeByte.h:169
baseType getID() const
Get the unique id.
Definition: SVDModeByte.h:138
void setDAQMode(baseType daqMode)
Set the daqMode id.
Definition: SVDModeByte.h:172
baseType getTriggerBin() const
Get the triggerBin id.
Definition: SVDModeByte.h:140
baseType getDAQMode() const
Get the daqMode id.
Definition: SVDModeByte.h:142
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Abstract base class for different kinds of events.