From c0f3983ca890383ef4e48f4dc7477c0b399314b6 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 9 Jan 2017 15:54:47 +1100 Subject: [PATCH] stream: add minimal scoped flag test case --- Makefile.am | 1 + test/stream.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 test/stream.cpp diff --git a/Makefile.am b/Makefile.am index 9c8e3f84..b182b40b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -452,6 +452,7 @@ TEST_BIN = \ test/region \ test/roots/bisection \ test/signal \ + test/stream \ test/string \ test/stringid \ test/strongdef \ diff --git a/test/stream.cpp b/test/stream.cpp new file mode 100644 index 00000000..320ef3ff --- /dev/null +++ b/test/stream.cpp @@ -0,0 +1,39 @@ +#include "tap.hpp" + +#include "stream.hpp" + + +/////////////////////////////////////////////////////////////////////////////// +template +void +test_scoped (util::TAP::logger&); + + +//----------------------------------------------------------------------------- +template <> +void +test_scoped (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 (tap); + + return tap.status (); +}