Belle II Software  release-05-01-25
icc.test.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost <oliver.frost@desy.de> *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 /*
12 This file tests whether the C++ compiler of Intel implements C++.
13 */
14 
15 #include <gtest/gtest.h>
16 
17 namespace {
18 
20  template<class T>
21  class Wrapper {
22 
23  public:
25  explicit Wrapper(T t) : m_t(t)
26  {}
27 
28  public:
33  /*explicit*/ operator T& ()
34  { return m_t; }
35 
36  private:
38  T m_t;
39  };
40 
41  TEST(IntelCompiler, static_cast_calls_conversion_operator_template)
42  {
43  Wrapper<int> wrappedInt(6);
44 
45  int& i1(wrappedInt.operator int& ());
46  int& i2(static_cast<int&>(wrappedInt));
47  int& i3(wrappedInt);
48 
49  EXPECT_EQ(6, i1);
50  EXPECT_EQ(6, i2);
51  EXPECT_EQ(6, i3);
52  }
53 
54 
56  class IntWrapper {
57 
58  public:
60  explicit IntWrapper(int t) : m_t(t)
61  {}
62 
63  public:
68  /*explicit*/ operator int& ()
69  { return m_t; }
70 
71  private:
73  int m_t;
74  };
75 
76  TEST(IntelCompiler, static_cast_calls_conversion_operator_notemplate)
77  {
78  IntWrapper wrappedInt(6);
79 
80  int& i1(wrappedInt.operator int& ());
81  int& i2(static_cast<int&>(wrappedInt));
82  int& i3(wrappedInt);
83 
84  EXPECT_EQ(6, i1);
85  EXPECT_EQ(6, i2);
86  EXPECT_EQ(6, i3);
87  }
88 
89 }
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18