1 /******************************************************************************
3 * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
20 #include "base/value.h"
21 #include <boost/test/unit_test.hpp>
23 using namespace icinga;
25 BOOST_AUTO_TEST_SUITE(base_value)
27 BOOST_AUTO_TEST_CASE(scalar)
32 BOOST_CHECK(v.IsScalar());
35 BOOST_CHECK(v.IsScalar());
38 BOOST_CHECK(!v.IsScalar());
41 BOOST_AUTO_TEST_CASE(convert)
44 BOOST_CHECK(v.IsEmpty());
46 BOOST_CHECK(static_cast<double>(v) == 0);
47 BOOST_CHECK(!v.IsScalar());
48 BOOST_CHECK(!v.IsObjectType<Object>());
50 BOOST_CHECK(v + "hello" == "hello");
51 BOOST_CHECK("hello" + v == "hello");
54 BOOST_AUTO_TEST_CASE(format)
58 std::ostringstream obuf;
61 BOOST_CHECK(obuf.str() == "3");
63 std::istringstream ibuf("3");
69 BOOST_AUTO_TEST_SUITE_END()