Lumiera  0.pre.03
»edit your freedom«
typed-family-member-id-test.cpp
Go to the documentation of this file.
1 /*
2  TypedFamilyMemberID(Test) - verify type based member ID
3 
4  Copyright (C) Lumiera.org
5  2017, 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 
23 
30 #include "lib/test/run.hpp"
31 #include "lib/typed-counter.hpp"
32 
33 
34 namespace lib {
35 namespace test{
36 
37 
38 
39 
40  /*******************************************************************/
50  class TypedFamilyMemberID_test : public Test
51  {
52 
53  void
54  run (Arg)
55  {
56  struct X { };
57  struct Y { };
58  struct Z { };
59 
60  CHECK (0 == FamilyMember<X>{});
61  CHECK (1 == FamilyMember<X>{});
62  CHECK (2 == FamilyMember<X>{});
63 
64  CHECK (0 == FamilyMember<Y>{});
65  CHECK (1 == FamilyMember<Y>{});
66 
67  CHECK (0 == FamilyMember<Z>{});
68 
69  CHECK (2 == FamilyMember<Y>{});
70  CHECK (3 == FamilyMember<Y>{});
71 
72  CHECK (1 == FamilyMember<Z>{});
73  CHECK (2 == FamilyMember<Z>{});
74  CHECK (3 == FamilyMember<Z>{});
75  CHECK (4 == FamilyMember<Z>{});
76 
77  CHECK (4 == FamilyMember<Y>{});
78  CHECK (5 == FamilyMember<Z>{});
79  CHECK (3 == FamilyMember<X>{});
80  CHECK (5 == FamilyMember<Y>{});
81  CHECK (4 == FamilyMember<X>{});
82  }
83  };
84 
85 
87  LAUNCHER (TypedFamilyMemberID_test, "unit common");
88 
89 
90 }} // namespace lib::test
Creating series of type-based contexts.
Definition: run.hpp:49
Implementation namespace for support and library code.
Simple test class runner.
Utility to produce member IDs for objects belonging to a "Family", as defined by a distinguishing typ...