concepts.cpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10 ** Includes
11 *****************************************************************************/
12 
13 #include <iostream>
14 #include <gtest/gtest.h>
15 #include <vector>
16 #include "../../include/ecl/concepts/blueprints.hpp"
17 #include "../../include/ecl/concepts/containers.hpp"
18 #include "../../include/ecl/concepts/macros.hpp"
19 #include "../../include/ecl/concepts/streams.hpp"
20 
25 /*****************************************************************************
26 ** Classes
27 *****************************************************************************/
28 
29 namespace ecl {
30 namespace concepts {
31 namespace tests {
32 
33 template <typename T>
34 class Concept {
35  public:
37  {
38  T t;
39  t.apply(); // This is the characteristic function required by this concept.
40  }
41 };
42 
43 class A {
44  public:
45  void apply() {}; // Comment this line to cause the compile to fail.
46 };
47 
48 class BluePrintCandidate {
49 public:
50  typedef int base_type;
51  base_type instantiate();
52  void apply(base_type dude);
53 };
54 
55 } // namespace tests
56 } // namespace concepts
57 } // namespace ecl
58 
59 /*****************************************************************************
60 ** Tests
61 *****************************************************************************/
62 
63 using namespace ecl::concepts::tests;
64 
65 // By default, the concept tests will pass. To cause it to fail
66 // comment the concept test functions and rebuild.
67 
68 
69 TEST(CompileTimeTests,macro) {
71  EXPECT_TRUE(true); // Should only fall over if compile time check is triggered.
72 }
73 
74 TEST(CompileTimeTests,stream) {
76  EXPECT_TRUE(true); // Should only fall over if compile time check is triggered.
77 }
78 
79 TEST(CompileTimeTests,blueprint) {
81  EXPECT_TRUE(true); // Should only fall over if compile time check is triggered.
82 }
83 
84 TEST(CompileTimeTests,container) {
86  EXPECT_TRUE(true); // Should only fall over if compile time check is triggered.
87 }
88 
89 /*****************************************************************************
90 ** Main
91 *****************************************************************************/
92 
93 int main(int argc, char **argv) {
94 
95  testing::InitGoogleTest(&argc,argv);
96  return RUN_ALL_TESTS();
97 }
98 
Embedded control libraries.
Defines validating functionality for the streams concept.
Definition: streams.hpp:38
Frameworks created for the unit tests.
TEST(TypeTests, fundamentals)
#define ecl_compile_time_concept_check(Model)
Compile time concept checking assertion.
Definition: macros.hpp:92
int main(int argc, char **argv)
Defines validating functionality for the dynamic container concept.
Definition: containers.hpp:69
Defines validating functionality for the blueprint concept.
Definition: blueprints.hpp:35
#define ecl_compile_time_concept_test(Model)
Convenient notational macro for setting up a concept testing function.
Definition: macros.hpp:116


ecl_concepts
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:20