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)
5  2017, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
21 #include "lib/test/run.hpp"
22 #include "lib/typed-counter.hpp"
23 
24 
25 namespace lib {
26 namespace test{
27 
28 
29 
30 
31  /*******************************************************************/
41  class TypedFamilyMemberID_test : public Test
42  {
43 
44  void
45  run (Arg)
46  {
47  struct X { };
48  struct Y { };
49  struct Z { };
50 
51  CHECK (0 == FamilyMember<X>{});
52  CHECK (1 == FamilyMember<X>{});
53  CHECK (2 == FamilyMember<X>{});
54 
55  CHECK (0 == FamilyMember<Y>{});
56  CHECK (1 == FamilyMember<Y>{});
57 
58  CHECK (0 == FamilyMember<Z>{});
59 
60  CHECK (2 == FamilyMember<Y>{});
61  CHECK (3 == FamilyMember<Y>{});
62 
63  CHECK (1 == FamilyMember<Z>{});
64  CHECK (2 == FamilyMember<Z>{});
65  CHECK (3 == FamilyMember<Z>{});
66  CHECK (4 == FamilyMember<Z>{});
67 
68  CHECK (4 == FamilyMember<Y>{});
69  CHECK (5 == FamilyMember<Z>{});
70  CHECK (3 == FamilyMember<X>{});
71  CHECK (5 == FamilyMember<Y>{});
72  CHECK (4 == FamilyMember<X>{});
73  }
74  };
75 
76 
78  LAUNCHER (TypedFamilyMemberID_test, "unit common");
79 
80 
81 }} // namespace lib::test
Creating series of type-based contexts.
Definition: run.hpp:40
Implementation namespace for support and library code.
Simplistic test class runner.
Utility to produce member IDs for objects belonging to a "Family", as defined by a distinguishing typ...