From d206a7b5eda517496d8168a855bcbba1675dfcbd Mon Sep 17 00:00:00 2001
From: Mike Dev
Date: Sat, 22 Sep 2018 22:33:21 +0200
Subject: [PATCH 01/10] [CMake] Add minimal cmake file
Generate cmake target that can be used by other libraries
to express their dependency on this library and retrieve
any configuration information such as the include directory,
transitive dependencies, necessary compiler options or the
required c++ standards level.
---
CMakeLists.txt | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..9869747
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,16 @@
+# 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
+
+cmake_minimum_required(VERSION 3.5)
+project(BoostIO LANGUAGES CXX)
+
+add_library(boost_io INTERFACE)
+add_library(Boost::io ALIAS boost_io)
+
+target_include_directories(boost_io INTERFACE include)
+
+target_link_libraries(boost_io
+ INTERFACE
+ Boost::config
+)
From 20f343cc0373459c4513d829f5a6a66abcb63310 Mon Sep 17 00:00:00 2001
From: Mike Dev
Date: Mon, 12 Nov 2018 10:37:13 +0100
Subject: [PATCH 02/10] [CMake] Add test for cmake file
---
.travis.yml | 12 ++++++++++++
test/test_cmake/CMakeLists.txt | 16 ++++++++++++++++
test/test_cmake/main.cpp | 5 +++++
3 files changed, 33 insertions(+)
create mode 100644 test/test_cmake/CMakeLists.txt
create mode 100644 test/test_cmake/main.cpp
diff --git a/.travis.yml b/.travis.yml
index 1c23ece..4837e72 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,18 @@ branches:
- master
- develop
+matrix:
+ include:
+ - os: linux
+ env: TEST_CMAKE=TRUE #Only for easier identification in travis web gui
+ install:
+ - git clone --depth 1 https://github.com/boostorg/config.git ../config
+
+ script:
+ - mkdir __build__ && cd __build__
+ - cmake ../test/test_cmake
+ - cmake --build .
+
install:
- cd ..
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt
new file mode 100644
index 0000000..0384dae
--- /dev/null
+++ b/test/test_cmake/CMakeLists.txt
@@ -0,0 +1,16 @@
+# 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: This does NOT run the unit tests for Boost.IO.
+# It only tests, if the CMakeLists.txt file in it's root works as expected
+
+cmake_minimum_required( VERSION 3.5 )
+
+project( BoostIoCMakeSelfTest )
+
+add_subdirectory( ../../../config ${CMAKE_CURRENT_BINARY_DIR}/libs/config )
+add_subdirectory( ../.. ${CMAKE_CURRENT_BINARY_DIR}/libs/io )
+
+add_executable( boost_io_cmake_self_test main.cpp )
+target_link_libraries( boost_io_cmake_self_test Boost::io )
diff --git a/test/test_cmake/main.cpp b/test/test_cmake/main.cpp
new file mode 100644
index 0000000..e5c3372
--- /dev/null
+++ b/test/test_cmake/main.cpp
@@ -0,0 +1,5 @@
+#include
+#include
+
+int main() {
+}
From fbceb17be37b7e218841dc2101d2a81eb2de06c4 Mon Sep 17 00:00:00 2001
From: Mike Dev
Date: Mon, 12 Nov 2018 13:59:42 +0100
Subject: [PATCH 03/10] [CMake] Small formatting and comment changes
---
CMakeLists.txt | 12 ++++++------
test/test_cmake/CMakeLists.txt | 3 ++-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9869747..1078f1b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,15 +2,15 @@
# 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
-cmake_minimum_required(VERSION 3.5)
-project(BoostIO LANGUAGES CXX)
+cmake_minimum_required( VERSION 3.5 )
+project( BoostIO LANGUAGES CXX )
-add_library(boost_io INTERFACE)
-add_library(Boost::io ALIAS boost_io)
+add_library( boost_io INTERFACE )
+add_library( Boost::io ALIAS boost_io )
-target_include_directories(boost_io INTERFACE include)
+target_include_directories( boost_io INTERFACE include )
-target_link_libraries(boost_io
+target_link_libraries( boost_io
INTERFACE
Boost::config
)
diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt
index 0384dae..46bfcf4 100644
--- a/test/test_cmake/CMakeLists.txt
+++ b/test/test_cmake/CMakeLists.txt
@@ -3,7 +3,8 @@
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#
# NOTE: This does NOT run the unit tests for Boost.IO.
-# It only tests, if the CMakeLists.txt file in it's root works as expected
+# It only tests, if the CMakeLists.txt file in the
+# Boost.IO root directory works as expected.
cmake_minimum_required( VERSION 3.5 )
From 3a643e558d9aff59355c8f8e93ffa2df4821caee Mon Sep 17 00:00:00 2001
From: Edward Diener
Date: Wed, 19 Dec 2018 22:19:48 -0500
Subject: [PATCH 04/10] Updated for b2 cmake support.
---
.travis.yml | 2 ++
appveyor.yml | 2 ++
2 files changed, 4 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 4837e72..8f51e97 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,6 +36,8 @@ install:
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
+ - git submodule update --init tools/boost_install
+ - git submodule update --init libs/headers
- cp -r $TRAVIS_BUILD_DIR/* libs/io
- python tools/boostdep/depinst/depinst.py io
- ./bootstrap.sh
diff --git a/appveyor.yml b/appveyor.yml
index b1857e3..8890e60 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -25,6 +25,8 @@ install:
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
+ - git submodule update --init tools/boost_install
+ - git submodule update --init libs/headers
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\io
- python tools/boostdep/depinst/depinst.py io
- bootstrap
From 4255fe9abeb05ccddf107ea8ac0d8cedec8e6e3b Mon Sep 17 00:00:00 2001
From: Glen Fernandes
Date: Thu, 12 Dec 2019 21:27:05 -0500
Subject: [PATCH 05/10] Update Travis and Appveyor configurations
---
.appveyor.yml | 56 ++++++++++
.travis.yml | 284 ++++++++++++++++++++++++++++++++++++++++++++++----
appveyor.yml | 38 -------
3 files changed, 320 insertions(+), 58 deletions(-)
create mode 100644 .appveyor.yml
delete mode 100644 appveyor.yml
diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 0000000..eee4d10
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,56 @@
+# Copyright 2019 Glen Fernandes
+# Distributed under the Boost Software License, Version 1.0.
+
+version: 1.0.{build}-{branch}
+
+shallow_clone: true
+
+branches:
+ only:
+ - master
+ - develop
+
+environment:
+ matrix:
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ TOOLSET: msvc-9.0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ TOOLSET: msvc-10.0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ TOOLSET: msvc-11.0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ TOOLSET: msvc-12.0
+ ADDRMD: 32,64
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ TOOLSET: msvc-14.0
+ ADDRMD: 32,64
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ TOOLSET: msvc-14.1
+ ADDRMD: 32,64
+ CXXSTD: 14,17
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ TOOLSET: clang-win
+ ADDRMD: 32,64
+ CXXSTD: 14,17
+
+install:
+ - set BOOST_BRANCH=develop
+ - if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
+ - cd ..
+ - git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost
+ - cd boost
+ - git submodule update --init tools/build
+ - git submodule update --init libs/config
+ - git submodule update --init tools/boostdep
+ - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\io\
+ - python tools/boostdep/depinst/depinst.py io
+ - cmd /c bootstrap
+ - b2 headers
+
+build: off
+
+test_script:
+ - PATH=%ADDPATH%%PATH%
+ - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
+ - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
+ - b2 libs/io/test toolset=%TOOLSET% %CXXSTD% %ADDRMD%
diff --git a/.travis.yml b/.travis.yml
index 8f51e97..82da550 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,53 +1,297 @@
# Copyright 2017 Edward Diener
+# Copyright 2019 Glen Fernandes
# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
sudo: false
-python: "2.7"
+dist: trusty
-os:
- - linux
- - osx
+python: "2.7"
branches:
only:
- master
- develop
+env:
+ matrix:
+ - BOGUS_JOB=true
+
matrix:
+
+ exclude:
+ - env: BOGUS_JOB=true
+
include:
- os: linux
- env: TEST_CMAKE=TRUE #Only for easier identification in travis web gui
- install:
- - git clone --depth 1 https://github.com/boostorg/config.git ../config
+ compiler: g++
+ env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
- script:
- - mkdir __build__ && cd __build__
- - cmake ../test/test_cmake
- - cmake --build .
+ - os: linux
+ compiler: g++-4.4
+ env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
+ addons:
+ apt:
+ packages:
+ - g++-4.4
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-4.6
+ env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
+ addons:
+ apt:
+ packages:
+ - g++-4.6
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-4.7
+ env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - g++-4.7
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-4.8
+ env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - g++-4.8
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-4.9
+ env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - g++-4.9
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-5
+ env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - g++-5
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-6
+ env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - g++-6
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-7
+ env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
+ addons:
+ apt:
+ packages:
+ - g++-7
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-8
+ env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a
+ addons:
+ apt:
+ packages:
+ - g++-8
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-9
+ env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a
+ addons:
+ apt:
+ packages:
+ - g++-9
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: clang++
+ env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
+
+ - os: linux
+ compiler: /usr/bin/clang++
+ env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - clang-3.3
+
+ - os: linux
+ compiler: /usr/bin/clang++
+ env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - clang-3.4
+
+ - os: linux
+ compiler: clang++-3.5
+ env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.5
+ - libstdc++-4.9-dev
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.5
+
+ - os: linux
+ compiler: clang++-3.6
+ env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.6
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.6
+
+ - os: linux
+ compiler: clang++-3.7
+ env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.7
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.7
+
+ - os: linux
+ compiler: clang++-3.8
+ env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.8
+ - libstdc++-4.9-dev
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.8
+
+ - os: linux
+ compiler: clang++-3.9
+ env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.9
+ - libstdc++-4.9-dev
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.9
+
+ - os: linux
+ compiler: clang++-4.0
+ env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-4.0
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-4.0
+
+ - os: linux
+ compiler: clang++-5.0
+ env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-5.0
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-5.0
+
+ - os: linux
+ compiler: clang++-6.0
+ env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a
+ addons:
+ apt:
+ packages:
+ - clang-6.0
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-6.0
+
+ - os: linux
+ compiler: clang++-7
+ env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
+ addons:
+ apt:
+ packages:
+ - clang-7
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-7
+
+ - os: linux
+ compiler: clang++-8
+ env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a
+ addons:
+ apt:
+ packages:
+ - clang-8
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-8
+
+ - os: linux
+ compiler: clang++-libc++
+ env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - libc++-dev
+
+ - os: osx
+ compiler: clang++
+ env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
install:
+ - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- - git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- - cd boost-root
+ - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost
+ - cd boost
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- - git submodule update --init tools/boost_install
- - git submodule update --init libs/headers
+ - mkdir -p libs/io
- cp -r $TRAVIS_BUILD_DIR/* libs/io
- python tools/boostdep/depinst/depinst.py io
- ./bootstrap.sh
- ./b2 headers
script:
- - TOOLSET=gcc,clang
- - if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
- - ./b2 --verbose-test libs/config/test//config_info toolset=$TOOLSET || true
- - ./b2 libs/io/test toolset=$TOOLSET
+ - |-
+ echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
+ - ./b2 libs/io/test toolset=$TOOLSET cxxstd=$CXXSTD
notifications:
email:
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 8890e60..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2017 Edward Diener
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
-
-version: 1.0.{build}-{branch}
-
-shallow_clone: true
-
-branches:
- only:
- - master
- - develop
-
-environment:
- matrix:
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0,msvc-14.0
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- TOOLSET: msvc-14.1
-
-install:
- - cd ..
- - git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- - cd boost-root
- - git submodule update --init tools/build
- - git submodule update --init libs/config
- - git submodule update --init tools/boostdep
- - git submodule update --init tools/boost_install
- - git submodule update --init libs/headers
- - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\io
- - python tools/boostdep/depinst/depinst.py io
- - bootstrap
- - b2 headers
-
-build: off
-
-test_script:
- - b2 libs/io/test toolset=%TOOLSET%
From 69560d45d2301e62490738da707e1768954fff36 Mon Sep 17 00:00:00 2001
From: Glen Fernandes
Date: Thu, 12 Dec 2019 22:22:17 -0500
Subject: [PATCH 06/10] Switch to Lightweight Test for unit tests
---
test/Jamfile.v2 | 31 +--
test/ios_state_test.cpp | 71 ++++---
test/ios_state_unit_test.cpp | 369 +++++++++++++++++------------------
test/quoted_manip_test.cpp | 2 +-
4 files changed, 226 insertions(+), 247 deletions(-)
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
index 4b48bce..8d12343 100644
--- a/test/Jamfile.v2
+++ b/test/Jamfile.v2
@@ -1,26 +1,13 @@
-# Boost.IO Library test Jamfile
+# Copyright 2003 Daryle Walker
#
-# Copyright 2003 Daryle Walker. Use, modification, and distribution
-# are subject to the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or a copy at
-# .)
+# Copyright 2019 Glen Joseph Fernandes
+# (glenjofe@gmail.com)
#
-# See for the library's home page.
+# Distributed under the Boost Software License, Version 1.0.
+# (http://www.boost.org/LICENSE_1_0.txt)
-test-suite "io"
- : [ run ios_state_unit_test.cpp
- ../../../libs/test/build//boost_unit_test_framework/static
- : # args
- : # input files
- # : std::locale-support
- ]
+import testing ;
- [ run ios_state_test.cpp
- ../../../libs/test/build//boost_test_exec_monitor/static
- : # args
- : # input files
- # : std::locale-support
- ]
-
- [ run quoted_manip_test.cpp ]
- ;
+run ios_state_unit_test.cpp ;
+run ios_state_test.cpp ;
+run quoted_manip_test.cpp ;
diff --git a/test/ios_state_test.cpp b/test/ios_state_test.cpp
index 79975f0..4e35c51 100644
--- a/test/ios_state_test.cpp
+++ b/test/ios_state_test.cpp
@@ -4,6 +4,9 @@
// subject to the Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or a copy at .)
+// Copyright 2019 Glen Joseph Fernandes
+// (glenjofe@gmail.com)
+
// See for the library's home page.
// Revision History
@@ -11,9 +14,8 @@
// 26 Feb 2002 Initial version (Daryle Walker)
#include
-#include // main, BOOST_CHECK, etc.
+#include
-#include // for boost::exit_success
#include // for boost::io::ios_flags_saver, etc.
#include // for std::size_t
@@ -68,12 +70,7 @@ void saver_tests_2( std::istream &input, std::ostream &output,
// Test program
-int
-test_main
-(
- int , // "argc" is unused
- char * [] // "argv" is unused
-)
+int main()
{
using std::cout;
using std::ios_base;
@@ -104,35 +101,35 @@ test_main
saver_tests_1( cin, cout, std::cerr );
// Check if states are back to normal
- BOOST_CHECK( &cin == cout.pword(my_index) );
- BOOST_CHECK( 42L == cout.iword(my_index) );
- BOOST_CHECK( cout_locale == cout.getloc() );
- BOOST_CHECK( cout_fill == cout.fill() );
- BOOST_CHECK( cout_sb == cout.rdbuf() );
- BOOST_CHECK( cin_tie == cin.tie() );
- BOOST_CHECK( cout_exceptions == cout.exceptions() );
- BOOST_CHECK( cout_iostate == cout.rdstate() );
- BOOST_CHECK( cout_width == cout.width() );
- BOOST_CHECK( cout_precision == cout.precision() );
- BOOST_CHECK( cout_flags == cout.flags() );
+ BOOST_TEST( &cin == cout.pword(my_index) );
+ BOOST_TEST( 42L == cout.iword(my_index) );
+ BOOST_TEST( cout_locale == cout.getloc() );
+ BOOST_TEST( cout_fill == cout.fill() );
+ BOOST_TEST( cout_sb == cout.rdbuf() );
+ BOOST_TEST( cin_tie == cin.tie() );
+ BOOST_TEST( cout_exceptions == cout.exceptions() );
+ BOOST_TEST( cout_iostate == cout.rdstate() );
+ BOOST_TEST( cout_width == cout.width() );
+ BOOST_TEST( cout_precision == cout.precision() );
+ BOOST_TEST( cout_flags == cout.flags() );
// Run saver tests with combined saving and changing
saver_tests_2( cin, cout, std::cerr );
// Check if states are back to normal
- BOOST_CHECK( &cin == cout.pword(my_index) );
- BOOST_CHECK( 42L == cout.iword(my_index) );
- BOOST_CHECK( cout_locale == cout.getloc() );
- BOOST_CHECK( cout_fill == cout.fill() );
- BOOST_CHECK( cout_sb == cout.rdbuf() );
- BOOST_CHECK( cin_tie == cin.tie() );
- BOOST_CHECK( cout_exceptions == cout.exceptions() );
- BOOST_CHECK( cout_iostate == cout.rdstate() );
- BOOST_CHECK( cout_width == cout.width() );
- BOOST_CHECK( cout_precision == cout.precision() );
- BOOST_CHECK( cout_flags == cout.flags() );
+ BOOST_TEST( &cin == cout.pword(my_index) );
+ BOOST_TEST( 42L == cout.iword(my_index) );
+ BOOST_TEST( cout_locale == cout.getloc() );
+ BOOST_TEST( cout_fill == cout.fill() );
+ BOOST_TEST( cout_sb == cout.rdbuf() );
+ BOOST_TEST( cin_tie == cin.tie() );
+ BOOST_TEST( cout_exceptions == cout.exceptions() );
+ BOOST_TEST( cout_iostate == cout.rdstate() );
+ BOOST_TEST( cout_width == cout.width() );
+ BOOST_TEST( cout_precision == cout.precision() );
+ BOOST_TEST( cout_flags == cout.flags() );
- return boost::exit_success;
+ return boost::report_errors();
}
// Save, change, and restore stream properties
@@ -176,8 +173,8 @@ saver_tests_1
output.imbue( loc );
output << '\t' << test_bool << '\n';
- BOOST_CHECK( &err == output.pword(my_index) );
- BOOST_CHECK( 69L == output.iword(my_index) );
+ BOOST_TEST( &err == output.pword(my_index) );
+ BOOST_TEST( 69L == output.iword(my_index) );
try
{
@@ -195,7 +192,7 @@ saver_tests_1
#endif
{
err << "Got the expected I/O failure: \"" << f.what() << "\".\n";
- BOOST_CHECK( output.exceptions() == ios_base::goodbit );
+ BOOST_TEST( output.exceptions() == ios_base::goodbit );
}
catch ( ... )
{
@@ -239,8 +236,8 @@ saver_tests_2
boost::io::ios_locale_saver const ils( output, loc );
output << '\t' << test_bool << '\n';
- BOOST_CHECK( &err == output.pword(my_index) );
- BOOST_CHECK( 69L == output.iword(my_index) );
+ BOOST_TEST( &err == output.pword(my_index) );
+ BOOST_TEST( 69L == output.iword(my_index) );
try
{
@@ -257,7 +254,7 @@ saver_tests_2
#endif
{
err << "Got the expected I/O failure: \"" << f.what() << "\".\n";
- BOOST_CHECK( output.exceptions() == ios_base::goodbit );
+ BOOST_TEST( output.exceptions() == ios_base::goodbit );
}
catch ( ... )
{
diff --git a/test/ios_state_unit_test.cpp b/test/ios_state_unit_test.cpp
index 6aa2011..7dee6c7 100644
--- a/test/ios_state_unit_test.cpp
+++ b/test/ios_state_unit_test.cpp
@@ -4,6 +4,9 @@
// subject to the Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or a copy at .)
+// Copyright 2019 Glen Joseph Fernandes
+// (glenjofe@gmail.com)
+
// See for the library's home page.
// Revision History
@@ -11,7 +14,7 @@
#include
#include // for boost::io::ios_flags_saver, etc.
-#include // for main, BOOST_CHECK, etc.
+#include
#include // for NULL
#include // for std::setiosflags, etc.
@@ -60,33 +63,33 @@ ios_flags_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
{
boost::io::ios_flags_saver ifs( ss );
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
ss << noskipws << fixed << boolalpha;
- BOOST_CHECK_EQUAL( (ios_base::boolalpha | ios_base::dec
+ BOOST_TEST_EQ( (ios_base::boolalpha | ios_base::dec
| ios_base::fixed), ss.flags() );
}
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
{
boost::io::ios_flags_saver ifs( ss, (ios_base::showbase
| ios_base::internal) );
- BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal),
+ BOOST_TEST_EQ( (ios_base::showbase | ios_base::internal),
ss.flags() );
ss << setiosflags( ios_base::unitbuf );
- BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal
+ BOOST_TEST_EQ( (ios_base::showbase | ios_base::internal
| ios_base::unitbuf), ss.flags() );
}
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
}
// Unit test for precision saving
@@ -99,29 +102,29 @@ ios_precision_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( 6, ss.precision() );
+ BOOST_TEST_EQ( 6, ss.precision() );
{
boost::io::ios_precision_saver ips( ss );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
+ BOOST_TEST_EQ( 6, ss.precision() );
ss << setprecision( 4 );
- BOOST_CHECK_EQUAL( 4, ss.precision() );
+ BOOST_TEST_EQ( 4, ss.precision() );
}
- BOOST_CHECK_EQUAL( 6, ss.precision() );
+ BOOST_TEST_EQ( 6, ss.precision() );
{
boost::io::ios_precision_saver ips( ss, 8 );
- BOOST_CHECK_EQUAL( 8, ss.precision() );
+ BOOST_TEST_EQ( 8, ss.precision() );
ss << setprecision( 10 );
- BOOST_CHECK_EQUAL( 10, ss.precision() );
+ BOOST_TEST_EQ( 10, ss.precision() );
}
- BOOST_CHECK_EQUAL( 6, ss.precision() );
+ BOOST_TEST_EQ( 6, ss.precision() );
}
// Unit test for width saving
@@ -134,29 +137,29 @@ ios_width_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( 0, ss.width() );
{
boost::io::ios_width_saver iws( ss );
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( 0, ss.width() );
ss << setw( 4 );
- BOOST_CHECK_EQUAL( 4, ss.width() );
+ BOOST_TEST_EQ( 4, ss.width() );
}
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( 0, ss.width() );
{
boost::io::ios_width_saver iws( ss, 8 );
- BOOST_CHECK_EQUAL( 8, ss.width() );
+ BOOST_TEST_EQ( 8, ss.width() );
ss << setw( 10 );
- BOOST_CHECK_EQUAL( 10, ss.width() );
+ BOOST_TEST_EQ( 10, ss.width() );
}
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( 0, ss.width() );
}
// Unit test for I/O-state saving
@@ -169,43 +172,43 @@ ios_iostate_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
{
boost::io::ios_iostate_saver iis( ss );
char c;
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
ss >> c;
- BOOST_CHECK_EQUAL( (ios_base::eofbit | ios_base::failbit),
+ BOOST_TEST_EQ( (ios_base::eofbit | ios_base::failbit),
ss.rdstate() );
- BOOST_CHECK( ss.eof() );
- BOOST_CHECK( ss.fail() );
- BOOST_CHECK( !ss.bad() );
+ BOOST_TEST( ss.eof() );
+ BOOST_TEST( ss.fail() );
+ BOOST_TEST( !ss.bad() );
}
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
{
boost::io::ios_iostate_saver iis( ss, ios_base::eofbit );
- BOOST_CHECK_EQUAL( ios_base::eofbit, ss.rdstate() );
- BOOST_CHECK( ss.eof() );
+ BOOST_TEST_EQ( ios_base::eofbit, ss.rdstate() );
+ BOOST_TEST( ss.eof() );
ss.setstate( ios_base::badbit );
- BOOST_CHECK_EQUAL( (ios_base::eofbit | ios_base::badbit),
+ BOOST_TEST_EQ( (ios_base::eofbit | ios_base::badbit),
ss.rdstate() );
- BOOST_CHECK( ss.eof() );
- BOOST_CHECK( ss.fail() );
- BOOST_CHECK( ss.bad() );
+ BOOST_TEST( ss.eof() );
+ BOOST_TEST( ss.fail() );
+ BOOST_TEST( ss.bad() );
}
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
}
// Unit test for exception-flag saving
@@ -218,15 +221,15 @@ ios_exception_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
{
boost::io::ios_exception_saver ies( ss );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
ss.exceptions( ios_base::failbit );
- BOOST_CHECK_EQUAL( ios_base::failbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::failbit, ss.exceptions() );
{
boost::io::ios_iostate_saver iis( ss );
@@ -234,32 +237,32 @@ ios_exception_saver_unit_test
char c;
#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
- BOOST_CHECK_THROW( ss >> c, std::exception );
+ BOOST_TEST_THROWS( ss >> c, std::exception );
#else
- BOOST_CHECK_THROW( ss >> c, std::ios_base::failure );
+ BOOST_TEST_THROWS( ss >> c, std::ios_base::failure );
#endif
}
}
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
{
boost::io::ios_exception_saver ies( ss, ios_base::eofbit );
- BOOST_CHECK_EQUAL( ios_base::eofbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::eofbit, ss.exceptions() );
ss.exceptions( ios_base::badbit );
- BOOST_CHECK_EQUAL( ios_base::badbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::badbit, ss.exceptions() );
{
boost::io::ios_iostate_saver iis( ss );
char c;
- BOOST_CHECK_NO_THROW( ss >> c );
+ BOOST_TEST_NOT( ss >> c );
}
}
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
}
// Unit test for tied-stream saving
@@ -270,29 +273,29 @@ ios_tie_saver_unit_test
{
using namespace std;
- BOOST_CHECK( NULL == cout.tie() );
+ BOOST_TEST( NULL == cout.tie() );
{
boost::io::ios_tie_saver its( cout );
- BOOST_CHECK( NULL == cout.tie() );
+ BOOST_TEST( NULL == cout.tie() );
cout.tie( &clog );
- BOOST_CHECK_EQUAL( &clog, cout.tie() );
+ BOOST_TEST_EQ( &clog, cout.tie() );
}
- BOOST_CHECK( NULL == cout.tie() );
+ BOOST_TEST( NULL == cout.tie() );
{
boost::io::ios_tie_saver its( cout, &clog );
- BOOST_CHECK_EQUAL( &clog, cout.tie() );
+ BOOST_TEST_EQ( &clog, cout.tie() );
cout.tie( &cerr );
- BOOST_CHECK_EQUAL( &cerr, cout.tie() );
+ BOOST_TEST_EQ( &cerr, cout.tie() );
}
- BOOST_CHECK( NULL == cout.tie() );
+ BOOST_TEST( NULL == cout.tie() );
}
// Unit test for connected-streambuf saving
@@ -305,31 +308,31 @@ ios_rdbuf_saver_unit_test
iostream s( NULL );
- BOOST_CHECK( NULL == s.rdbuf() );
+ BOOST_TEST( NULL == s.rdbuf() );
{
stringbuf sb;
boost::io::ios_rdbuf_saver irs( s );
- BOOST_CHECK( NULL == s.rdbuf() );
+ BOOST_TEST( NULL == s.rdbuf() );
s.rdbuf( &sb );
- BOOST_CHECK_EQUAL( &sb, s.rdbuf() );
+ BOOST_TEST_EQ( &sb, s.rdbuf() );
}
- BOOST_CHECK( NULL == s.rdbuf() );
+ BOOST_TEST( NULL == s.rdbuf() );
{
stringbuf sb1, sb2( "Hi there" );
boost::io::ios_rdbuf_saver irs( s, &sb1 );
- BOOST_CHECK_EQUAL( &sb1, s.rdbuf() );
+ BOOST_TEST_EQ( &sb1, s.rdbuf() );
s.rdbuf( &sb2 );
- BOOST_CHECK_EQUAL( &sb2, s.rdbuf() );
+ BOOST_TEST_EQ( &sb2, s.rdbuf() );
}
- BOOST_CHECK( NULL == s.rdbuf() );
+ BOOST_TEST( NULL == s.rdbuf() );
}
// Unit test for fill-character saving
@@ -342,29 +345,29 @@ ios_fill_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
{
boost::io::ios_fill_saver ifs( ss );
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
ss.fill( 'x' );
- BOOST_CHECK_EQUAL( 'x', ss.fill() );
+ BOOST_TEST_EQ( 'x', ss.fill() );
}
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
{
boost::io::ios_fill_saver ifs( ss, '3' );
- BOOST_CHECK_EQUAL( '3', ss.fill() );
+ BOOST_TEST_EQ( '3', ss.fill() );
ss.fill( '+' );
- BOOST_CHECK_EQUAL( '+', ss.fill() );
+ BOOST_TEST_EQ( '+', ss.fill() );
}
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
}
// Unit test for locale saving
@@ -379,48 +382,48 @@ ios_locale_saver_unit_test
stringstream ss;
- BOOST_CHECK( locale() == ss.getloc() );
- // locales are unprintable, so no BOOST_CHECK_EQUAL
- BOOST_CHECK( !has_facet(ss.getloc()) || (NULL
+ BOOST_TEST( locale() == ss.getloc() );
+ // locales are unprintable, so no BOOST_TEST_EQ
+ BOOST_TEST( !has_facet(ss.getloc()) || (NULL
== dynamic_cast(
&use_facet(ss.getloc()) )) );
// my implementation of has_facet just checks IDs, but doesn't do dynamic
// cast (therefore if a specifc facet type is missing, but its base class
// is available, has_facet will mistakenly[?] match), so I have to do it
- // here. I wanted: "BOOST_CHECK( ! has_facet< backward_bool_names >(
+ // here. I wanted: "BOOST_TEST( ! has_facet< backward_bool_names >(
// ss.getloc() ) )"
{
boost::io::ios_locale_saver ils( ss );
- BOOST_CHECK( locale() == ss.getloc() );
+ BOOST_TEST( locale() == ss.getloc() );
ss.imbue( locale::classic() );
- BOOST_CHECK( locale::classic() == ss.getloc() );
+ BOOST_TEST( locale::classic() == ss.getloc() );
}
- BOOST_CHECK( locale() == ss.getloc() );
- BOOST_CHECK( !has_facet(ss.getloc()) || (NULL
+ BOOST_TEST( locale() == ss.getloc() );
+ BOOST_TEST( !has_facet(ss.getloc()) || (NULL
== dynamic_cast(
&use_facet(ss.getloc()) )) );
{
boost::io::ios_locale_saver ils( ss, locale::classic() );
- BOOST_CHECK( locale::classic() == ss.getloc() );
- BOOST_CHECK( !has_facet(ss.getloc()) || (NULL
+ BOOST_TEST( locale::classic() == ss.getloc() );
+ BOOST_TEST( !has_facet(ss.getloc()) || (NULL
== dynamic_cast(
&use_facet(ss.getloc()) )) );
ss.imbue( locale(locale::classic(), new backward_bool_names) );
- BOOST_CHECK( locale::classic() != ss.getloc() );
- BOOST_CHECK( has_facet(ss.getloc()) && (NULL
+ BOOST_TEST( locale::classic() != ss.getloc() );
+ BOOST_TEST( has_facet(ss.getloc()) && (NULL
!= dynamic_cast(
&use_facet(ss.getloc()) )) );
- //BOOST_CHECK( has_facet(ss.getloc()) );
+ //BOOST_TEST( has_facet(ss.getloc()) );
}
- BOOST_CHECK( locale() == ss.getloc() );
- BOOST_CHECK( !has_facet(ss.getloc()) || (NULL
+ BOOST_TEST( locale() == ss.getloc() );
+ BOOST_TEST( !has_facet(ss.getloc()) || (NULL
== dynamic_cast(
&use_facet(ss.getloc()) )) );
}
@@ -435,29 +438,29 @@ ios_iword_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
{
boost::io::ios_iword_saver iis( ss, word_index );
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
ss.iword( word_index ) = 6;
- BOOST_CHECK_EQUAL( 6, ss.iword(word_index) );
+ BOOST_TEST_EQ( 6, ss.iword(word_index) );
}
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
{
boost::io::ios_iword_saver iis( ss, word_index, 100 );
- BOOST_CHECK_EQUAL( 100, ss.iword(word_index) );
+ BOOST_TEST_EQ( 100, ss.iword(word_index) );
ss.iword( word_index ) = -2000;
- BOOST_CHECK_EQUAL( -2000, ss.iword(word_index) );
+ BOOST_TEST_EQ( -2000, ss.iword(word_index) );
}
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
}
// Unit test for user-defined pointer data saving
@@ -470,29 +473,29 @@ ios_pword_saver_unit_test
stringstream ss;
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
{
boost::io::ios_pword_saver ips( ss, word_index );
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
ss.pword( word_index ) = &ss;
- BOOST_CHECK_EQUAL( &ss, ss.pword(word_index) );
+ BOOST_TEST_EQ( &ss, ss.pword(word_index) );
}
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
{
boost::io::ios_pword_saver ips( ss, word_index, ss.rdbuf() );
- BOOST_CHECK_EQUAL( ss.rdbuf(), ss.pword(word_index) );
+ BOOST_TEST_EQ( ss.rdbuf(), ss.pword(word_index) );
ss.pword( word_index ) = &ss;
- BOOST_CHECK_EQUAL( &ss, ss.pword(word_index) );
+ BOOST_TEST_EQ( &ss, ss.pword(word_index) );
}
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
}
// Unit test for all ios_base data saving
@@ -505,27 +508,27 @@ ios_base_all_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( 6, ss.precision() );
+ BOOST_TEST_EQ( 0, ss.width() );
{
boost::io::ios_base_all_saver ibas( ss );
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( 6, ss.precision() );
+ BOOST_TEST_EQ( 0, ss.width() );
ss << hex << unitbuf << setprecision( 5 ) << setw( 7 );
- BOOST_CHECK_EQUAL( (ios_base::unitbuf | ios_base::hex
+ BOOST_TEST_EQ( (ios_base::unitbuf | ios_base::hex
| ios_base::skipws), ss.flags() );
- BOOST_CHECK_EQUAL( 5, ss.precision() );
- BOOST_CHECK_EQUAL( 7, ss.width() );
+ BOOST_TEST_EQ( 5, ss.precision() );
+ BOOST_TEST_EQ( 7, ss.width() );
}
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
- BOOST_CHECK_EQUAL( 0, ss.width() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( 6, ss.precision() );
+ BOOST_TEST_EQ( 0, ss.width() );
}
// Unit test for all basic_ios data saving
@@ -541,46 +544,46 @@ ios_all_saver_unit_test
stringbuf sb;
iostream ss( &sb );
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
- BOOST_CHECK_EQUAL( 0, ss.width() );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
- BOOST_CHECK( NULL == ss.tie() );
- BOOST_CHECK( &sb == ss.rdbuf() );
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
- BOOST_CHECK( locale() == ss.getloc() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( 6, ss.precision() );
+ BOOST_TEST_EQ( 0, ss.width() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST( NULL == ss.tie() );
+ BOOST_TEST( &sb == ss.rdbuf() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
+ BOOST_TEST( locale() == ss.getloc() );
{
boost::io::ios_all_saver ias( ss );
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
- BOOST_CHECK_EQUAL( 0, ss.width() );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
- BOOST_CHECK( NULL == ss.tie() );
- BOOST_CHECK( &sb == ss.rdbuf() );
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
- BOOST_CHECK( locale() == ss.getloc() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( 6, ss.precision() );
+ BOOST_TEST_EQ( 0, ss.width() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST( NULL == ss.tie() );
+ BOOST_TEST( &sb == ss.rdbuf() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
+ BOOST_TEST( locale() == ss.getloc() );
ss << oct << showpos << noskipws;
- BOOST_CHECK_EQUAL( (ios_base::showpos | ios_base::oct), ss.flags() );
+ BOOST_TEST_EQ( (ios_base::showpos | ios_base::oct), ss.flags() );
ss << setprecision( 3 );
- BOOST_CHECK_EQUAL( 3, ss.precision() );
+ BOOST_TEST_EQ( 3, ss.precision() );
ss << setw( 9 );
- BOOST_CHECK_EQUAL( 9, ss.width() );
+ BOOST_TEST_EQ( 9, ss.width() );
ss.setstate( ios_base::eofbit );
- BOOST_CHECK_EQUAL( ios_base::eofbit, ss.rdstate() );
- BOOST_CHECK( ss.eof() );
+ BOOST_TEST_EQ( ios_base::eofbit, ss.rdstate() );
+ BOOST_TEST( ss.eof() );
ss.exceptions( ios_base::failbit );
- BOOST_CHECK_EQUAL( ios_base::failbit, ss.exceptions() );
+ BOOST_TEST_EQ( ios_base::failbit, ss.exceptions() );
{
boost::io::ios_iostate_saver iis( ss );
@@ -588,38 +591,38 @@ ios_all_saver_unit_test
char c;
#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
- BOOST_CHECK_THROW( ss >> c, std::exception );
+ BOOST_TEST_THROWS( ss >> c, std::exception );
#else
- BOOST_CHECK_THROW( ss >> c, std::ios_base::failure );
+ BOOST_TEST_THROWS( ss >> c, std::ios_base::failure );
#endif
}
ss.tie( &clog );
- BOOST_CHECK_EQUAL( &clog, ss.tie() );
+ BOOST_TEST_EQ( &clog, ss.tie() );
ss.rdbuf( cerr.rdbuf() );
- BOOST_CHECK_EQUAL( cerr.rdbuf(), ss.rdbuf() );
+ BOOST_TEST_EQ( cerr.rdbuf(), ss.rdbuf() );
ss << setfill( 'x' );
- BOOST_CHECK_EQUAL( 'x', ss.fill() );
+ BOOST_TEST_EQ( 'x', ss.fill() );
ss.imbue( locale(locale::classic(), new backward_bool_names) );
- BOOST_CHECK( locale() != ss.getloc() );
- BOOST_CHECK( has_facet(ss.getloc()) && (NULL
+ BOOST_TEST( locale() != ss.getloc() );
+ BOOST_TEST( has_facet(ss.getloc()) && (NULL
!= dynamic_cast(
&use_facet(ss.getloc()) )) );
}
- BOOST_CHECK_EQUAL( (ios_base::skipws | ios_base::dec), ss.flags() );
- BOOST_CHECK_EQUAL( 6, ss.precision() );
- BOOST_CHECK_EQUAL( 0, ss.width() );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.rdstate() );
- BOOST_CHECK( ss.good() );
- BOOST_CHECK_EQUAL( ios_base::goodbit, ss.exceptions() );
- BOOST_CHECK( NULL == ss.tie() );
- BOOST_CHECK( &sb == ss.rdbuf() );
- BOOST_CHECK_EQUAL( ' ', ss.fill() );
- BOOST_CHECK( locale() == ss.getloc() );
+ BOOST_TEST_EQ( (ios_base::skipws | ios_base::dec), ss.flags() );
+ BOOST_TEST_EQ( 6, ss.precision() );
+ BOOST_TEST_EQ( 0, ss.width() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.rdstate() );
+ BOOST_TEST( ss.good() );
+ BOOST_TEST_EQ( ios_base::goodbit, ss.exceptions() );
+ BOOST_TEST( NULL == ss.tie() );
+ BOOST_TEST( &sb == ss.rdbuf() );
+ BOOST_TEST_EQ( ' ', ss.fill() );
+ BOOST_TEST( locale() == ss.getloc() );
}
// Unit test for user-defined data saving
@@ -632,54 +635,46 @@ ios_word_saver_unit_test
stringstream ss;
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
{
boost::io::ios_all_word_saver iaws( ss, word_index );
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
ss.iword( word_index ) = -11;
ss.pword( word_index ) = ss.rdbuf();
- BOOST_CHECK_EQUAL( -11, ss.iword(word_index) );
- BOOST_CHECK_EQUAL( ss.rdbuf(), ss.pword(word_index) );
+ BOOST_TEST_EQ( -11, ss.iword(word_index) );
+ BOOST_TEST_EQ( ss.rdbuf(), ss.pword(word_index) );
}
- BOOST_CHECK_EQUAL( 0, ss.iword(word_index) );
- BOOST_CHECK( NULL == ss.pword(word_index) );
+ BOOST_TEST_EQ( 0, ss.iword(word_index) );
+ BOOST_TEST( NULL == ss.pword(word_index) );
}
// Unit test program
-boost::unit_test::test_suite *
-init_unit_test_suite
-(
- int , // "argc" is unused
- char * [] // "argv" is unused
-)
+int main()
{
- boost::unit_test::test_suite * test
- = BOOST_TEST_SUITE( "I/O state saver test" );
+ ios_flags_saver_unit_test();
+ ios_precision_saver_unit_test();
+ ios_width_saver_unit_test();
- test->add( BOOST_TEST_CASE(ios_flags_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_precision_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_width_saver_unit_test) );
+ ios_iostate_saver_unit_test();
+ ios_exception_saver_unit_test();
+ ios_tie_saver_unit_test();
+ ios_rdbuf_saver_unit_test();
+ ios_fill_saver_unit_test();
+ ios_locale_saver_unit_test();
- test->add( BOOST_TEST_CASE(ios_iostate_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_exception_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_tie_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_rdbuf_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_fill_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_locale_saver_unit_test) );
+ ios_iword_saver_unit_test();
+ ios_pword_saver_unit_test();
- test->add( BOOST_TEST_CASE(ios_iword_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_pword_saver_unit_test) );
+ ios_base_all_saver_unit_test();
+ ios_all_saver_unit_test();
+ ios_word_saver_unit_test();
- test->add( BOOST_TEST_CASE(ios_base_all_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_all_saver_unit_test) );
- test->add( BOOST_TEST_CASE(ios_word_saver_unit_test) );
-
- return test;
+ return boost::report_errors();
}
diff --git a/test/quoted_manip_test.cpp b/test/quoted_manip_test.cpp
index 31c6f05..80e6f78 100644
--- a/test/quoted_manip_test.cpp
+++ b/test/quoted_manip_test.cpp
@@ -10,7 +10,7 @@
// ---------------------------------------------------------------------------------- //
#include
-#include
+#include
#include
#include
From c0febbb420947e75d544aecb4da8a7d872203114 Mon Sep 17 00:00:00 2001
From: Glen Fernandes
Date: Fri, 13 Dec 2019 21:25:46 -0500
Subject: [PATCH 07/10] Remove special characters in documentation
---
doc/quoted_manip.html | 4 ++--
index.html | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/quoted_manip.html b/doc/quoted_manip.html
index 14a3380..fc50042 100644
--- a/doc/quoted_manip.html
+++ b/doc/quoted_manip.html
@@ -154,11 +154,11 @@ Alexander Lamaison, Eric Niebler, Vicente Botet, Andrey Semashev, Phil Richards,
and Rob Murray. Eric Niebler's suggestions provided the basis for the name and
form of the templates.
-© Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010
+Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010
Distributed under the Boost Software License, Version 1.0. See
www.boost.org/LICENSE_1_0.txt
Revised
08 March 2013