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
This commit is contained in:
Dominik Thalhammer
2018-07-14 16:17:05 +02:00
parent 6a21de184f
commit e162b97f5b
3 changed files with 9 additions and 8 deletions

View File

@@ -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

7
TestMain.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include <gtest/gtest.h>
int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

View File

@@ -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);