2 The software in this package is distributed under the GNU General
3 Public License version 2 (with a special exception described below).
5 A copy of GNU General Public License (GPL) is included in this distribution,
6 in the file COPYING.GPL.
8 As a special exception, if other files instantiate templates or use macros
9 or inline functions from this file, or you compile this file and link it
10 with other works to produce a work based on this file, this file
11 does not by itself cause the resulting work to be covered
12 by the GNU General Public License.
14 However the source code for this file must still be made available
15 in accordance with section (3) of the GNU General Public License.
17 This exception does not invalidate any other reasons why a work based
18 on this file might be covered by the GNU General Public License.
21 * test cases for Tribool
23 * (c) Copyright 2012 by Intra2net AG
33 #define BOOST_TEST_DYN_LINK
34 #include <boost/test/unit_test.hpp>
36 #include <tribool.hpp>
39 #define DOUT(msg) std::cout << msg << std::endl
41 #define DOUT(msg) do {} while (0)
47 class TestTriboolFixture
59 BOOST_FIXTURE_TEST_SUITE(TestTriool, TestTriboolFixture)
61 BOOST_AUTO_TEST_CASE(CompareTribool1)
68 BOOST_CHECK_EQUAL(a, b);
71 BOOST_AUTO_TEST_CASE(CompareTribool2)
78 BOOST_CHECK_EQUAL(a, b);
81 BOOST_AUTO_TEST_CASE(CompareTribool3)
88 BOOST_CHECK_EQUAL(a, b);
91 BOOST_AUTO_TEST_CASE(CompareTribool4)
101 BOOST_AUTO_TEST_CASE(CompareTribool5)
111 BOOST_AUTO_TEST_CASE(IsExact1)
113 Tribool a=Tribool::False;
115 BOOST_CHECK_EQUAL(a.is_exact(false),true);
118 BOOST_AUTO_TEST_CASE(IsExact2)
120 Tribool a=Tribool::True;
122 BOOST_CHECK_EQUAL(a.is_exact(true),true);
125 BOOST_AUTO_TEST_CASE(IsExact3)
127 Tribool a=Tribool::True;
129 BOOST_CHECK_EQUAL(a.is_exact(false),false);
132 BOOST_AUTO_TEST_CASE(IsExact4)
134 Tribool a=Tribool::Undef;
136 BOOST_CHECK_EQUAL(a.is_exact(false),false);
139 BOOST_AUTO_TEST_CASE(IsExact5)
141 Tribool a=Tribool::Undef;
143 BOOST_CHECK_EQUAL(a.is_exact(true),false);
146 BOOST_AUTO_TEST_CASE(OStream)
148 Tribool a=Tribool::True;
149 Tribool b=Tribool::False;
150 Tribool c=Tribool::Undef;
156 BOOST_CHECK_EQUAL(os.str(), "10?");
159 BOOST_AUTO_TEST_SUITE_END()