Toolbox
snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
toolbox
util
StreamInserter.ut.cpp
Go to the documentation of this file.
1
// The Reactive C++ Toolbox.
2
// Copyright (C) 2022 Reactive Markets Limited
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
16
#include "
StreamInserter.hpp
"
17
18
#include <boost/test/unit_test.hpp>
19
20
using namespace
std
;
21
using namespace
toolbox
;
22
23
namespace
{
24
auto
start_tag
(
const
char
*
s
)
25
{
26
return
make_stream_inserter<ostream>
([=](ostream& os) { os <<
'<'
<<
s
<<
'>'
; });
27
}
28
auto
end_tag
(
const
char
*
s
)
29
{
30
return
make_stream_inserter<ostream>
([=](ostream& os) { os <<
"</"
<<
s
<<
'>'
; });
31
}
32
}
// namespace
33
34
BOOST_AUTO_TEST_SUITE
(
StreamInserterSuite
)
35
36
BOOST_AUTO_TEST_CASE
(
StreamInserterCase
)
37
{
38
stringstream
ss
;
39
ss
<<
start_tag
(
"foo"
) <<
"bar"
<<
end_tag
(
"foo"
);
40
BOOST_CHECK_EQUAL
(
ss
.str(),
"<foo>bar</foo>"
s
);
41
}
42
43
BOOST_AUTO_TEST_SUITE_END
()
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(v.size(), 10U)
StreamInserter.hpp
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(StreamInserterCase)
Definition
StreamInserter.ut.cpp:36
std
STL namespace.
toolbox::util::bind
constexpr auto bind() noexcept
Definition
Slot.hpp:92
toolbox
Definition
Benchmark.cpp:26
Generated by
1.9.8