summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/logic
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/logic
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/logic')
-rw-r--r--src/boost/libs/logic/CMakeLists.txt20
-rw-r--r--src/boost/libs/logic/Jamfile10
-rw-r--r--src/boost/libs/logic/LICENSE23
-rw-r--r--src/boost/libs/logic/README.md34
-rw-r--r--src/boost/libs/logic/index.html16
-rw-r--r--src/boost/libs/logic/meta/libraries.json15
-rw-r--r--src/boost/libs/logic/test/Jamfile.v262
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit.cpp23
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/operator_less_1.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/operator_less_2.cpp15
-rw-r--r--src/boost/libs/logic/test/compile/decl_header.cpp24
-rw-r--r--src/boost/libs/logic/test/tribool_io_test.cpp210
-rw-r--r--src/boost/libs/logic/test/tribool_rename_test.cpp123
-rw-r--r--src/boost/libs/logic/test/tribool_test.cpp154
17 files changed, 793 insertions, 0 deletions
diff --git a/src/boost/libs/logic/CMakeLists.txt b/src/boost/libs/logic/CMakeLists.txt
new file mode 100644
index 000000000..4951cb626
--- /dev/null
+++ b/src/boost/libs/logic/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright 2018 Mike Dev
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
+#
+# NOTE: CMake support for Boost.Logic is currently experimental at best
+# and the interface is likely to change in the future
+
+cmake_minimum_required( VERSION 3.5 )
+project( BoostLogic LANGUAGES CXX )
+
+add_library( boost_logic INTERFACE )
+add_library( Boost::logic ALIAS boost_logic )
+
+target_include_directories( boost_logic INTERFACE include )
+
+target_link_libraries( boost_logic
+ INTERFACE
+ Boost::config
+ Boost::core
+)
diff --git a/src/boost/libs/logic/Jamfile b/src/boost/libs/logic/Jamfile
new file mode 100644
index 000000000..df4894635
--- /dev/null
+++ b/src/boost/libs/logic/Jamfile
@@ -0,0 +1,10 @@
+# Boost.Logic Library Jamfile
+#
+# Copyright (c) 2018 James E. King III
+#
+# Use, modification, and distribution are subject to the
+# Boost Software License, Version 1.0. (See accompanying file
+# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+# please order by name to ease maintenance
+build-project test ;
diff --git a/src/boost/libs/logic/LICENSE b/src/boost/libs/logic/LICENSE
new file mode 100644
index 000000000..36b7cd93c
--- /dev/null
+++ b/src/boost/libs/logic/LICENSE
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/src/boost/libs/logic/README.md b/src/boost/libs/logic/README.md
new file mode 100644
index 000000000..a71ecd322
--- /dev/null
+++ b/src/boost/libs/logic/README.md
@@ -0,0 +1,34 @@
+Logic, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides `boost::logic::tribool` for 3-state boolean logic.
+
+### License
+
+Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
+
+### Properties
+
+* C++03
+* Header Only
+
+### Build Status
+
+Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
+:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
+[`master`](https://github.com/boostorg/logic/tree/master) | [![Build Status](https://travis-ci.org/boostorg/logic.svg?branch=master)](https://travis-ci.org/boostorg/logic) | [![Build status](https://ci.appveyor.com/api/projects/status/a898pj8spmo2t3x9/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/logic-vv3ct/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16173/badge.svg)](https://scan.coverity.com/projects/boostorg-logic) | [![codecov](https://codecov.io/gh/boostorg/logic/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/logic/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/logic.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/logic.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/logic.html)
+[`develop`](https://github.com/boostorg/logic/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/logic.svg?branch=develop)](https://travis-ci.org/boostorg/logic) | [![Build status](https://ci.appveyor.com/api/projects/status/a898pj8spmo2t3x9/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/logic-vv3ct/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16173/badge.svg)](https://scan.coverity.com/projects/boostorg-logic) | [![codecov](https://codecov.io/gh/boostorg/logic/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/logic/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/logic.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/logic.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/logic.html)
+
+### Directories
+
+| Name | Purpose |
+| ----------- | ------------------------------ |
+| `doc` | documentation |
+| `example` | examples |
+| `include` | headers |
+| `test` | unit tests |
+
+### More information
+
+* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-logic)
+* [Report bugs](https://github.com/boostorg/logic/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
+* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
+* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[logic]` tag at the beginning of the subject line.
+
diff --git a/src/boost/libs/logic/index.html b/src/boost/libs/logic/index.html
new file mode 100644
index 000000000..6ae39d47f
--- /dev/null
+++ b/src/boost/libs/logic/index.html
@@ -0,0 +1,16 @@
+
+<!--
+Copyright 2011 Daniel James.
+Distributed under the Boost Software License, Version 1.0. (See accompanying
+file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+
+<html>
+<head>
+ <meta http-equiv="refresh" content="0; URL=../../doc/html/tribool.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../../doc/html/tribool.html">../../doc/html/tribool.html</a>
+</body>
+</html>
diff --git a/src/boost/libs/logic/meta/libraries.json b/src/boost/libs/logic/meta/libraries.json
new file mode 100644
index 000000000..d7e4934fe
--- /dev/null
+++ b/src/boost/libs/logic/meta/libraries.json
@@ -0,0 +1,15 @@
+{
+ "key": "logic/tribool",
+ "name": "Tribool",
+ "authors": [
+ "Doug Gregor"
+ ],
+ "description": "3-state boolean type library.",
+ "documentation": "/doc/html/tribool.html",
+ "category": [
+ "Miscellaneous"
+ ],
+ "maintainers": [
+ "Douglas Gregor <dgregor -at- cs.indiana.edu>"
+ ]
+}
diff --git a/src/boost/libs/logic/test/Jamfile.v2 b/src/boost/libs/logic/test/Jamfile.v2
new file mode 100644
index 000000000..994f2b6b5
--- /dev/null
+++ b/src/boost/libs/logic/test/Jamfile.v2
@@ -0,0 +1,62 @@
+# Tribool library
+
+# Copyright (C) 2002-2003 Douglas Gregor
+
+# Use, modification and distribution is subject to the Boost Software License,
+# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# For more information, see http://www.boost.org/
+
+import path ;
+import os ;
+import regex ;
+import testing ;
+
+local self = logic ;
+
+rule test-expected-failures
+{
+ local all_rules = ;
+ local file ;
+ local tests_path = [ path.make $(BOOST_ROOT)/libs/$(self)/test/compile-fail ] ;
+ for file in [ path.glob-tree $(tests_path) : *.cpp ]
+ {
+ local rel_file = [ path.relative-to $(tests_path) $(file) ] ;
+ local test_name = [ regex.replace [ regex.replace $(rel_file) "/" "-" ] ".cpp" "" ] ;
+ local decl_test_name = cf-$(test_name) ;
+ # ECHO $(rel_file) ;
+ all_rules += [ compile-fail $(file) : : $(decl_test_name) ] ;
+ }
+
+ # ECHO All rules: $(all_rules) ;
+ return $(all_rules) ;
+}
+
+rule test-header-isolation
+{
+ local all_rules = ;
+ local file ;
+ local headers_path = [ path.make $(BOOST_ROOT)/libs/$(self)/include ] ;
+ for file in [ path.glob-tree $(headers_path) : *.hpp ]
+ {
+ local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
+ # Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
+ # All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
+ local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
+ local decl_test_name = ~hdr-decl-$(test_name) ;
+ # ECHO $(rel_file) ;
+ all_rules += [ compile compile/decl_header.cpp : <define>"BOOST_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
+ }
+
+ # ECHO All rules: $(all_rules) ;
+ return $(all_rules) ;
+}
+
+ test-suite logic :
+ [ test-expected-failures ]
+ [ test-header-isolation ]
+ [ run tribool_test.cpp ]
+ [ run tribool_rename_test.cpp ]
+ [ run tribool_io_test.cpp ]
+ ;
diff --git a/src/boost/libs/logic/test/compile-fail/implicit.cpp b/src/boost/libs/logic/test/compile-fail/implicit.cpp
new file mode 100644
index 000000000..ba56bfb86
--- /dev/null
+++ b/src/boost/libs/logic/test/compile-fail/implicit.cpp
@@ -0,0 +1,23 @@
+// Copyright 2018 James E. King III. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/logic/tribool.hpp>
+
+int main(int, char*[])
+{
+ using boost::logic::indeterminate;
+ using boost::logic::tribool;
+
+ tribool i(indeterminate);
+
+#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS )
+ bool b = i; // expect to see: no viable conversion from 'boost::logic::tribool' to 'bool'
+ return (int)b;
+#else
+#error in c++03 explicit conversions are allowed
+#endif
+ // NOTREACHED
+ return 0;
+}
diff --git a/src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp b/src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp
new file mode 100644
index 000000000..4e889550c
--- /dev/null
+++ b/src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp
@@ -0,0 +1,16 @@
+// Copyright 2018 James E. King III. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/logic/tribool.hpp>
+
+int main(int, char*[])
+{
+ using boost::logic::indeterminate;
+ using boost::logic::tribool;
+
+ tribool i(indeterminate);
+
+ return i; // expect to see: error: no viable conversion from returned value of type 'boost::logic::tribool' to function return type 'int'
+}
diff --git a/src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp b/src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp
new file mode 100644
index 000000000..1401caaa7
--- /dev/null
+++ b/src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp
@@ -0,0 +1,16 @@
+// Copyright 2018 James E. King III. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/logic/tribool.hpp>
+
+int main(int, char*[])
+{
+ using boost::logic::indeterminate;
+ using boost::logic::tribool;
+
+ tribool i(indeterminate);
+
+ return i + 1; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'int')
+}
diff --git a/src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp b/src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp
new file mode 100644
index 000000000..b6548c5a8
--- /dev/null
+++ b/src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp
@@ -0,0 +1,16 @@
+// Copyright 2018 James E. King III. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/logic/tribool.hpp>
+
+int main(int, char*[])
+{
+ using boost::logic::indeterminate;
+ using boost::logic::tribool;
+
+ tribool i(indeterminate);
+
+ return i << 1; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'int')
+}
diff --git a/src/boost/libs/logic/test/compile-fail/operator_less_1.cpp b/src/boost/libs/logic/test/compile-fail/operator_less_1.cpp
new file mode 100644
index 000000000..31be7aeef
--- /dev/null
+++ b/src/boost/libs/logic/test/compile-fail/operator_less_1.cpp
@@ -0,0 +1,16 @@
+// Copyright 2018 James E. King III. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/logic/tribool.hpp>
+
+int main(int, char*[])
+{
+ using boost::logic::tribool;
+
+ tribool f; // false
+ tribool t(true); // true
+
+ return f < t; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'boost::logic::tribool')
+}
diff --git a/src/boost/libs/logic/test/compile-fail/operator_less_2.cpp b/src/boost/libs/logic/test/compile-fail/operator_less_2.cpp
new file mode 100644
index 000000000..53fc359a8
--- /dev/null
+++ b/src/boost/libs/logic/test/compile-fail/operator_less_2.cpp
@@ -0,0 +1,15 @@
+// Copyright 2018 James E. King III. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/logic/tribool.hpp>
+
+int main(int, char*[])
+{
+ using boost::logic::tribool;
+
+ tribool t(true);
+
+ return t < 1; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'int')
+}
diff --git a/src/boost/libs/logic/test/compile/decl_header.cpp b/src/boost/libs/logic/test/compile/decl_header.cpp
new file mode 100644
index 000000000..2a2862618
--- /dev/null
+++ b/src/boost/libs/logic/test/compile/decl_header.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright Andrey Semashev 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file decl_header.cpp
+ * \author Andrey Semashev
+ * \date 21.06.2015
+ *
+ * \brief This file contains a test boilerplate for checking that every
+ * public header is self-contained and does not have any missing
+ * #includes.
+ */
+
+#define BOOST_TEST_INCLUDE_HEADER() <BOOST_TEST_HEADER>
+
+#include BOOST_TEST_INCLUDE_HEADER()
+
+int main(int, char*[])
+{
+ return 0;
+}
diff --git a/src/boost/libs/logic/test/tribool_io_test.cpp b/src/boost/libs/logic/test/tribool_io_test.cpp
new file mode 100644
index 000000000..c2d502129
--- /dev/null
+++ b/src/boost/libs/logic/test/tribool_io_test.cpp
@@ -0,0 +1,210 @@
+// Copyright Douglas Gregor 2002-2004. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#include <boost/logic/tribool.hpp>
+#include <boost/logic/tribool_io.hpp>
+#include <boost/test/minimal.hpp>
+#include <sstream>
+#include <string>
+#include <iostream>
+#include <ios> // for std::boolalpha
+
+#ifndef BOOST_NO_STD_LOCALE
+# include <locale>
+#endif
+
+int test_main(int, char*[])
+{
+ using namespace boost::logic;
+
+ tribool x;
+
+ #if !defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_STD_WSTRING)
+ std::wostringstream wout;
+ wout << std::boolalpha << tribool(false);
+ BOOST_CHECK(wout.str() == L"false");
+ wout.str(std::wstring());
+ wout << std::boolalpha << tribool(true);
+ BOOST_CHECK(wout.str() == L"true");
+ wout.str(std::wstring());
+ wout << std::boolalpha << tribool(indeterminate);
+ BOOST_CHECK(wout.str() == L"indeterminate");
+ #endif
+
+ // Check tribool output
+ std::ostringstream out;
+
+ // Output false (noboolalpha)
+ out.str(std::string());
+ x = false;
+ out << x;
+ std::cout << "Output false (noboolalpha): " << out.str() << std::endl;
+ BOOST_CHECK(out.str() == "0");
+
+ // Output true (noboolalpha)
+ out.str(std::string());
+ x = true;
+ out << x;
+ std::cout << "Output true (noboolalpha): " << out.str() << std::endl;
+ BOOST_CHECK(out.str() == "1");
+
+ // Output indeterminate (noboolalpha)
+ out.str(std::string());
+ x = indeterminate;
+ out << x;
+ std::cout << "Output indeterminate (noboolalpha): " << out.str()
+ << std::endl;
+ BOOST_CHECK(out.str() == "2");
+
+ // Output indeterminate (noboolalpha)
+ out.str(std::string());
+ out << indeterminate;
+ std::cout << "Output indeterminate (noboolalpha): " << out.str()
+ << std::endl;
+ BOOST_CHECK(out.str() == "2");
+
+#ifndef BOOST_NO_STD_LOCALE
+ const std::numpunct<char>& punct =
+ BOOST_USE_FACET(std::numpunct<char>, out.getloc());
+
+ // Output false (boolalpha)
+ out.str(std::string());
+ x = false;
+ out << std::boolalpha << x;
+ std::cout << "Output false (boolalpha): " << out.str() << std::endl;
+ BOOST_CHECK(out.str() == punct.falsename());
+
+ // Output true (boolalpha)
+ out.str(std::string());
+ x = true;
+ out << std::boolalpha << x;
+ std::cout << "Output true (boolalpha): " << out.str() << std::endl;
+
+ BOOST_CHECK(out.str() == punct.truename());
+
+ // Output indeterminate (boolalpha - default name)
+ out.str(std::string());
+ x = indeterminate;
+ out << std::boolalpha << x;
+ std::cout << "Output indeterminate (boolalpha - default name): " << out.str()
+ << std::endl;
+ BOOST_CHECK(out.str() == "indeterminate");
+
+ // Output indeterminate (boolalpha - default name)
+ out.str(std::string());
+ out << std::boolalpha << indeterminate;
+ std::cout << "Output indeterminate (boolalpha - default name): " << out.str()
+ << std::endl;
+ BOOST_CHECK(out.str() == "indeterminate");
+
+# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
+ // No template constructors, so we can't build the test locale
+# else
+ // Give indeterminate a new name, and output it via boolalpha
+ std::locale global;
+ std::locale test_locale(global, new indeterminate_name<char>("maybe"));
+ out.imbue(test_locale);
+ out.str(std::string());
+ out << std::boolalpha << x;
+ std::cout << "Output indeterminate (boolalpha - \"maybe\"): " << out.str()
+ << std::endl;
+ BOOST_CHECK(out.str() == "maybe");
+# endif
+#endif // ! BOOST_NO_STD_LOCALE
+
+ // Checking tribool input
+
+ // Input false (noboolalpha)
+ {
+ std::istringstream in("0");
+ std::cout << "Input \"0\" (checks for false)" << std::endl;
+ in >> x;
+ BOOST_CHECK(x == false);
+ }
+
+ // Input true (noboolalpha)
+ {
+ std::istringstream in("1");
+ std::cout << "Input \"1\" (checks for true)" << std::endl;
+ in >> x;
+ BOOST_CHECK(x == true);
+ }
+
+ // Input false (noboolalpha)
+ {
+ std::istringstream in("2");
+ std::cout << "Input \"2\" (checks for indeterminate)" << std::endl;
+ in >> x;
+ BOOST_CHECK(indeterminate(x));
+ }
+
+ // Input bad number (noboolalpha)
+ {
+ std::istringstream in("3");
+ std::cout << "Input \"3\" (checks for failure)" << std::endl;
+ BOOST_CHECK(!(in >> x));
+ }
+
+ // Input false (boolalpha)
+ {
+ std::istringstream in("false");
+ std::cout << "Input \"false\" (checks for false)" << std::endl;
+ in >> std::boolalpha >> x;
+ BOOST_CHECK(x == false);
+ }
+
+ // Input true (boolalpha)
+ {
+ std::istringstream in("true");
+ std::cout << "Input \"true\" (checks for true)" << std::endl;
+ in >> std::boolalpha >> x;
+ BOOST_CHECK(x == true);
+ }
+
+ // Input indeterminate (boolalpha)
+ {
+ std::istringstream in("indeterminate");
+ std::cout << "Input \"indeterminate\" (checks for indeterminate)"
+ << std::endl;
+ in >> std::boolalpha >> x;
+ BOOST_CHECK(indeterminate(x));
+ }
+
+ // Input bad string (boolalpha)
+ {
+ std::istringstream in("bad");
+ std::cout << "Input \"bad\" (checks for failure)"
+ << std::endl;
+ BOOST_CHECK(!(in >> std::boolalpha >> x));
+ }
+
+#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
+ // No template constructors, so we can't build the test locale
+#elif !defined(BOOST_NO_STD_LOCALE)
+
+ // Input indeterminate named "maybe" (boolalpha)
+ {
+ std::istringstream in("maybe");
+ in.imbue(test_locale);
+ std::cout << "Input \"maybe\" (checks for indeterminate, uses locales)"
+ << std::endl;
+ in >> std::boolalpha >> x;
+ BOOST_CHECK(indeterminate(x));
+ }
+
+ // Input indeterminate named "true_or_false" (boolalpha)
+ {
+ std::locale my_locale(global,
+ new indeterminate_name<char>("true_or_false"));
+ std::istringstream in("true_or_false");
+ in.imbue(my_locale);
+ std::cout << "Input \"true_or_false\" (checks for indeterminate)"
+ << std::endl;
+ in >> std::boolalpha >> x;
+ BOOST_CHECK(indeterminate(x));
+ }
+#endif
+
+ return 0;
+}
diff --git a/src/boost/libs/logic/test/tribool_rename_test.cpp b/src/boost/libs/logic/test/tribool_rename_test.cpp
new file mode 100644
index 000000000..3a5b066b3
--- /dev/null
+++ b/src/boost/libs/logic/test/tribool_rename_test.cpp
@@ -0,0 +1,123 @@
+// Copyright Douglas Gregor 2002-2003. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// For more information, see http://www.boost.org
+
+#include <boost/logic/tribool.hpp>
+#include <boost/test/minimal.hpp>
+#include <iostream>
+
+BOOST_TRIBOOL_THIRD_STATE(maybe)
+
+int test_main(int,char*[])
+{
+ using namespace boost::logic;
+
+ tribool x; // false
+ tribool y(true); // true
+ tribool z(maybe); // maybe
+
+ BOOST_CHECK(!x);
+ BOOST_CHECK(x == false);
+ BOOST_CHECK(false == x);
+ BOOST_CHECK(x != true);
+ BOOST_CHECK(true != x);
+ BOOST_CHECK(maybe(x == maybe));
+ BOOST_CHECK(maybe(maybe == x));
+ BOOST_CHECK(maybe(x != maybe));
+ BOOST_CHECK(maybe(maybe != x));
+ BOOST_CHECK(x == x);
+ BOOST_CHECK(!(x != x));
+ BOOST_CHECK(!(x && true));
+ BOOST_CHECK(!(true && x));
+ BOOST_CHECK(x || true);
+ BOOST_CHECK(true || x);
+
+ BOOST_CHECK(y);
+ BOOST_CHECK(y == true);
+ BOOST_CHECK(true == y);
+ BOOST_CHECK(y != false);
+ BOOST_CHECK(false != y);
+ BOOST_CHECK(maybe(y == maybe));
+ BOOST_CHECK(maybe(maybe == y));
+ BOOST_CHECK(maybe(y != maybe));
+ BOOST_CHECK(maybe(maybe != y));
+ BOOST_CHECK(y == y);
+ BOOST_CHECK(!(y != y));
+
+ BOOST_CHECK(maybe(z || !z));
+ BOOST_CHECK(maybe(z == true));
+ BOOST_CHECK(maybe(true == z));
+ BOOST_CHECK(maybe(z == false));
+ BOOST_CHECK(maybe(false == z));
+ BOOST_CHECK(maybe(z == maybe));
+ BOOST_CHECK(maybe(maybe == z));
+ BOOST_CHECK(maybe(z != maybe));
+ BOOST_CHECK(maybe(maybe != z));
+ BOOST_CHECK(maybe(z == z));
+ BOOST_CHECK(maybe(z != z));
+
+ BOOST_CHECK(!(x == y));
+ BOOST_CHECK(x != y);
+ BOOST_CHECK(maybe(x == z));
+ BOOST_CHECK(maybe(x != z));
+ BOOST_CHECK(maybe(y == z));
+ BOOST_CHECK(maybe(y != z));
+
+ BOOST_CHECK(!(x && y));
+ BOOST_CHECK(x || y);
+ BOOST_CHECK(!(x && z));
+ BOOST_CHECK(maybe(y && z));
+ BOOST_CHECK(maybe(z && z));
+ BOOST_CHECK(maybe(z || z));
+ BOOST_CHECK(maybe(x || z));
+ BOOST_CHECK(y || z);
+
+ BOOST_CHECK(maybe(y && maybe));
+ BOOST_CHECK(maybe(maybe && y));
+ BOOST_CHECK(!(x && maybe));
+ BOOST_CHECK(!(maybe && x));
+
+ BOOST_CHECK(maybe || y);
+ BOOST_CHECK(y || maybe);
+ BOOST_CHECK(maybe(x || maybe));
+ BOOST_CHECK(maybe(maybe || x));
+
+ // Test the if (z) ... else (!z) ... else ... idiom
+ if (z) {
+ BOOST_CHECK(false);
+ }
+ else if (!z) {
+ BOOST_CHECK(false);
+ }
+ else {
+ BOOST_CHECK(true);
+ }
+
+ z = true;
+ if (z) {
+ BOOST_CHECK(true);
+ }
+ else if (!z) {
+ BOOST_CHECK(false);
+ }
+ else {
+ BOOST_CHECK(false);
+ }
+
+ z = false;
+ if (z) {
+ BOOST_CHECK(false);
+ }
+ else if (!z) {
+ BOOST_CHECK(true);
+ }
+ else {
+ BOOST_CHECK(false);
+ }
+
+ std::cout << "no errors detected\n";
+ return 0;
+}
diff --git a/src/boost/libs/logic/test/tribool_test.cpp b/src/boost/libs/logic/test/tribool_test.cpp
new file mode 100644
index 000000000..3781e3734
--- /dev/null
+++ b/src/boost/libs/logic/test/tribool_test.cpp
@@ -0,0 +1,154 @@
+// Copyright Douglas Gregor 2002-2003. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/config.hpp>
+#include <boost/logic/tribool.hpp>
+#include <boost/test/minimal.hpp>
+#include <iostream>
+
+int test_main(int, char*[])
+{
+ using namespace boost::logic;
+
+ tribool x; // false
+ tribool y(true); // true
+ tribool z(indeterminate); // indeterminate
+
+#if defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS )
+ // c++03 allows for implicit conversion to bool
+ // c++11 uses an explicit conversion operator so this would not compile
+ // and that is tested in the compile-fail/implicit.cpp file
+ // so we check the conversion to ensure it is sane
+ bool bx = x;
+ BOOST_CHECK(bx == false);
+ bool by = y;
+ BOOST_CHECK(by == true);
+ bool bz = z;
+ BOOST_CHECK(bz == false);
+#endif
+
+ BOOST_CHECK(!x);
+ BOOST_CHECK(x == false);
+ BOOST_CHECK(false == x);
+ BOOST_CHECK(x != true);
+ BOOST_CHECK(true != x);
+ BOOST_CHECK(indeterminate(x == indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate == x));
+ BOOST_CHECK(indeterminate(x != indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate != x));
+ BOOST_CHECK(x == x);
+ BOOST_CHECK(!(x != x));
+ BOOST_CHECK(!(x && true));
+ BOOST_CHECK(!(true && x));
+ BOOST_CHECK(x || true);
+ BOOST_CHECK(true || x);
+
+ BOOST_CHECK(y);
+ BOOST_CHECK(y == true);
+ BOOST_CHECK(true == y);
+ BOOST_CHECK(y != false);
+ BOOST_CHECK(false != y);
+ BOOST_CHECK(indeterminate(y == indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate == y));
+ BOOST_CHECK(indeterminate(y != indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate != y));
+ BOOST_CHECK(y == y);
+ BOOST_CHECK(!(y != y));
+
+ BOOST_CHECK(indeterminate(z || !z));
+ BOOST_CHECK(indeterminate(z == true));
+ BOOST_CHECK(indeterminate(true == z));
+ BOOST_CHECK(indeterminate(z == false));
+ BOOST_CHECK(indeterminate(false == z));
+ BOOST_CHECK(indeterminate(z == indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate == z));
+ BOOST_CHECK(indeterminate(z != indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate != z));
+ BOOST_CHECK(indeterminate(z == z));
+ BOOST_CHECK(indeterminate(z != z));
+
+ BOOST_CHECK(!(x == y));
+ BOOST_CHECK(x != y);
+ BOOST_CHECK(indeterminate(x == z));
+ BOOST_CHECK(indeterminate(x != z));
+ BOOST_CHECK(indeterminate(y == z));
+ BOOST_CHECK(indeterminate(y != z));
+
+ BOOST_CHECK(!(x && y));
+ BOOST_CHECK(x || y);
+ BOOST_CHECK(!(x && z));
+ BOOST_CHECK(indeterminate(y && z));
+ BOOST_CHECK(indeterminate(z && z));
+ BOOST_CHECK(indeterminate(z || z));
+ BOOST_CHECK(indeterminate(x || z));
+ BOOST_CHECK(y || z);
+
+ BOOST_CHECK(indeterminate(y && indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate && y));
+ BOOST_CHECK(!(x && indeterminate));
+ BOOST_CHECK(!(indeterminate && x));
+
+ BOOST_CHECK(indeterminate || y);
+ BOOST_CHECK(y || indeterminate);
+ BOOST_CHECK(indeterminate(x || indeterminate));
+ BOOST_CHECK(indeterminate(indeterminate || x));
+
+ // Test the if (z) ... else (!z) ... else ... idiom
+ if (z) {
+ BOOST_CHECK(false);
+ }
+ else if (!z) {
+ BOOST_CHECK(false);
+ }
+ else {
+ BOOST_CHECK(true);
+ }
+
+ z = true;
+ if (z) {
+ BOOST_CHECK(true);
+ }
+ else if (!z) {
+ BOOST_CHECK(false);
+ }
+ else {
+ BOOST_CHECK(false);
+ }
+
+ z = false;
+ if (z) {
+ BOOST_CHECK(false);
+ }
+ else if (!z) {
+ BOOST_CHECK(true);
+ }
+ else {
+ BOOST_CHECK(false);
+ }
+
+#if !defined(BOOST_NO_CXX11_CONSTEXPR)
+ constexpr bool res_ors = indeterminate(false || tribool(false) || false || indeterminate); // true
+ BOOST_CHECK(res_ors);
+ char array_ors[res_ors ? 2 : 3];
+ BOOST_CHECK(sizeof(array_ors) / sizeof(char) == 2);
+
+ constexpr bool res_ands = !indeterminate(!(true && tribool(true) && true && indeterminate)); // false
+ BOOST_CHECK(!res_ands);
+ char array_ands[res_ands ? 2 : 3];
+ BOOST_CHECK(sizeof(array_ands) / sizeof(char) == 3);
+
+ constexpr bool res_safe_bool = static_cast<bool>( tribool(true) );
+ BOOST_STATIC_ASSERT(res_safe_bool);
+
+// gcc 4.6 chokes on the xxx assignment
+# if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
+ constexpr tribool xxx = (tribool(true) || tribool(indeterminate));
+ BOOST_STATIC_ASSERT(xxx);
+# endif
+#endif
+
+ std::cout << "no errors detected\n";
+ return 0;
+}