Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
🐛 Fixed CMakeCM test
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Jan 5, 2020
1 parent 0361440 commit 1736591
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/cmcm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
24 changes: 24 additions & 0 deletions tests/cmcm/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// cotire example project

#include "example.h"

#ifndef NDEBUG
#include <algorithm>
#include <iterator>
#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
}

}
10 changes: 10 additions & 0 deletions tests/cmcm/example.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// cotire example project

#include <string>

namespace example {

std::string get_message();

}

17 changes: 17 additions & 0 deletions tests/cmcm/log.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// cotire example project

#include "log.h"

#include <iostream>

namespace logging {

void error(const std::string& msg) {
std::cerr << msg << std::endl;
}

void info(const std::string& msg) {
std::cout << msg << std::endl;
}

}
10 changes: 10 additions & 0 deletions tests/cmcm/log.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// cotire example project

#include <string>

namespace logging {

void error(const std::string& msg);
void info(const std::string& msg);

}
12 changes: 8 additions & 4 deletions tests/cmcm/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include <iostream>
using namespace std;
// cotire example project main

#include <string>

#include "example.h"
#include "log.h"

int main()
{
cout << "Hello, World!";
return 0;
std::string msg = example::get_message();
logging::info(msg);
}

0 comments on commit 1736591

Please sign in to comment.