Classes | Macros | Functions
pointersEqual_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "art/Utilities/pointersEqual.h"

Go to the source code of this file.

Classes

class  A
 
class  B
 
class  C
 
class  D
 
class  E
 

Macros

#define BOOST_TEST_MODULE   (pointersEqual_t)
 

Functions

 BOOST_AUTO_TEST_CASE (basic_types)
 
 BOOST_AUTO_TEST_CASE (inheritance)
 
 BOOST_AUTO_TEST_CASE (constness)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (pointersEqual_t)

Definition at line 2 of file pointersEqual_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( basic_types  )

Definition at line 14 of file pointersEqual_t.cc.

15 {
16  int i = 3;
17  int j = 3;
18  int* ip1 = &i;
19  int* ip2 = &i;
20  double p = i;
21  BOOST_TEST(art::pointersEqual(ip1, ip2));
22  BOOST_TEST(art::pointersEqual(&i, ip1));
23  BOOST_TEST(art::pointersEqual(&i, ip2));
24  BOOST_CHECK_THROW(art::pointersEqual(&i, &p), art::Exception);
25  BOOST_TEST(!art::pointersEqual(&i, &j));
26 }
std::enable_if_t< std::is_same< T1, T2 >::value||std::is_base_of< T1, T2 >::value||std::is_base_of< T2, T1 >::value, bool > pointersEqual(T1 *t1, T2 *t2)
Definition: pointersEqual.h:15
p
Definition: test.py:223
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
BOOST_AUTO_TEST_CASE ( inheritance  )

Definition at line 28 of file pointersEqual_t.cc.

29 {
30  D d1;
31  D* pd1d1(&d1);
32  D* pd1d2(&d1);
33  A* pd1a1(&d1);
34  B* pd1b1(&d1);
35  D d2;
36  A a1;
37  B b1;
38  E e1;
39  BOOST_TEST(art::pointersEqual(pd1d1, pd1d2));
40  BOOST_TEST(art::pointersEqual(pd1d1, pd1a1));
41  BOOST_TEST(art::pointersEqual(pd1d1, pd1b1));
42  BOOST_CHECK_THROW(art::pointersEqual(pd1a1, pd1b1), art::Exception);
43  BOOST_CHECK_THROW(art::pointersEqual(&a1, &b1), art::Exception);
44  BOOST_TEST(!art::pointersEqual(pd1a1, &a1));
45  BOOST_TEST(!art::pointersEqual(pd1a1, &e1));
46  BOOST_TEST(!art::pointersEqual(&d1, &d2));
47 }
std::enable_if_t< std::is_same< T1, T2 >::value||std::is_base_of< T1, T2 >::value||std::is_base_of< T2, T1 >::value, bool > pointersEqual(T1 *t1, T2 *t2)
Definition: pointersEqual.h:15
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
#define a1
BOOST_AUTO_TEST_CASE ( constness  )

Definition at line 49 of file pointersEqual_t.cc.

50 {
51  D d1;
52  A const* da1(&d1);
53  BOOST_TEST(art::pointersEqual(&d1, da1));
54 }
std::enable_if_t< std::is_same< T1, T2 >::value||std::is_base_of< T1, T2 >::value||std::is_base_of< T2, T1 >::value, bool > pointersEqual(T1 *t1, T2 *t2)
Definition: pointersEqual.h:15