From 21f54c28f899f5510c8d92fe7393b45f91e2b839 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 6 Feb 2021 17:41:09 +0100 Subject: Cleanup: Replace google test with boost test --- tests/Makefile | 4 +--- tests/test-webserver.cpp | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile index 8529d6d..1785e09 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -4,7 +4,7 @@ PROJECTNAME=test-webserver CXXFLAGS+= -I. -fPIE -CXXTESTFLAGS=-I../googletest/include -I../googlemock/include/ -I../googletest -I../googlemock +CXXTESTFLAGS= LIBS=\ -lcommon \ @@ -21,8 +21,6 @@ LDFLAGS+=-pie -L../libcommon TESTSRC=\ test-webserver.cpp \ - ../googlemock/src/gmock-all.cpp \ - ../googletest/src/gtest-all.cpp \ $(PROGSRC) build: $(PROJECTNAME) diff --git a/tests/test-webserver.cpp b/tests/test-webserver.cpp index 5838dfa..7683b93 100644 --- a/tests/test-webserver.cpp +++ b/tests/test-webserver.cpp @@ -1,5 +1,9 @@ -#include "gmock/gmock.h" -#include "gtest/gtest.h" +#define BOOST_TEST_MODULE webserver_test + +#include +#include +#include +#include #include #include @@ -10,7 +14,7 @@ using namespace std::string_literals; namespace pt = boost::property_tree; -TEST(property_tree, put) +BOOST_AUTO_TEST_CASE(property_tree_put) { pt::ptree p; pt::ptree list; @@ -33,19 +37,12 @@ TEST(property_tree, put) pt::xml_parser::write_xml(ss, p /*, pt::xml_parser::xml_writer_make_settings(' ', 1)*/); - EXPECT_EQ(ss.str(), "\nname1.txtname2.txt"); + BOOST_CHECK_EQUAL(ss.str(), "\nname1.txtname2.txt"); } -TEST(string, stoul) +BOOST_AUTO_TEST_CASE(string_stoul) { unsigned long l = std::stoul("-1"); - EXPECT_EQ(l, std::numeric_limits::max()); + BOOST_CHECK_EQUAL(l, std::numeric_limits::max()); } - - -int main(int argc, char* argv[]) { - ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} - -- cgit v1.2.3