diff options
| author | Roland Reichwein <mail@reichwein.it> | 2021-02-06 17:41:09 +0100 | 
|---|---|---|
| committer | Roland Reichwein <mail@reichwein.it> | 2021-02-06 17:41:09 +0100 | 
| commit | 21f54c28f899f5510c8d92fe7393b45f91e2b839 (patch) | |
| tree | 4cf9479733e784643f7bc39fc2c52779bcefd6dd /tests | |
| parent | 58eac47439c2de9e6b460f5ac8dc4a0c9fa9872f (diff) | |
Cleanup: Replace google test with boost test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 4 | ||||
| -rw-r--r-- | tests/test-webserver.cpp | 23 | 
2 files changed, 11 insertions, 16 deletions
| 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 <boost/test/included/unit_test.hpp> +#include <boost/test/data/dataset.hpp> +#include <boost/test/data/monomorphic.hpp> +#include <boost/test/data/test_case.hpp>  #include <boost/property_tree/ptree.hpp>  #include <boost/property_tree/xml_parser.hpp> @@ -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<std::string>(' ', 1)*/); - EXPECT_EQ(ss.str(), "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<list><listentry type=\"file1\">name1.txt</listentry><listentry type=\"file2\">name2.txt</listentry></list>"); + BOOST_CHECK_EQUAL(ss.str(), "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<list><listentry type=\"file1\">name1.txt</listentry><listentry type=\"file2\">name2.txt</listentry></list>");  } -TEST(string, stoul) +BOOST_AUTO_TEST_CASE(string_stoul)  {   unsigned long l = std::stoul("-1"); - EXPECT_EQ(l, std::numeric_limits<unsigned long>::max()); + BOOST_CHECK_EQUAL(l, std::numeric_limits<unsigned long>::max());  } - - -int main(int argc, char* argv[]) { - ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} - | 
