Classes | Macros | Functions
isValidLibraryData_test.cc File Reference

Unit test for phot::isValidLibraryData(). More...

#include "boost/test/unit_test.hpp"
#include "larsim/PhotonPropagation/LibraryMappingTools/OpDetVisibilityData.h"
#include <array>
#include <vector>
#include <memory>

Go to the source code of this file.

Classes

class  SizedContainer
 
struct  ContainerWith_size
 
struct  ContainerWith_empty
 
struct  ContainerWith_isValid
 
struct  ContainerWith_is_valid
 

Macros

#define BOOST_TEST_MODULE   ( isValidLibraryData_test )
 

Functions

void isValidLibraryData_test ()
 
 BOOST_AUTO_TEST_CASE (isValidLibraryData_TestCase)
 

Detailed Description

Unit test for phot::isValidLibraryData().

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
March 29, 2019
See also
larsim/PhotonPropagation/LibraryMappingTools/OpDetVisibilityData.h

Definition in file isValidLibraryData_test.cc.

Macro Definition Documentation

#define BOOST_TEST_MODULE   ( isValidLibraryData_test )

Definition at line 10 of file isValidLibraryData_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( isValidLibraryData_TestCase  )

Definition at line 126 of file isValidLibraryData_test.cc.

126  {
128 } // BOOST_AUTO_TEST_CASE(isValidLibraryData_TestCase)
void isValidLibraryData_test()
void isValidLibraryData_test ( )

Definition at line 61 of file isValidLibraryData_test.cc.

61  {
62 
63  std::vector<float> valid_vector(4U, 1.0);
64  std::vector<float> invalid_vector;
65 
66  std::array<float, 4U> valid_STLarray;
67  // all STL arrays are valid to us
68 
69  float valid_array[4U] = { 1.0, 2.0, 3.0, 4.0 };
70  // all C arrays are valid to us
71 
72  float const* valid_cptr = valid_array;
73  float const* invalid_cptr = nullptr;
74 
75  float const* const valid_cptrc = valid_array;
76  float const* const invalid_cptrc = nullptr;
77 
78  std::unique_ptr<float> valid_uptr { new float[4U] };
79  std::unique_ptr<float> invalid_uptr;
80 
81  ContainerWith_size valid_with_size { 4U };
82  ContainerWith_size invalid_with_size ;
83 
84  ContainerWith_empty valid_with_empty { 4U };
85  ContainerWith_empty invalid_with_empty ;
86 
87  ContainerWith_is_valid valid_with_is_valid{ 4U };
88  ContainerWith_is_valid invalid_with_is_valid;
89 
90  ContainerWith_isValid valid_with_isValid { 4U };
91  ContainerWith_isValid invalid_with_isValid ;
92 
93  BOOST_TEST( phot::isValidLibraryData( valid_vector));
94  BOOST_TEST(!phot::isValidLibraryData(invalid_vector));
95 
96  BOOST_TEST( phot::isValidLibraryData( valid_STLarray));
97 
98  BOOST_TEST( phot::isValidLibraryData( valid_array));
99 
100  BOOST_TEST( phot::isValidLibraryData( valid_cptr));
101  BOOST_TEST(!phot::isValidLibraryData(invalid_cptr));
102 
103  BOOST_TEST( phot::isValidLibraryData( valid_cptrc));
104  BOOST_TEST(!phot::isValidLibraryData(invalid_cptrc));
105 
106  BOOST_TEST( phot::isValidLibraryData( valid_uptr));
107  BOOST_TEST(!phot::isValidLibraryData(invalid_uptr));
108 
109  BOOST_TEST( phot::isValidLibraryData( valid_with_size ));
110  BOOST_TEST(!phot::isValidLibraryData(invalid_with_size ));
111 
112  BOOST_TEST( phot::isValidLibraryData( valid_with_empty ));
113  BOOST_TEST(!phot::isValidLibraryData(invalid_with_empty ));
114 
115  BOOST_TEST( phot::isValidLibraryData( valid_with_is_valid));
116  BOOST_TEST(!phot::isValidLibraryData(invalid_with_is_valid));
117 
118  BOOST_TEST( phot::isValidLibraryData( valid_with_isValid ));
119  BOOST_TEST(!phot::isValidLibraryData(invalid_with_isValid ));
120 
121 } // isValidLibraryData_test()
bool isValidLibraryData(Cont &&cont)
Returns the validity of content of library data in the container.