All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
PointCharge_test.cc File Reference

Simple test on a recob::PointCharge object. More...

#include "boost/test/unit_test.hpp"
#include "lardataobj/RecoBase/PointCharge.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   ( charge_test )
 

Functions

void CheckCharge (recob::PointCharge const &obj, bool hasCharge, recob::PointCharge::Charge_t charge)
 
void ChargeTestDefaultConstructor ()
 
void ChargeTestValueConstructors ()
 
 BOOST_AUTO_TEST_CASE (ChargeTestDefaultConstructor_testcase)
 
 BOOST_AUTO_TEST_CASE (ChargeTestValueConstructor_testcase)
 

Detailed Description

Simple test on a recob::PointCharge object.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
December 20, 2017
Version
1.0

This test simply creates recob::PointCharge objects and verifies that the values it can access are the right ones.

See http://www.boost.org/libs/test for the Boost test library home page.

Definition in file PointCharge_test.cc.

Macro Definition Documentation

#define BOOST_TEST_MODULE   ( charge_test )

Definition at line 17 of file PointCharge_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( ChargeTestDefaultConstructor_testcase  )

Definition at line 95 of file PointCharge_test.cc.

95  {
97 } // ChargeTestDefaultConstructor_testcase
void ChargeTestDefaultConstructor()
BOOST_AUTO_TEST_CASE ( ChargeTestValueConstructor_testcase  )

Definition at line 99 of file PointCharge_test.cc.

99  {
101 } // ChargeTestValueConstructor_testcase
void ChargeTestValueConstructors()
void ChargeTestDefaultConstructor ( )

Definition at line 50 of file PointCharge_test.cc.

50  {
51 
52  //
53  // Part I: initialization of inputs
54  //
55  // these are the values expected for a default-constructed wire
56  bool const hasCharge = false;
58 
59  //
60  // Part II: default constructor
61  //
62  // step II.1: create a charge with the default constructor
63  recob::PointCharge chargeInfo;
64 
65  // step II.2: verify that the values are as expected
66  CheckCharge(chargeInfo, hasCharge, charge);
67 
68 } // ChargeTestDefaultConstructor()
void CheckCharge(recob::PointCharge const &obj, bool hasCharge, recob::PointCharge::Charge_t charge)
static constexpr Charge_t InvalidCharge
Value used for default-constructed ("invalid") charge.
Definition: PointCharge.h:39
float Charge_t
Type for the amount of reconstructed charge.
Definition: PointCharge.h:35
Charge reconstructed in the active volume.
Definition: PointCharge.h:31
void ChargeTestValueConstructors ( )

Definition at line 71 of file PointCharge_test.cc.

71  {
72  //
73  // Part I: initialization of inputs
74  //
75  // these are the values expected for a value-constructed wire
76  bool const hasCharge = true;
77  recob::PointCharge::Charge_t const charge = 10.0;
78 
79  //
80  // Part II: default constructor
81  //
82  // step II.1: create a charge with the value constructor
83  recob::PointCharge chargeInfo(charge);
84 
85  // step II.2: verify that the values are as expected
86  CheckCharge(chargeInfo, hasCharge, charge);
87 
88 } // ChargeTestValueConstructors()
void CheckCharge(recob::PointCharge const &obj, bool hasCharge, recob::PointCharge::Charge_t charge)
float Charge_t
Type for the amount of reconstructed charge.
Definition: PointCharge.h:35
Charge reconstructed in the active volume.
Definition: PointCharge.h:31
void CheckCharge ( recob::PointCharge const &  obj,
bool  hasCharge,
recob::PointCharge::Charge_t  charge 
)

Definition at line 31 of file PointCharge_test.cc.

35  {
36 
37  // verify that the values are as expected
38  if (hasCharge) {
39  BOOST_TEST(obj.hasCharge());
40  BOOST_TEST(obj.charge() == charge);
41  }
42  else {
43  BOOST_TEST(!obj.hasCharge());
44  // charge() return value is undefined
45  }
46 
47 } // CheckCharge()