Move catch main to separated file so tests compile a lot faster

This commit is contained in:
Vinícius Garcia
2016-07-08 20:41:37 -03:00
parent 2d437c3b28
commit b47ec33d95
3 changed files with 14 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
EXE=test-shunting-yard
SRC=$(EXE).cpp shunting-yard.cpp packToken.cpp
SRC=$(EXE).cpp shunting-yard.cpp packToken.cpp catch.cpp
OBJ=$(SRC:.cpp=.o)
CXX=g++

10
catch.cpp Normal file
View File

@@ -0,0 +1,10 @@
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
// Defined on test-shunting-yard.cpp
void PREPARE_ENVIRONMENT();
int main(int argc, char** argv) {
PREPARE_ENVIRONMENT();
return Catch::Session().run(argc, argv);
}

View File

@@ -1,10 +1,10 @@
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
#include "./shunting-yard.h"
TokenMap_t vars, tmap, emap, key3;
int main(int argc, char** argv) {
TokenMap_t vars, tmap, key3, emap;
void PREPARE_ENVIRONMENT() {
vars["pi"] = 3.14;
vars["b1"] = 0.0;
vars["b2"] = 0.86;
@@ -24,9 +24,6 @@ int main(int argc, char** argv) {
emap["a"] = 10;
emap["b"] = 20;
int result = Catch::Session().run(argc, argv);
return result;
}
TEST_CASE("Static calculate::calculate()") {