mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 23:04:35 +02:00
Refactor extras:
A new directory extras/ is added, and code not part of the official public Beast interface is moved there.
This commit is contained in:
@@ -40,14 +40,17 @@ macro(GroupSources curdir)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include_directories (extras)
|
||||
include_directories (include)
|
||||
|
||||
file(GLOB_RECURSE BEAST_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/include/beast/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/beast/*.ipp
|
||||
${PROJECT_SOURCE_DIR}/extras/beast/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/extras/beast/*.ipp
|
||||
)
|
||||
|
||||
add_subdirectory (test)
|
||||
add_subdirectory (examples)
|
||||
add_subdirectory (test)
|
||||
|
||||
#enable_testing()
|
||||
|
1
Jamroot
1
Jamroot
@@ -64,6 +64,7 @@ variant asan
|
||||
project beast
|
||||
: requirements
|
||||
<include>.
|
||||
<include>./extras
|
||||
<include>./include
|
||||
#<use>/boost//headers
|
||||
<library>/boost/system//boost_system
|
||||
|
3
extras/README.md
Normal file
3
extras/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Extras
|
||||
|
||||
These are not part of the official public Beast interface but they are used by the tests and some third party programs.
|
@@ -5,18 +5,16 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_STREAM_ABSTRACT_OSTREAM_HPP
|
||||
#define BEAST_DETAIL_STREAM_ABSTRACT_OSTREAM_HPP
|
||||
#ifndef BEAST_UNIT_TEST_ABSTRACT_OSTREAM_HPP
|
||||
#define BEAST_UNIT_TEST_ABSTRACT_OSTREAM_HPP
|
||||
|
||||
#include <beast/detail/stream/basic_abstract_ostream.hpp>
|
||||
#include <beast/unit_test/basic_abstract_ostream.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
/** An abstract ostream for `char`. */
|
||||
using abstract_ostream = basic_abstract_ostream <char>;
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,17 +5,14 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_AMOUNT_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_AMOUNT_HPP
|
||||
#ifndef BEAST_UNIT_TEST_AMOUNT_HPP
|
||||
#define BEAST_UNIT_TEST_AMOUNT_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** Utility for producing nicely composed output of amounts with units. */
|
||||
@@ -53,7 +50,6 @@ operator<< (std::ostream& s, amount const& t)
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,16 +5,15 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_STREAM_BASIC_ABSTRACT_OSTREAM_HPP
|
||||
#define BEAST_DETAIL_STREAM_BASIC_ABSTRACT_OSTREAM_HPP
|
||||
#ifndef BEAST_UNIT_TEST_BASIC_ABSTRACT_OSTREAM_HPP
|
||||
#define BEAST_UNIT_TEST_BASIC_ABSTRACT_OSTREAM_HPP
|
||||
|
||||
#include <beast/detail/stream/basic_scoped_ostream.hpp>
|
||||
#include <beast/unit_test/basic_scoped_ostream.hpp>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
/** Abstraction for an output stream similar to std::basic_ostream. */
|
||||
template <
|
||||
@@ -81,7 +80,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,8 +5,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_STREAM_BASIC_SCOPED_OSTREAM_HPP
|
||||
#define BEAST_DETAIL_STREAM_BASIC_SCOPED_OSTREAM_HPP
|
||||
#ifndef BEAST_UNIT_TEST_BASIC_SCOPED_OSTREAM_HPP
|
||||
#define BEAST_UNIT_TEST_BASIC_SCOPED_OSTREAM_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -24,7 +24,6 @@
|
||||
#endif
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
template <
|
||||
class CharT,
|
||||
@@ -132,7 +131,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,14 +5,13 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_STREAM_BASIC_STD_OSTREAM_H_INCLUDED
|
||||
#define BEAST_DETAIL_STREAM_BASIC_STD_OSTREAM_H_INCLUDED
|
||||
#ifndef BEAST_UNIT_TEST_BASIC_STD_OSTREAM_HPP
|
||||
#define BEAST_UNIT_TEST_BASIC_STD_OSTREAM_HPP
|
||||
|
||||
#include <beast/detail/stream/basic_abstract_ostream.hpp>
|
||||
#include <beast/unit_test/basic_abstract_ostream.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
/** Wraps an existing std::basic_ostream as an abstract_ostream. */
|
||||
template <
|
||||
@@ -56,7 +55,6 @@ make_std_ostream (std::basic_ostream <CharT, Traits>& stream)
|
||||
return basic_std_ostream <CharT, Traits> (stream);
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,10 +5,10 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_STREAM_DEBUG_OSTREAM_HPP
|
||||
#define BEAST_DETAIL_STREAM_DEBUG_OSTREAM_HPP
|
||||
#ifndef BEAST_UNIT_TEST_DEBUG_OSTREAM_HPP
|
||||
#define BEAST_UNIT_TEST_DEBUG_OSTREAM_HPP
|
||||
|
||||
#include <beast/detail/stream/abstract_ostream.hpp>
|
||||
#include <beast/unit_test/abstract_ostream.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@@ -28,7 +28,6 @@
|
||||
#endif
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/** A basic_abstract_ostream that redirects output to an attached debugger. */
|
||||
@@ -74,7 +73,6 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,15 +5,12 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_GLOBAL_SUITES_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_GLOBAL_SUITES_HPP
|
||||
#ifndef BEAST_UNIT_TEST_GLOBAL_SUITES_HPP
|
||||
#define BEAST_UNIT_TEST_GLOBAL_SUITES_HPP
|
||||
|
||||
#include <beast/detail/unit_test/suite_list.hpp>
|
||||
#include <beast/unit_test/suite_list.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
namespace detail {
|
||||
@@ -54,7 +51,6 @@ global_suites()
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,16 +5,13 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_MATCH_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_MATCH_HPP
|
||||
#ifndef BEAST_UNIT_TEST_MATCH_HPP
|
||||
#define BEAST_UNIT_TEST_MATCH_HPP
|
||||
|
||||
#include <beast/detail/unit_test/suite_info.hpp>
|
||||
#include <beast/unit_test/suite_info.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
// Predicate for implementing matches
|
||||
@@ -171,7 +168,6 @@ match_library (std::string const& name)
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,21 +5,18 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_PRINT_H_INCLUDED
|
||||
#define BEAST_DETAIL_UNIT_TEST_PRINT_H_INCLUDED
|
||||
#ifndef BEAST_UNIT_TEST_PRINT_H_INCLUDED
|
||||
#define BEAST_UNIT_TEST_PRINT_H_INCLUDED
|
||||
|
||||
#include <beast/detail/unit_test/amount.hpp>
|
||||
#include <beast/detail/unit_test/results.hpp>
|
||||
#include <beast/detail/stream/abstract_ostream.hpp>
|
||||
#include <beast/detail/stream/basic_std_ostream.hpp>
|
||||
#include <beast/unit_test/amount.hpp>
|
||||
#include <beast/unit_test/results.hpp>
|
||||
#include <beast/unit_test/abstract_ostream.hpp>
|
||||
#include <beast/unit_test/basic_std_ostream.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** Write test results to the specified output stream. */
|
||||
@@ -65,7 +62,6 @@ print (results const& r, std::ostream& stream = std::cout)
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,16 +5,13 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_RECORDER_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_RECORDER_HPP
|
||||
#ifndef BEAST_UNIT_TEST_RECORDER_HPP
|
||||
#define BEAST_UNIT_TEST_RECORDER_HPP
|
||||
|
||||
#include <beast/detail/unit_test/results.hpp>
|
||||
#include <beast/detail/unit_test/runner.hpp>
|
||||
#include <beast/unit_test/results.hpp>
|
||||
#include <beast/unit_test/runner.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** A test runner that stores the results. */
|
||||
@@ -90,7 +87,6 @@ private:
|
||||
};
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,13 +5,13 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_REPORTER_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_REPORTER_HPP
|
||||
#ifndef BEAST_UNIT_TEST_REPORTER_HPP
|
||||
#define BEAST_UNIT_TEST_REPORTER_HPP
|
||||
|
||||
#include <beast/detail/unit_test/amount.hpp>
|
||||
#include <beast/detail/unit_test/recorder.hpp>
|
||||
#include <beast/detail/stream/abstract_ostream.hpp>
|
||||
#include <beast/detail/stream/basic_std_ostream.hpp>
|
||||
#include <beast/unit_test/amount.hpp>
|
||||
#include <beast/unit_test/recorder.hpp>
|
||||
#include <beast/unit_test/abstract_ostream.hpp>
|
||||
#include <beast/unit_test/basic_std_ostream.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
namespace detail {
|
||||
@@ -87,7 +84,7 @@ private:
|
||||
};
|
||||
|
||||
boost::optional <std_ostream> std_ostream_;
|
||||
std::reference_wrapper <beast::detail::abstract_ostream> stream_;
|
||||
std::reference_wrapper <beast::abstract_ostream> stream_;
|
||||
results results_;
|
||||
suite_results suite_results_;
|
||||
case_results case_results_;
|
||||
@@ -102,7 +99,7 @@ public:
|
||||
reporter (std::ostream& stream = std::cout);
|
||||
|
||||
explicit
|
||||
reporter (beast::detail::abstract_ostream& stream);
|
||||
reporter (beast::abstract_ostream& stream);
|
||||
|
||||
private:
|
||||
static
|
||||
@@ -229,7 +226,7 @@ reporter<_>::~reporter()
|
||||
|
||||
template <class _>
|
||||
reporter<_>::reporter (
|
||||
beast::detail::abstract_ostream& stream)
|
||||
abstract_ostream& stream)
|
||||
: stream_ (stream)
|
||||
{
|
||||
}
|
||||
@@ -318,7 +315,6 @@ reporter<_>::on_log (
|
||||
using reporter = detail::reporter<>;
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,8 +5,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_RESULTS_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_RESULTS_HPP
|
||||
#ifndef BEAST_UNIT_TEST_RESULTS_HPP
|
||||
#define BEAST_UNIT_TEST_RESULTS_HPP
|
||||
|
||||
#include <beast/detail/const_container.hpp>
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
#include <vector>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** Holds a set of test condition outcomes in a testcase. */
|
||||
@@ -43,7 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
class tests_t
|
||||
: public const_container <std::vector <test>>
|
||||
: public beast::detail::const_container <std::vector <test>>
|
||||
{
|
||||
private:
|
||||
std::size_t failed_;
|
||||
@@ -85,7 +82,7 @@ private:
|
||||
};
|
||||
|
||||
class log_t
|
||||
: public const_container <std::vector <std::string>>
|
||||
: public beast::detail::const_container <std::vector <std::string>>
|
||||
{
|
||||
public:
|
||||
/** Insert a string into the log. */
|
||||
@@ -122,7 +119,7 @@ public:
|
||||
|
||||
/** Holds the set of testcase results in a suite. */
|
||||
class suite_results
|
||||
: public const_container <std::vector <case_results>>
|
||||
: public beast::detail::const_container <std::vector <case_results>>
|
||||
{
|
||||
private:
|
||||
std::string name_;
|
||||
@@ -181,7 +178,7 @@ public:
|
||||
// VFALCO TODO Make this a template class using scoped allocators
|
||||
/** Holds the results of running a set of testsuites. */
|
||||
class results
|
||||
: public const_container <std::vector <suite_results>>
|
||||
: public beast::detail::const_container <std::vector <suite_results>>
|
||||
{
|
||||
private:
|
||||
std::size_t m_cases;
|
||||
@@ -240,7 +237,6 @@ public:
|
||||
};
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,19 +5,16 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_RUNNER_H_INCLUDED
|
||||
#define BEAST_DETAIL_UNIT_TEST_RUNNER_H_INCLUDED
|
||||
#ifndef BEAST_UNIT_TEST_RUNNER_H_INCLUDED
|
||||
#define BEAST_UNIT_TEST_RUNNER_H_INCLUDED
|
||||
|
||||
#include <beast/detail/unit_test/suite_info.hpp>
|
||||
#include <beast/detail/stream/abstract_ostream.hpp>
|
||||
#include <beast/unit_test/suite_info.hpp>
|
||||
#include <beast/unit_test/abstract_ostream.hpp>
|
||||
#include <cassert>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** Unit test runner interface.
|
||||
@@ -28,7 +25,7 @@ class runner
|
||||
{
|
||||
private:
|
||||
// Reroutes log output to the runner
|
||||
class stream_t : public beast::detail::abstract_ostream
|
||||
class stream_t : public abstract_ostream
|
||||
{
|
||||
private:
|
||||
runner& owner_;
|
||||
@@ -332,7 +329,6 @@ runner::log (std::string const& s)
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,17 +5,14 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_SUITE_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_SUITE_HPP
|
||||
#ifndef BEAST_UNIT_TEST_SUITE_HPP
|
||||
#define BEAST_UNIT_TEST_SUITE_HPP
|
||||
|
||||
#include <beast/detail/unit_test/runner.hpp>
|
||||
#include <beast/unit_test/runner.hpp>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
class thread;
|
||||
@@ -537,7 +534,6 @@ suite::run (runner& r)
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -545,7 +541,7 @@ suite::run (runner& r)
|
||||
// detail:
|
||||
// This inserts the suite with the given manual flag
|
||||
#define BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,manual) \
|
||||
static beast::detail::unit_test::detail::insert_suite <Class##_test> \
|
||||
static beast::unit_test::detail::insert_suite <Class##_test> \
|
||||
Library ## Module ## Class ## _test_instance ( \
|
||||
#Class, #Module, #Library, manual);
|
||||
|
||||
@@ -593,7 +589,7 @@ suite::run (runner& r)
|
||||
#define BEAST_DEFINE_TESTSUITE(Class,Module,Library)
|
||||
|
||||
#else
|
||||
#include <beast/detail/unit_test/global_suites.hpp>
|
||||
#include <beast/unit_test/global_suites.hpp>
|
||||
#define BEAST_DEFINE_TESTSUITE(Class,Module,Library) \
|
||||
BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,false)
|
||||
#define BEAST_DEFINE_TESTSUITE_MANUAL(Class,Module,Library) \
|
@@ -5,17 +5,14 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_SUITE_INFO_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_SUITE_INFO_HPP
|
||||
#ifndef BEAST_UNIT_TEST_SUITE_INFO_HPP
|
||||
#define BEAST_UNIT_TEST_SUITE_INFO_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
class runner;
|
||||
@@ -113,7 +110,6 @@ make_suite_info (std::string const& name, std::string const& module,
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,10 +5,10 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_SUITE_LIST_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_SUITE_LIST_HPP
|
||||
#ifndef BEAST_UNIT_TEST_SUITE_LIST_HPP
|
||||
#define BEAST_UNIT_TEST_SUITE_LIST_HPP
|
||||
|
||||
#include <beast/detail/unit_test/suite_info.hpp>
|
||||
#include <beast/unit_test/suite_info.hpp>
|
||||
#include <beast/detail/const_container.hpp>
|
||||
#include <cassert>
|
||||
#include <typeindex>
|
||||
@@ -16,14 +16,11 @@
|
||||
#include <unordered_set>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** A container of test suites. */
|
||||
class suite_list
|
||||
: public const_container <std::set <suite_info>>
|
||||
: public detail::const_container <std::set <suite_info>>
|
||||
{
|
||||
private:
|
||||
#ifndef NDEBUG
|
||||
@@ -68,7 +65,6 @@ suite_list::insert (char const* name, char const* module, char const* library,
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -5,18 +5,15 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_UNIT_TEST_THREAD_HPP
|
||||
#define BEAST_DETAIL_UNIT_TEST_THREAD_HPP
|
||||
#ifndef BEAST_UNIT_TEST_THREAD_HPP
|
||||
#define BEAST_UNIT_TEST_THREAD_HPP
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
/** Replacement for std::thread that handles exceptions in unit tests. */
|
||||
@@ -122,7 +119,6 @@ private:
|
||||
};
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@@ -1,90 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <beast/detail/unit_test/amount.hpp>
|
||||
#include <beast/detail/unit_test/global_suites.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <string>
|
||||
|
||||
// Include this .cpp in your project to gain access to the printing suite
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
namespace detail {
|
||||
|
||||
/** A suite that prints the list of globally defined suites. */
|
||||
class print_test : public suite
|
||||
{
|
||||
private:
|
||||
template <class = void>
|
||||
void
|
||||
do_run();
|
||||
|
||||
public:
|
||||
template <class = void>
|
||||
static
|
||||
std::string
|
||||
prefix (suite_info const& s);
|
||||
|
||||
template <class = void>
|
||||
void
|
||||
print (suite_list &c);
|
||||
|
||||
void
|
||||
run()
|
||||
{
|
||||
do_run();
|
||||
}
|
||||
};
|
||||
|
||||
template <class>
|
||||
void
|
||||
print_test::do_run()
|
||||
{
|
||||
log << "------------------------------------------";
|
||||
print (global_suites());
|
||||
log << "------------------------------------------";
|
||||
pass();
|
||||
}
|
||||
|
||||
template <class>
|
||||
std::string
|
||||
print_test::prefix (suite_info const& s)
|
||||
{
|
||||
if (s.manual())
|
||||
return "|M| ";
|
||||
return " ";
|
||||
}
|
||||
|
||||
template <class>
|
||||
void
|
||||
print_test::print (suite_list &c)
|
||||
{
|
||||
std::size_t manual (0);
|
||||
for (auto const& s : c)
|
||||
{
|
||||
log <<
|
||||
prefix (s) <<
|
||||
s.full_name();
|
||||
if (s.manual())
|
||||
++manual;
|
||||
}
|
||||
log <<
|
||||
amount (c.size(), "suite") << " total, " <<
|
||||
amount (manual, "manual suite")
|
||||
;
|
||||
}
|
||||
|
||||
BEAST_DEFINE_TESTSUITE_MANUAL(print,unit_test,beast);
|
||||
|
||||
} // detail
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
@@ -1,6 +1,7 @@
|
||||
# Part of Beast
|
||||
|
||||
GroupSources(include/beast)
|
||||
GroupSources(extras)
|
||||
GroupSources(test)
|
||||
|
||||
add_executable (core-tests
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/to_string.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class basic_streambuf_test : public beast::detail::unit_test::suite
|
||||
class basic_streambuf_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template<class Alloc1, class Alloc2>
|
||||
|
@@ -8,12 +8,12 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/bind_handler.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class bind_handler_test : public detail::unit_test::suite
|
||||
class bind_handler_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
static void foo (int)
|
||||
|
@@ -8,7 +8,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/buffer_cat.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <iterator>
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace beast {
|
||||
|
||||
class buffer_cat_test : public detail::unit_test::suite
|
||||
class buffer_cat_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
template< class Iterator >
|
||||
|
@@ -9,14 +9,14 @@
|
||||
#include <beast/buffers_adapter.hpp>
|
||||
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <iterator>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class buffers_adapter_test : public detail::unit_test::suite
|
||||
class buffers_adapter_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
template<class ConstBufferSequence>
|
||||
|
@@ -8,13 +8,13 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/consuming_buffers.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class consuming_buffers_test : public beast::detail::unit_test::suite
|
||||
class consuming_buffers_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template<class ConstBufferSequence>
|
||||
|
@@ -6,12 +6,12 @@
|
||||
//
|
||||
|
||||
#include <beast/detail/base64.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
class base64_test : public beast::detail::unit_test::suite
|
||||
class base64_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void
|
||||
|
@@ -6,13 +6,13 @@
|
||||
//
|
||||
|
||||
#include <beast/detail/empty_base_optimization.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
class empty_base_optimization_test
|
||||
: public beast::detail::unit_test::suite
|
||||
: public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template <class T>
|
||||
|
@@ -6,13 +6,13 @@
|
||||
//
|
||||
|
||||
#include <beast/detail/sha1.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <array>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
class sha1_test : public beast::detail::unit_test::suite
|
||||
class sha1_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
static
|
||||
|
@@ -8,12 +8,12 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/to_string.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class to_string_test : public beast::detail::unit_test::suite
|
||||
class to_string_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void run()
|
||||
|
@@ -8,12 +8,12 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/basic_headers.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class basic_headers_test : public beast::detail::unit_test::suite
|
||||
class basic_headers_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template<class Allocator>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <beast/write_streambuf.hpp>
|
||||
#include <beast/http/rfc2616.hpp>
|
||||
#include <beast/detail/ci_char_traits.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/utility/string_ref.hpp>
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
@@ -27,7 +27,7 @@
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class basic_parser_v1_test : public beast::detail::unit_test::suite
|
||||
class basic_parser_v1_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
struct cb_req_checker
|
||||
|
@@ -20,8 +20,8 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/message_v1.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/detail/unit_test/thread.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/thread.hpp>
|
||||
#include <beast/placeholders.hpp>
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/http.hpp>
|
||||
@@ -39,15 +39,15 @@ public:
|
||||
using socket_type = boost::asio::ip::tcp::socket;
|
||||
|
||||
private:
|
||||
beast::detail::unit_test::suite& suite_;
|
||||
unit_test::suite& suite_;
|
||||
boost::asio::io_service ios_;
|
||||
socket_type sock_;
|
||||
boost::asio::ip::tcp::acceptor acceptor_;
|
||||
beast::detail::unit_test::thread thread_;
|
||||
unit_test::thread thread_;
|
||||
|
||||
public:
|
||||
sync_echo_http_server(
|
||||
endpoint_type ep, beast::detail::unit_test::suite& suite)
|
||||
endpoint_type ep, unit_test::suite& suite)
|
||||
: suite_(suite)
|
||||
, sock_(ios_)
|
||||
, acceptor_(ios_)
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
acceptor_.async_accept(sock_,
|
||||
std::bind(&sync_echo_http_server::on_accept, this,
|
||||
beast::asio::placeholders::error));
|
||||
thread_ = beast::detail::unit_test::thread(suite_,
|
||||
thread_ = unit_test::thread(suite_,
|
||||
[&]
|
||||
{
|
||||
ios_.run();
|
||||
@@ -132,7 +132,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class message_test : public beast::detail::unit_test::suite
|
||||
class message_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
using endpoint_type = boost::asio::ip::tcp::endpoint;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include <beast/http.hpp>
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/to_string.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class parser_bench_test : public beast::detail::unit_test::suite
|
||||
class parser_bench_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
static std::size_t constexpr N = 2000;
|
||||
|
@@ -10,12 +10,12 @@
|
||||
|
||||
#include <beast/http/headers.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class parser_v1_test : public beast::detail::unit_test::suite
|
||||
class parser_v1_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void run() override
|
||||
|
@@ -13,14 +13,14 @@
|
||||
#include "../yield_to.hpp"
|
||||
|
||||
#include <beast/http/streambuf_body.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/spawn.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class read_test
|
||||
: public beast::detail::unit_test::suite
|
||||
: public beast::unit_test::suite
|
||||
, public test::enable_yield_to
|
||||
{
|
||||
public:
|
||||
|
@@ -8,7 +8,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/rfc2616.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace beast {
|
||||
namespace rfc2616 {
|
||||
namespace test {
|
||||
|
||||
class rfc2616_test : public beast::detail::unit_test::suite
|
||||
class rfc2616_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void
|
||||
|
@@ -16,14 +16,14 @@
|
||||
#include <beast/http/write.hpp>
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/to_string.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/error.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class write_test : public beast::detail::unit_test::suite
|
||||
class write_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
struct string_SyncStream
|
||||
|
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/detail/unit_test/amount.hpp>
|
||||
#include <beast/detail/unit_test/global_suites.hpp>
|
||||
#include <beast/detail/unit_test/match.hpp>
|
||||
#include <beast/detail/unit_test/reporter.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/detail/stream/debug_ostream.hpp>
|
||||
#include <beast/unit_test/amount.hpp>
|
||||
#include <beast/unit_test/global_suites.hpp>
|
||||
#include <beast/unit_test/match.hpp>
|
||||
#include <beast/unit_test/reporter.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/debug_ostream.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@@ -40,9 +40,6 @@
|
||||
#include <cstdlib>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
inline
|
||||
namespace unit_test {
|
||||
|
||||
std::string
|
||||
@@ -82,7 +79,6 @@ print(Log& log)
|
||||
}
|
||||
|
||||
} // unit_test
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
// Simple main used to produce stand
|
||||
@@ -90,7 +86,7 @@ print(Log& log)
|
||||
int main(int ac, char const* av[])
|
||||
{
|
||||
using namespace std;
|
||||
using namespace beast::detail::unit_test;
|
||||
using namespace beast::unit_test;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
{
|
||||
@@ -113,7 +109,7 @@ int main(int ac, char const* av[])
|
||||
po::store(po::parse_command_line(ac, av, desc), vm);
|
||||
po::notify(vm);
|
||||
|
||||
beast::detail::debug_ostream log;
|
||||
beast::debug_ostream log;
|
||||
|
||||
if(vm.count("help"))
|
||||
{
|
||||
|
@@ -9,13 +9,13 @@
|
||||
#include <beast/prepare_buffers.hpp>
|
||||
|
||||
#include <beast/consuming_buffers.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class prepare_buffers_test : public beast::detail::unit_test::suite
|
||||
class prepare_buffers_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template<class ConstBufferSequence>
|
||||
|
@@ -8,13 +8,13 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/static_streambuf.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class static_streambuf_test : public beast::detail::unit_test::suite
|
||||
class static_streambuf_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
template<class ConstBufferSequence>
|
||||
|
@@ -8,11 +8,11 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/static_string.hpp>
|
||||
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class static_string_test : public beast::detail::unit_test::suite
|
||||
class static_string_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void testMembers()
|
||||
|
@@ -9,12 +9,12 @@
|
||||
#include <beast/streambuf_readstream.hpp>
|
||||
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class streambuf_readstream_test : public beast::detail::unit_test::suite
|
||||
class streambuf_readstream_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void testSpecial()
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/to_string.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
@@ -26,7 +26,7 @@ namespace beast {
|
||||
namespace websocket {
|
||||
|
||||
class stream_test
|
||||
: public beast::detail::unit_test::suite
|
||||
: public beast::unit_test::suite
|
||||
, public test::enable_yield_to
|
||||
{
|
||||
public:
|
||||
|
@@ -9,13 +9,13 @@
|
||||
#include <beast/websocket/detail/utf8_checker.hpp>
|
||||
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <array>
|
||||
|
||||
namespace beast {
|
||||
namespace websocket {
|
||||
|
||||
class utf8_checker_test : public beast::detail::unit_test::suite
|
||||
class utf8_checker_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void
|
||||
|
@@ -8,11 +8,11 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/write_streambuf.hpp>
|
||||
#include <beast/streambuf.hpp>
|
||||
#include <beast/detail/unit_test/suite.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class write_streambuf_test : public beast::detail::unit_test::suite
|
||||
class write_streambuf_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void run() override
|
||||
|
Reference in New Issue
Block a user