Classes | Macros | Typedefs | Functions
ensurePointer_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "canvas/Utilities/ensurePointer.h"
#include <vector>

Go to the source code of this file.

Classes

class  A
 
class  B
 

Macros

#define BOOST_TEST_MODULE(ensurePointer_t)
 

Typedefs

typedef std::vector< Aavec_t
 
typedef std::vector< A * > apvec_t
 
typedef std::vector< A const * > acpvec_t
 
typedef std::vector< Bbvec_t
 
typedef std::vector< B * > bpvec_t
 
typedef std::vector< B const * > bcpvec_t
 
typedef std::vector< int > ivec_t
 
typedef std::vector< int * > ipvec_t
 
typedef std::vector< int const * > icpvec_t
 

Functions

 BOOST_AUTO_TEST_CASE (basic_types)
 
 BOOST_AUTO_TEST_CASE (a_pointer_from_a)
 
 BOOST_AUTO_TEST_CASE (a_pointer_from_a_pointer)
 
 BOOST_AUTO_TEST_CASE (a_pointer_from_b)
 
 BOOST_AUTO_TEST_CASE (a_pointer_from_b_pointer)
 
 BOOST_AUTO_TEST_CASE (b_pointer_from_a_pointer)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_const_a)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_const_a_pointer)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_const_b)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_const_b_pointer)
 
 BOOST_AUTO_TEST_CASE (const_b_pointer_from_const_a_pointer)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_a)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_a_pointer)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_b)
 
 BOOST_AUTO_TEST_CASE (const_a_pointer_from_b_pointer)
 
 BOOST_AUTO_TEST_CASE (const_b_pointer_from_a_pointer)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE (   ensurePointer_t)

Definition at line 1 of file ensurePointer_t.cc.

Typedef Documentation

typedef std::vector<A const*> acpvec_t

Definition at line 15 of file ensurePointer_t.cc.

typedef std::vector<A*> apvec_t

Definition at line 14 of file ensurePointer_t.cc.

typedef std::vector<A> avec_t

Definition at line 13 of file ensurePointer_t.cc.

typedef std::vector<B const*> bcpvec_t

Definition at line 18 of file ensurePointer_t.cc.

typedef std::vector<B*> bpvec_t

Definition at line 17 of file ensurePointer_t.cc.

typedef std::vector<B> bvec_t

Definition at line 16 of file ensurePointer_t.cc.

typedef std::vector<int const*> icpvec_t

Definition at line 21 of file ensurePointer_t.cc.

typedef std::vector<int*> ipvec_t

Definition at line 20 of file ensurePointer_t.cc.

typedef std::vector<int> ivec_t

Definition at line 19 of file ensurePointer_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( basic_types  )

Definition at line 26 of file ensurePointer_t.cc.

27 {
28  ivec_t i(1);
29  BOOST_CHECK_NO_THROW(art::ensurePointer<int*>(i.begin()));
30  ivec_t const ic(1);
31  BOOST_CHECK_NO_THROW(art::ensurePointer<int const*>(ic.begin()));
32  ipvec_t ip(1);
33  BOOST_CHECK_NO_THROW(art::ensurePointer<int*>(ip.begin()));
34  icpvec_t icp(1);
35  BOOST_CHECK_NO_THROW(art::ensurePointer<int const*>(icp.begin()));
36 }
std::vector< int const * > icpvec_t
std::vector< int > ivec_t
std::vector< int * > ipvec_t
BOOST_AUTO_TEST_CASE ( a_pointer_from_a  )

Definition at line 39 of file ensurePointer_t.cc.

40 {
41  avec_t a(1);
42  BOOST_CHECK_NO_THROW(art::ensurePointer<A*>(a.begin()));
43 }
std::vector< A > avec_t
const double a
BOOST_AUTO_TEST_CASE ( a_pointer_from_a_pointer  )

Definition at line 45 of file ensurePointer_t.cc.

46 {
47  apvec_t a(1);
48  BOOST_CHECK_NO_THROW(art::ensurePointer<A*>(a.begin()));
49 }
std::vector< A * > apvec_t
const double a
BOOST_AUTO_TEST_CASE ( a_pointer_from_b  )

Definition at line 51 of file ensurePointer_t.cc.

52 {
53  bvec_t b(1);
54  BOOST_CHECK_NO_THROW(art::ensurePointer<A*>(b.begin()));
55 }
std::vector< B > bvec_t
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( a_pointer_from_b_pointer  )

Definition at line 57 of file ensurePointer_t.cc.

58 {
59  bpvec_t b(1);
60  BOOST_CHECK_NO_THROW(art::ensurePointer<A*>(b.begin()));
61 }
std::vector< B * > bpvec_t
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( b_pointer_from_a_pointer  )

Definition at line 63 of file ensurePointer_t.cc.

64 {
65  apvec_t a;
66  std::unique_ptr<B> bp(new B);
67  std::unique_ptr<A> ap(new A);
68  a.push_back(bp.get());
69  a.push_back(ap.get());
70  BOOST_CHECK_NO_THROW(art::ensurePointer<B*>(a.begin()));
71  BOOST_CHECK_THROW(art::ensurePointer<B*>(a.begin() + 1), art::Exception);
72 }
std::vector< A * > apvec_t
const double a
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_const_a  )

Definition at line 75 of file ensurePointer_t.cc.

76 {
77  avec_t const a(1);
78  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(a.begin()));
79 }
std::vector< A > avec_t
const double a
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_const_a_pointer  )

Definition at line 81 of file ensurePointer_t.cc.

82 {
83  acpvec_t a(1);
84  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(a.begin()));
85 }
const double a
std::vector< A const * > acpvec_t
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_const_b  )

Definition at line 87 of file ensurePointer_t.cc.

88 {
89  bvec_t const b(1);
90  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(b.begin()));
91 }
std::vector< B > bvec_t
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_const_b_pointer  )

Definition at line 93 of file ensurePointer_t.cc.

94 {
95  bcpvec_t b(1);
96  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(b.begin()));
97 }
std::vector< B const * > bcpvec_t
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( const_b_pointer_from_const_a_pointer  )

Definition at line 99 of file ensurePointer_t.cc.

100 {
101  acpvec_t a;
102  std::unique_ptr<B> bp(new B);
103  std::unique_ptr<A> ap(new A);
104  a.push_back(bp.get());
105  a.push_back(ap.get());
106  BOOST_CHECK_NO_THROW(art::ensurePointer<B const*>(a.begin()));
107  BOOST_CHECK_THROW(art::ensurePointer<B const*>(a.begin() + 1),
109 }
const double a
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::vector< A const * > acpvec_t
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_a  )

Definition at line 112 of file ensurePointer_t.cc.

113 {
114  avec_t a(1);
115  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(a.begin()));
116 }
std::vector< A > avec_t
const double a
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_a_pointer  )

Definition at line 118 of file ensurePointer_t.cc.

119 {
120  apvec_t a(1);
121  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(a.begin()));
122 }
std::vector< A * > apvec_t
const double a
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_b  )

Definition at line 124 of file ensurePointer_t.cc.

125 {
126  bvec_t b(1);
127  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(b.begin()));
128 }
std::vector< B > bvec_t
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( const_a_pointer_from_b_pointer  )

Definition at line 130 of file ensurePointer_t.cc.

131 {
132  bpvec_t b(1);
133  BOOST_CHECK_NO_THROW(art::ensurePointer<A const*>(b.begin()));
134 }
std::vector< B * > bpvec_t
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( const_b_pointer_from_a_pointer  )

Definition at line 136 of file ensurePointer_t.cc.

137 {
138  apvec_t a;
139  std::unique_ptr<B> bp(new B);
140  std::unique_ptr<A> ap(new A);
141  a.push_back(bp.get());
142  a.push_back(ap.get());
143  BOOST_CHECK_NO_THROW(art::ensurePointer<B const*>(a.begin()));
144  BOOST_CHECK_THROW(art::ensurePointer<B const*>(a.begin() + 1),
146 }
std::vector< A * > apvec_t
const double a
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66