summaryrefslogtreecommitdiffhomepage
path: root/tests/test-webserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-webserver.cpp')
-rw-r--r--tests/test-webserver.cpp38
1 files changed, 9 insertions, 29 deletions
diff --git a/tests/test-webserver.cpp b/tests/test-webserver.cpp
index 7683b93..1668c60 100644
--- a/tests/test-webserver.cpp
+++ b/tests/test-webserver.cpp
@@ -1,6 +1,8 @@
+// Main unit test compilation unit
+// boost mandates that exactly one compilation unit contains the following two lines:
#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>
@@ -14,35 +16,13 @@
using namespace std::string_literals;
namespace pt = boost::property_tree;
-BOOST_AUTO_TEST_CASE(property_tree_put)
+class Fixture
{
- pt::ptree p;
- pt::ptree list;
-
- pt::ptree entry;
-
- entry.put_value("name1.txt");
- entry.put("<xmlattr>.type", "file1");
-
- list.push_back(pt::ptree::value_type("listentry", entry));
-
- entry.put_value("name2.txt");
- entry.put("<xmlattr>.type", "file2");
-
- list.push_back(pt::ptree::value_type("listentry", entry));
-
- p.push_back(pt::ptree::value_type("list", list));
+public:
+ Fixture(){}
+ ~Fixture(){}
+};
- std::stringstream ss;
-
- pt::xml_parser::write_xml(ss, p /*, pt::xml_parser::xml_writer_make_settings<std::string>(' ', 1)*/);
-
- 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>");
-}
-
-BOOST_AUTO_TEST_CASE(string_stoul)
+BOOST_FIXTURE_TEST_CASE(http_download, Fixture)
{
- unsigned long l = std::stoul("-1");
-
- BOOST_CHECK_EQUAL(l, std::numeric_limits<unsigned long>::max());
}