]> granicus.if.org Git - icinga2/blob - test/base-netstring.cpp
Merge pull request #6999 from Icinga/bugfix/compiler-warnings
[icinga2] / test / base-netstring.cpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "base/netstring.hpp"
4 #include "base/fifo.hpp"
5 #include <BoostTestTargetConfig.h>
6
7 using namespace icinga;
8
9 BOOST_AUTO_TEST_SUITE(base_netstring)
10
11 BOOST_AUTO_TEST_CASE(netstring)
12 {
13         FIFO::Ptr fifo = new FIFO();
14
15         NetString::WriteStringToStream(fifo, "hello");
16
17         String s;
18         StreamReadContext src;
19         BOOST_CHECK(NetString::ReadStringFromStream(fifo, &s, src) == StatusNewItem);
20         BOOST_CHECK(s == "hello");
21
22         fifo->Close();
23 }
24
25 BOOST_AUTO_TEST_SUITE_END()