From e162b97f5b03bf59ae51c9fc54f5952124d93b60 Mon Sep 17 00:00:00 2001 From: Dominik Thalhammer Date: Sat, 14 Jul 2018 16:17:05 +0200 Subject: [PATCH] Move gtest main, makefile improvements * Move gtest main into separate file to keep testfiles clean. * Add explicit std=c++11 to support compilers where c++11 is not yet the default. * Remove -lssl because only crypto is needed --- Makefile | 4 ++-- TestMain.cpp | 7 +++++++ TokenTest.cpp | 6 ------ 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 TestMain.cpp diff --git a/Makefile b/Makefile index 0b5e92b..5b081dd 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,9 @@ OBJ = $(FSRC:=.o) DEP_DIR = .deps FLAGS = -fPIC -Wall -Wno-unknown-pragmas -I include -CXXFLAGS = +CXXFLAGS = -std=c++11 CFLAGS = -LINKFLAGS = -lssl -lcrypto -lgtest +LINKFLAGS = -lcrypto -lgtest -lpthread OUTFILE = test diff --git a/TestMain.cpp b/TestMain.cpp new file mode 100644 index 0000000..b8b7262 --- /dev/null +++ b/TestMain.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/TokenTest.cpp b/TokenTest.cpp index 7014673..962dee7 100644 --- a/TokenTest.cpp +++ b/TokenTest.cpp @@ -10,12 +10,6 @@ namespace { extern std::string ecdsa_pub_key_invalid; } -int main(int argc, char *argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - TEST(TokenTest, DecodeToken) { std::string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9.AbIJTDMFc7yUa5MhvcP03nJPyCPzZtQcGEp-zWfOkEE"; auto decoded = jwt::decode(token);