Tidy up tests, build scripts, and documentation:

* Concepts split up into individual files
* Function definitions moved to .ipp files
* Add more tests to fill gaps in coverage
* Fix documentation Xsl
This commit is contained in:
Vinnie Falco
2017-07-20 08:12:06 -07:00
parent c309f53ed2
commit 313620ce7e
92 changed files with 2915 additions and 1808 deletions
+10 -2
View File
@@ -10,17 +10,23 @@ add_executable (core-tests
basic_streambuf.cpp
bind_handler.cpp
buffer_cat.cpp
buffer_concepts.cpp
buffers_adapter.cpp
consuming_buffers.cpp
handler_alloc.cpp
handler_concepts.cpp
http.cpp
placeholders.cpp
prepare_buffers.cpp
static_streambuf.cpp
static_string.cpp
stream_concepts.cpp
streambuf.cpp
streambuf_readstream.cpp
to_string.cpp
type_check.cpp
version.cpp
websocket.cpp
write_streambuf.cpp
detail/base64.cpp
detail/empty_base_optimization.cpp
)
@@ -34,13 +40,14 @@ add_executable (http-tests
main.cpp
http/basic_headers.cpp
http/basic_parser_v1.cpp
http/body_type.cpp
http/empty_body.cpp
http/error.cpp
http/headers.cpp
http/message.cpp
http/message_v1.cpp
http/parse_error.cpp
http/parser.cpp
http/parser_v1.cpp
http/read.cpp
http/reason.cpp
http/resume_context.cpp
@@ -49,6 +56,7 @@ add_executable (http-tests
http/status.cpp
http/streambuf_body.cpp
http/string_body.cpp
http/type_check.cpp
http/write.cpp
)
+10 -2
View File
@@ -13,17 +13,23 @@ unit-test core-tests :
basic_streambuf.cpp
bind_handler.cpp
buffer_cat.cpp
buffer_concepts.cpp
buffers_adapter.cpp
consuming_buffers.cpp
handler_alloc.cpp
handler_concepts.cpp
http.cpp
placeholders.cpp
prepare_buffers.cpp
static_streambuf.cpp
static_string.cpp
stream_concepts.cpp
streambuf.cpp
streambuf_readstream.cpp
to_string.cpp
type_check.cpp
version.cpp
websocket.cpp
write_streambuf.cpp
detail/base64.cpp
detail/empty_base_optimization.cpp
;
@@ -32,13 +38,14 @@ unit-test http-tests :
main.cpp
http/basic_headers.cpp
http/basic_parser_v1.cpp
http/body_type.cpp
http/empty_body.cpp
http/error.cpp
http/headers.cpp
http/message.cpp
http/message_v1.cpp
http/parse_error.cpp
http/parser.cpp
http/parser_v1.cpp
http/read.cpp
http/reason.cpp
http/resume_context.cpp
@@ -47,6 +54,7 @@ unit-test http-tests :
http/status.cpp
http/streambuf_body.cpp
http/string_body.cpp
http/type_check.cpp
http/write.cpp
;
+7 -2
View File
@@ -16,7 +16,6 @@
#include <string>
namespace beast {
namespace test {
struct test_allocator_info
{
@@ -327,16 +326,22 @@ public:
}
}
void testStream()
{
streambuf sb;
sb << "x";
}
void run() override
{
testPrepare();
testStreambuf();
testSpecial();
testAllocator();
testStream();
}
};
BEAST_DEFINE_TESTSUITE(basic_streambuf,core,beast);
} // test
} // beast
-2
View File
@@ -12,7 +12,6 @@
#include <functional>
namespace beast {
namespace test {
class bind_handler_test : public detail::unit_test::suite
{
@@ -33,5 +32,4 @@ public:
BEAST_DEFINE_TESTSUITE(bind_handler,core,beast);
} // test
} // beast
-2
View File
@@ -16,7 +16,6 @@
#include <vector>
namespace beast {
namespace test {
class buffer_cat_test : public detail::unit_test::suite
{
@@ -77,5 +76,4 @@ public:
BEAST_DEFINE_TESTSUITE(buffer_cat,core,beast);
} // test
} // beast
+25
View File
@@ -0,0 +1,25 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/buffer_concepts.hpp>
namespace beast {
namespace {
struct T
{
};
}
static_assert(is_ConstBufferSequence<detail::ConstBufferSequence>::value, "");
static_assert(! is_ConstBufferSequence<T>::value, "");
static_assert(is_MutableBufferSequence<detail::MutableBufferSequence>::value, "");
static_assert(! is_MutableBufferSequence<T>::value, "");
} // beast
-2
View File
@@ -14,7 +14,6 @@
#include <iterator>
namespace beast {
namespace test {
class buffers_adapter_test : public detail::unit_test::suite
{
@@ -158,5 +157,4 @@ public:
BEAST_DEFINE_TESTSUITE(buffers_adapter,core,beast);
} // test
} // beast
+1 -3
View File
@@ -13,7 +13,6 @@
#include <string>
namespace beast {
namespace test {
class consuming_buffers_test : public beast::detail::unit_test::suite
{
@@ -89,7 +88,6 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(consuming_buffers,asio,beast);
BEAST_DEFINE_TESTSUITE(consuming_buffers,core,beast);
} // test
} // beast
+1 -1
View File
@@ -47,7 +47,7 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(base64,detail,beast);
BEAST_DEFINE_TESTSUITE(base64,core,beast);
} // test
} // beast
+1 -1
View File
@@ -103,7 +103,7 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(empty_base_optimization,detail,beast);
BEAST_DEFINE_TESTSUITE(empty_base_optimization,core,beast);
} // test
} // beast
+20 -1
View File
@@ -6,4 +6,23 @@
//
// Test that header file is self-contained.
#include <beast/handler_alloc.hpp>
#include <beast/to_string.hpp>
#include <beast/detail/unit_test/suite.hpp>
#include <boost/asio/buffer.hpp>
namespace beast {
class to_string_test : public beast::detail::unit_test::suite
{
public:
void run()
{
expect(to_string(boost::asio::const_buffers_1("x", 1)) == "x");
}
};
BEAST_DEFINE_TESTSUITE(to_string,core,beast);
} // beast
+23
View File
@@ -0,0 +1,23 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/handler_concepts.hpp>
namespace beast {
namespace {
struct T
{
void operator()(int);
};
}
static_assert(is_CompletionHandler<T, void(int)>::value, "");
static_assert(! is_CompletionHandler<T, void(void)>::value, "");
} // beast
+1 -1
View File
@@ -6,4 +6,4 @@
//
// Test that header file is self-contained.
#include <beast/type_check.hpp>
#include <beast/http.hpp>
+9
View File
@@ -0,0 +1,9 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/http/body_type.hpp>
+9
View File
@@ -0,0 +1,9 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/http/body_type.hpp>
+1 -1
View File
@@ -13,7 +13,7 @@
#include <beast/http/error.hpp>
#include <beast/http/message_v1.hpp>
#include <beast/http/rfc2616.hpp>
#include <beast/type_check.hpp>
#include <beast/buffer_concepts.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/system/error_code.hpp>
#include <cstdint>
@@ -15,7 +15,7 @@
namespace beast {
namespace http {
class parser_test : public beast::detail::unit_test::suite
class parser_v1_test : public beast::detail::unit_test::suite
{
public:
void run() override
@@ -64,7 +64,7 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(parser,http,beast);
BEAST_DEFINE_TESTSUITE(parser_v1,http,beast);
} // http
} // beast
+1 -3
View File
@@ -14,7 +14,6 @@
#include <string>
namespace beast {
namespace test {
class prepare_buffers_test : public beast::detail::unit_test::suite
{
@@ -95,7 +94,6 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(prepare_buffers,asio,beast);
BEAST_DEFINE_TESTSUITE(prepare_buffers,core,beast);
} // test
} // beast
+2 -2
View File
@@ -17,8 +17,8 @@
*/
//==============================================================================
#ifndef BEAST_EXAMPLE_SIG_WAIT_H_INCLUDED
#define BEAST_EXAMPLE_SIG_WAIT_H_INCLUDED
#ifndef BEAST_TEST_SIG_WAIT_H_INCLUDED
#define BEAST_TEST_SIG_WAIT_H_INCLUDED
#include <boost/asio.hpp>
#include <condition_variable>
+1 -3
View File
@@ -13,7 +13,6 @@
#include <string>
namespace beast {
namespace test {
class static_streambuf_test : public beast::detail::unit_test::suite
{
@@ -146,7 +145,6 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(static_streambuf,asio,beast);
BEAST_DEFINE_TESTSUITE(static_streambuf,core,beast);
} // test
} // beastp
+1 -3
View File
@@ -11,7 +11,6 @@
#include <beast/detail/unit_test/suite.hpp>
namespace beast {
namespace websocket {
class static_string_test : public beast::detail::unit_test::suite
{
@@ -185,7 +184,6 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(static_string,websocket,beast);
BEAST_DEFINE_TESTSUITE(static_string,core,beast);
} // websocket
} // beast
+30
View File
@@ -0,0 +1,30 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/stream_concepts.hpp>
#include <boost/asio/ip/tcp.hpp>
namespace beast {
using stream_type = boost::asio::ip::tcp::socket;
static_assert(has_get_io_service<stream_type>::value, "");
static_assert(is_AsyncReadStream<stream_type>::value, "");
static_assert(is_AsyncWriteStream<stream_type>::value, "");
static_assert(is_AsyncStream<stream_type>::value, "");
static_assert(is_SyncReadStream<stream_type>::value, "");
static_assert(is_SyncWriteStream<stream_type>::value, "");
static_assert(is_SyncStream<stream_type>::value, "");
static_assert(! has_get_io_service<int>::value, "");
static_assert(! is_AsyncReadStream<int>::value, "");
static_assert(! is_AsyncWriteStream<int>::value, "");
static_assert(! is_SyncReadStream<int>::value, "");
static_assert(! is_SyncWriteStream<int>::value, "");
} // beast
+1
View File
@@ -7,3 +7,4 @@
// Test that header file is self-contained.
#include <beast/to_string.hpp>
+9
View File
@@ -0,0 +1,9 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/version.hpp>
+9
View File
@@ -0,0 +1,9 @@
//
// 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)
//
// Test that header file is self-contained.
#include <beast/websocket.hpp>
+2 -2
View File
@@ -85,7 +85,7 @@ public:
template<class MutableBufferSequence, class ReadHandler>
typename async_completion<ReadHandler,
void(std::size_t, error_code)>::result_type
void(error_code, std::size_t)>::result_type
async_read_some(MutableBufferSequence const& buffers,
ReadHandler&& handler)
{
@@ -120,7 +120,7 @@ public:
template<class ConstBuffeSequence, class WriteHandler>
typename async_completion<WriteHandler,
void(std::size_t, error_code)>::result_type
void(error_code, std::size_t)>::result_type
async_write_some(ConstBuffeSequence const& buffers,
WriteHandler&& handler)
{