Lumiera  0.pre.03
»edit your freedom«
generic-id-function-test.cpp
Go to the documentation of this file.
1 /*
2  GenericIdFunction(Test) - cover instance and type id generation
3 
4  Copyright (C) Lumiera.org
5  2015, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
29 //#include "lib/test/test-helper.hpp"
30 #include "lib/idi/genfunc.hpp"
31 //#include "lib/format-cout.hpp"
32 
33 //#include <utility>
34 //#include <string>
35 //#include <vector>
36 
37 //using std::string;
38 //using std::vector;
39 //using std::swap;
40 
41 
42 namespace lib {
43 namespace idi {
44 namespace test{
45 
46 // using lumiera::error::LUMIERA_ERROR_LOGIC;
47 
48  namespace {//Test fixture....
49 
50  class Thing
51  { };
52 
53  template<typename X>
54  struct Some
55  {
56  X x;
57  };
58 
59  typedef Some<Thing> SomeThing;
60 
61  }//(End)Test fixture
62 
63 
64 
65 
66 
67 
68 
69 
70 
71  /**************************************************************************/
77  class GenericIdFunction_test : public Test
78  {
79 
80  virtual void
81  run (Arg)
82  {
83  simpleUsage();
84  verify_typeSymbol();
85  verify_fullTypeID();
86  verify_prefix();
87  verify_typeHash();
88  verify_symbolicInstanceID();
89  }
90 
91 
92  void
93  simpleUsage()
94  {
95  CHECK ("int" == typeSymbol<int>());
96  CHECK ("bool" == typeSymbol<bool>());
97 
98  CHECK ("Some" == categoryFolder<SomeThing>());
99  }
100 
101 
102  void
103  verify_typeSymbol()
104  {
105  }
106 
107 
108  void
109  verify_fullTypeID()
110  {
111  CHECK("Some_Thing" == typeFullID<SomeThing>());
112  }
113 
114 
115  void
116  verify_prefix()
117  {
118  }
119 
120 
121  void
122  verify_typeHash()
123  {
124  }
125 
126 
127  void
128  verify_symbolicInstanceID()
129  {
130  class Unique { };
131 
132  CHECK ("Unique.001" == generateSymbolicID<Unique>());
133  CHECK ("Unique.002" == generateSymbolicID<Unique>());
134  CHECK ("Unique.003" == generateSymbolicID<Unique>());
135  }
136  };
137 
138 
140  LAUNCHER (GenericIdFunction_test, "unit common");
141 
142 
143 
144 }}} // namespace lib::idi::test
Definition: run.hpp:49
Implementation namespace for support and library code.
Generic functions to build identification schemes.
Simple test class runner.