diff --git a/tests/cmcm/CMakeLists.txt b/tests/cmcm/CMakeLists.txt index a1a9678..41b28e8 100644 --- a/tests/cmcm/CMakeLists.txt +++ b/tests/cmcm/CMakeLists.txt @@ -11,6 +11,6 @@ pmm(CMakeCM ROLLING) include(cotire) -add_executable(dummy-program main.cpp) +add_executable(dummy-program main.cpp example.cpp log.cpp log.h example.h) cotire(dummy-program) diff --git a/tests/cmcm/example.cpp b/tests/cmcm/example.cpp new file mode 100644 index 0000000..a857315 --- /dev/null +++ b/tests/cmcm/example.cpp @@ -0,0 +1,24 @@ +// cotire example project + +#include "example.h" + +#ifndef NDEBUG +#include +#include +#endif + +namespace example { + +std::string get_message() { + char msg_chrs[] = { 'C', 'o', 't', 'i', 'r', 'e', 'd', '!' }; +#ifdef NDEBUG + return std::string(&msg_chrs[0], &msg_chrs[sizeof(msg_chrs)]); +#else + std::string msg; + msg.reserve(sizeof(msg_chrs)); + std::copy(msg_chrs, msg_chrs + sizeof(msg_chrs), std::back_inserter(msg)); + return msg; +#endif +} + +} diff --git a/tests/cmcm/example.h b/tests/cmcm/example.h new file mode 100644 index 0000000..0fe3e23 --- /dev/null +++ b/tests/cmcm/example.h @@ -0,0 +1,10 @@ +// cotire example project + +#include + +namespace example { + +std::string get_message(); + +} + diff --git a/tests/cmcm/log.cpp b/tests/cmcm/log.cpp new file mode 100644 index 0000000..5294adb --- /dev/null +++ b/tests/cmcm/log.cpp @@ -0,0 +1,17 @@ +// cotire example project + +#include "log.h" + +#include + +namespace logging { + +void error(const std::string& msg) { + std::cerr << msg << std::endl; +} + +void info(const std::string& msg) { + std::cout << msg << std::endl; +} + +} diff --git a/tests/cmcm/log.h b/tests/cmcm/log.h new file mode 100644 index 0000000..a6ce24a --- /dev/null +++ b/tests/cmcm/log.h @@ -0,0 +1,10 @@ +// cotire example project + +#include + +namespace logging { + +void error(const std::string& msg); +void info(const std::string& msg); + +} diff --git a/tests/cmcm/main.cpp b/tests/cmcm/main.cpp index 2a9ace7..2ea1af6 100644 --- a/tests/cmcm/main.cpp +++ b/tests/cmcm/main.cpp @@ -1,8 +1,12 @@ -#include -using namespace std; +// cotire example project main + +#include + +#include "example.h" +#include "log.h" int main() { - cout << "Hello, World!"; - return 0; + std::string msg = example::get_message(); + logging::info(msg); }