stream: add minimal scoped flag test case

This commit is contained in:
Danny Robson 2017-01-09 15:54:47 +11:00
parent e1aacef7a2
commit c0f3983ca8
2 changed files with 40 additions and 0 deletions

View File

@ -452,6 +452,7 @@ TEST_BIN = \
test/region \
test/roots/bisection \
test/signal \
test/stream \
test/string \
test/stringid \
test/strongdef \

39
test/stream.cpp Normal file
View File

@ -0,0 +1,39 @@
#include "tap.hpp"
#include "stream.hpp"
///////////////////////////////////////////////////////////////////////////////
template <typename T>
void
test_scoped (util::TAP::logger&);
//-----------------------------------------------------------------------------
template <>
void
test_scoped<util::stream::scoped::flags> (util::TAP::logger &tap)
{
std::ostringstream os;
{
util::stream::scoped::flags f (os);
os << std::hex;
}
os << 15;
tap.expect_eq (os.str (), "15", "stream::scoped::flag reverts std::hex");
}
///////////////////////////////////////////////////////////////////////////////
int
main (int, char **)
{
util::TAP::logger tap;
test_scoped<util::stream::scoped::flags> (tap);
return tap.status ();
}