aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorBrent Verner <brent@rcfile.org>2000-08-14 19:59:26 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2000-08-14 19:59:26 +0000
commitaa1b2f7d9546b36301c03c9158d22a3b6eca8cd5 (patch)
tree89c1a03a93a8b23be6764562273f344faabf7acc /libstdc++-v3
parent5312a1d9d18f42f15d1f9cdecf689223f9e030c9 (diff)
downloadgcc-aa1b2f7d9546b36301c03c9158d22a3b6eca8cd5.zip
gcc-aa1b2f7d9546b36301c03c9158d22a3b6eca8cd5.tar.gz
gcc-aa1b2f7d9546b36301c03c9158d22a3b6eca8cd5.tar.bz2
debug_assert.h: new file
2000-08-14 Brent Verner <brent@rcfile.org> * testsuite/debug_assert.h: new file * testsuite/*/*.cc: s/test\s*&=([^;]+);/VERIFY($1);/g changed conditional #include <c?assert.?h?> to unconditional #include <debug_assert.h> * mkcheck.in: added $SRC_DIR/testsuite to include search path for testsuite compile command. From-SVN: r35682
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog9
-rwxr-xr-xlibstdc++-v3/mkcheck.in2
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ciso646.cc12
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_fstream.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iomanip.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ios.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iosfwd.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_iostream.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_istream.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_ostream.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_sstream.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/header_streambuf.cc4
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits.cc64
-rw-r--r--libstdc++-v3/testsuite/20_util/auto_ptr.cc171
-rw-r--r--libstdc++-v3/testsuite/21_strings/append.cc64
-rw-r--r--libstdc++-v3/testsuite/21_strings/capacity.cc60
-rw-r--r--libstdc++-v3/testsuite/21_strings/char_traits.cc92
-rw-r--r--libstdc++-v3/testsuite/21_strings/compare.cc25
-rw-r--r--libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc62
-rw-r--r--libstdc++-v3/testsuite/21_strings/element_access.cc28
-rw-r--r--libstdc++-v3/testsuite/21_strings/find.cc106
-rw-r--r--libstdc++-v3/testsuite/21_strings/insert.cc50
-rw-r--r--libstdc++-v3/testsuite/21_strings/inserters_extractors.cc100
-rw-r--r--libstdc++-v3/testsuite/21_strings/invariants.cc64
-rw-r--r--libstdc++-v3/testsuite/21_strings/nonmember.cc224
-rw-r--r--libstdc++-v3/testsuite/21_strings/operations.cc4
-rw-r--r--libstdc++-v3/testsuite/21_strings/replace.cc14
-rw-r--r--libstdc++-v3/testsuite/21_strings/rfind.cc38
-rw-r--r--libstdc++-v3/testsuite/21_strings/substr.cc20
-rw-r--r--libstdc++-v3/testsuite/22_locale/ctype_char_members.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset_ctor.cc22
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset_shift.cc20
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_capacity.cc10
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_ctor.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector_modifiers.cc4
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc34
-rw-r--r--libstdc++-v3/testsuite/24_iterators/iterator.cc22
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/lower_bound.cc4
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/min_max.cc12
-rw-r--r--libstdc++-v3/testsuite/26_numerics/c_math.cc31
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc29
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf.cc222
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf_members.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos.cc34
-rw-r--r--libstdc++-v3/testsuite/27_io/ifstream_members.cc16
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base_members_static.cc18
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_ctor.cc40
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc21
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc19
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_members.cc36
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc218
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_char.cc98
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_extractor_other.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_manip.cc36
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_seeks.cc116
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_sentry.cc12
-rw-r--r--libstdc++-v3/testsuite/27_io/istream_unformatted.cc234
-rw-r--r--libstdc++-v3/testsuite/27_io/istringstream_members.cc20
-rw-r--r--libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc14
-rw-r--r--libstdc++-v3/testsuite/27_io/ofstream_members.cc16
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc29
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_manip.cc30
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_seeks.cc116
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_unformatted.cc10
-rw-r--r--libstdc++-v3/testsuite/27_io/streambuf.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/stringbuf.cc222
-rw-r--r--libstdc++-v3/testsuite/27_io/stringstream.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/wide_stream_objects.cc14
71 files changed, 1667 insertions, 1705 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5758419..d1cdc05 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-14 Brent Verner <brent@rcfile.org>
+
+ * testsuite/debug_assert.h: new file
+ * testsuite/*/*.cc: s/test\s*&=([^;]+);/VERIFY($1);/g
+ changed conditional #include <c?assert.?h?> to
+ unconditional #include <debug_assert.h>
+ * mkcheck.in: added $SRC_DIR/testsuite to include search path
+ for testsuite compile command.
+
2000-08-14 Levente Farkas <lfarkas@mindmaker.hu>
* bits/std_fstream.h: Remove duplicate typdefs for ofstream and
diff --git a/libstdc++-v3/mkcheck.in b/libstdc++-v3/mkcheck.in
index b716a14..ef0950b 100755
--- a/libstdc++-v3/mkcheck.in
+++ b/libstdc++-v3/mkcheck.in
@@ -55,7 +55,7 @@ fi
# INC_PATH == include path to new headers for use on gcc command-line
if [ $WHICH != "1" ]; then
- INC_PATH="@CSHADOWFLAGS@ -I$BUILD_DIR -I$BUILD_DIR/libio -I$SRC_DIR/@ctype_include_dir@ -I$SRC_DIR/@cpu_include_dir@ -I$SRC_DIR/std -I$SRC_DIR -I$SRC_DIR/libio"
+ INC_PATH="@CSHADOWFLAGS@ -I$BUILD_DIR -I$BUILD_DIR/libio -I$SRC_DIR/@ctype_include_dir@ -I$SRC_DIR/@cpu_include_dir@ -I$SRC_DIR/std -I$SRC_DIR -I$SRC_DIR/libio -I$SRC_DIR/testsuite"
elif [ $WHICH -eq 1 ]; then
INC_PATH=""
fi
diff --git a/libstdc++-v3/testsuite/17_intro/header_ciso646.cc b/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
index 8e43690..c82c076 100644
--- a/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_ciso646.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, ciso646
#include <ciso646>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
// 2.11 Keywords
@@ -104,11 +102,11 @@ bool test02()
int int1 = 45;
int int2 = 0;
- test &= arg1 && int1;
- test &= arg1 and int1;
+ VERIFY( arg1 && int1 );
+ VERIFY( arg1 and int1 );
- test &= (arg1 && arg2) == (arg1 and arg2);
- test &= (arg1 && int1) == (arg1 and int1);
+ VERIFY( (arg1 && arg2) == (arg1 and arg2) );
+ VERIFY( (arg1 && int1) == (arg1 and int1) );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/17_intro/header_fstream.cc b/libstdc++-v3/testsuite/17_intro/header_fstream.cc
index 7b7cf7c..6673521 100644
--- a/libstdc++-v3/testsuite/17_intro/header_fstream.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_fstream.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, fstream
#include <fstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_iomanip.cc b/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
index 70fd774..6ae6923 100644
--- a/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_iomanip.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, iomanip
#include <iomanip>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_ios.cc b/libstdc++-v3/testsuite/17_intro/header_ios.cc
index e761ea6..f605873 100644
--- a/libstdc++-v3/testsuite/17_intro/header_ios.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_ios.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, ios
#include <ios>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc b/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
index 60f21f9..b9cb42d 100644
--- a/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_iosfwd.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, iosfwd
#include <iosfwd>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_iostream.cc b/libstdc++-v3/testsuite/17_intro/header_iostream.cc
index 549969d..51434ef 100644
--- a/libstdc++-v3/testsuite/17_intro/header_iostream.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_iostream.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, iostream
#include <iostream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_istream.cc b/libstdc++-v3/testsuite/17_intro/header_istream.cc
index 1e64ebf..b193f29 100644
--- a/libstdc++-v3/testsuite/17_intro/header_istream.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_istream.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, istream
#include <istream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_ostream.cc b/libstdc++-v3/testsuite/17_intro/header_ostream.cc
index 0bc90b5..731a881 100644
--- a/libstdc++-v3/testsuite/17_intro/header_ostream.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_ostream.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, ostream
#include <ostream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_sstream.cc b/libstdc++-v3/testsuite/17_intro/header_sstream.cc
index b04e5ea..697b8c3 100644
--- a/libstdc++-v3/testsuite/17_intro/header_sstream.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_sstream.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, sstream
#include <sstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/17_intro/header_streambuf.cc b/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
index 0847156..b8af9f4 100644
--- a/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
+++ b/libstdc++-v3/testsuite/17_intro/header_streambuf.cc
@@ -21,9 +21,7 @@
// 17.4.1.2 Headers, streambuf
#include <streambuf>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int main(void)
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits.cc b/libstdc++-v3/testsuite/18_support/numeric_limits.cc
index d5ae371..fce32ab 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits.cc
@@ -21,9 +21,7 @@
// 18.2.1.1 template class numeric_limits
#include <limits>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
template<typename T>
@@ -44,36 +42,36 @@ bool test01()
bool test = true;
std::numeric_limits< A<B> > obj;
- test &= !obj.is_specialized;
- test &= obj.min() == 0;
- test &= obj.max() == 0;
- test &= obj.digits == 0;
- test &= obj.digits10 == 0;
- test &= !obj.is_signed;
- test &= !obj.is_integer;
- test &= !obj.is_exact;
- test &= obj.radix == 0;
- test &= obj.epsilon() == 0;
- test &= obj.round_error() == 0;
- test &= obj.min_exponent == 0;
- test &= obj.min_exponent10 == 0;
- test &= obj.max_exponent == 0;
- test &= obj.max_exponent10 == 0;
- test &= !obj.has_infinity;
- test &= !obj.has_quiet_NaN;
- test &= !obj.has_signaling_NaN;
- test &= !obj.has_denorm;
- test &= !obj.has_denorm_loss;
- test &= obj.infinity() == 0;
- test &= obj.quiet_NaN() == 0;
- test &= obj.signaling_NaN() == 0;
- test &= obj.denorm_min() == 0;
- test &= !obj.is_iec559;
- test &= !obj.is_bounded;
- test &= !obj.is_modulo;
- test &= !obj.traps;
- test &= !obj.tinyness_before;
- test &= obj.round_style == std::round_toward_zero;
+ VERIFY( !obj.is_specialized );
+ VERIFY( obj.min() == 0 );
+ VERIFY( obj.max() == 0 );
+ VERIFY( obj.digits == 0 );
+ VERIFY( obj.digits10 == 0 );
+ VERIFY( !obj.is_signed );
+ VERIFY( !obj.is_integer );
+ VERIFY( !obj.is_exact );
+ VERIFY( obj.radix == 0 );
+ VERIFY( obj.epsilon() == 0 );
+ VERIFY( obj.round_error() == 0 );
+ VERIFY( obj.min_exponent == 0 );
+ VERIFY( obj.min_exponent10 == 0 );
+ VERIFY( obj.max_exponent == 0 );
+ VERIFY( obj.max_exponent10 == 0 );
+ VERIFY( !obj.has_infinity );
+ VERIFY( !obj.has_quiet_NaN );
+ VERIFY( !obj.has_signaling_NaN );
+ VERIFY( !obj.has_denorm );
+ VERIFY( !obj.has_denorm_loss );
+ VERIFY( obj.infinity() == 0 );
+ VERIFY( obj.quiet_NaN() == 0 );
+ VERIFY( obj.signaling_NaN() == 0 );
+ VERIFY( obj.denorm_min() == 0 );
+ VERIFY( !obj.is_iec559 );
+ VERIFY( !obj.is_bounded );
+ VERIFY( !obj.is_modulo );
+ VERIFY( !obj.traps );
+ VERIFY( !obj.tinyness_before );
+ VERIFY( obj.round_style == std::round_toward_zero );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/20_util/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/auto_ptr.cc
index 53edd55..a6aa338 100644
--- a/libstdc++-v3/testsuite/20_util/auto_ptr.cc
+++ b/libstdc++-v3/testsuite/20_util/auto_ptr.cc
@@ -19,10 +19,7 @@
// 20.4.5 Template class auto_ptr [lib.auto.ptr]
#include <memory>
-#ifdef DEBUG_ASSERT
-# include <assert.h>
-#endif
-
+#include <debug_assert.h>
struct A
{
@@ -60,41 +57,43 @@ struct reset_count_struct
// 20.4.5.1 auto_ptr constructors [lib.auto.ptr.cons]
// Construction from pointer
-bool test01()
+int
+test01()
{
reset_count_struct reset;
bool test = true;
std::auto_ptr<A> A_default;
- test &= A_default.get() == 0;
- test &= A::ctor_count == 0;
- test &= A::dtor_count == 0;
- test &= B::ctor_count == 0;
- test &= B::dtor_count == 0;
+ VERIFY( A_default.get() == 0 );
+ VERIFY( A::ctor_count == 0 );
+ VERIFY( A::dtor_count == 0 );
+ VERIFY( B::ctor_count == 0 );
+ VERIFY( B::dtor_count == 0 );
std::auto_ptr<A> A_from_A(new A);
- test &= A_from_A.get() != 0;
- test &= A::ctor_count == 1;
- test &= A::dtor_count == 0;
- test &= B::ctor_count == 0;
- test &= B::dtor_count == 0;
+ VERIFY( A_from_A.get() != 0 );
+ VERIFY( A::ctor_count == 1 );
+ VERIFY( A::dtor_count == 0 );
+ VERIFY( B::ctor_count == 0 );
+ VERIFY( B::dtor_count == 0 );
std::auto_ptr<A> A_from_B(new B);
- test &= A_from_B.get() != 0;
- test &= A::ctor_count == 2;
- test &= A::dtor_count == 0;
- test &= B::ctor_count == 1;
- test &= B::dtor_count == 0;
+ VERIFY( A_from_B.get() != 0 );
+ VERIFY( A::ctor_count == 2 );
+ VERIFY( A::dtor_count == 0 );
+ VERIFY( B::ctor_count == 1 );
+ VERIFY( B::dtor_count == 0 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// Construction from std::auto_ptr
-bool test02()
+int
+test02()
{
reset_count_struct reset;
bool test = true;
@@ -104,24 +103,25 @@ bool test02()
std::auto_ptr<A> A_from_ptr_A(A_from_A);
std::auto_ptr<A> A_from_ptr_B(B_from_B);
- test &= A_from_A.get() == 0;
- test &= B_from_B.get() == 0;
- test &= A_from_ptr_A.get() != 0;
- test &= A_from_ptr_B.get() != 0;
- test &= A::ctor_count == 2;
- test &= A::dtor_count == 0;
- test &= B::ctor_count == 1;
- test &= B::dtor_count == 0;
+ VERIFY( A_from_A.get() == 0 );
+ VERIFY( B_from_B.get() == 0 );
+ VERIFY( A_from_ptr_A.get() != 0 );
+ VERIFY( A_from_ptr_B.get() != 0 );
+ VERIFY( A::ctor_count == 2 );
+ VERIFY( A::dtor_count == 0 );
+ VERIFY( B::ctor_count == 1 );
+ VERIFY( B::dtor_count == 0 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// Assignment from std::auto_ptr
-bool test03()
+int
+test03()
{
reset_count_struct reset;
bool test = true;
@@ -133,24 +133,25 @@ bool test03()
A_from_ptr_A = A_from_A;
A_from_ptr_B = B_from_B;
- test &= A_from_A.get() == 0;
- test &= B_from_B.get() == 0;
- test &= A_from_ptr_A.get() != 0;
- test &= A_from_ptr_B.get() != 0;
- test &= A::ctor_count == 2;
- test &= A::dtor_count == 0;
- test &= B::ctor_count == 1;
- test &= B::dtor_count == 0;
+ VERIFY( A_from_A.get() == 0 );
+ VERIFY( B_from_B.get() == 0 );
+ VERIFY( A_from_ptr_A.get() != 0 );
+ VERIFY( A_from_ptr_B.get() != 0 );
+ VERIFY( A::ctor_count == 2 );
+ VERIFY( A::dtor_count == 0 );
+ VERIFY( B::ctor_count == 1 );
+ VERIFY( B::dtor_count == 0 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// Destruction
-bool test04()
+int
+test04()
{
reset_count_struct reset;
bool test = true;
@@ -161,16 +162,16 @@ bool test04()
std::auto_ptr<B> B_from_B(new B);
}/*destructors called here*/
- test &= A::ctor_count == 3;
- test &= A::dtor_count == 3;
- test &= B::ctor_count == 2;
- test &= B::dtor_count == 2;
+ VERIFY( A::ctor_count == 3 );
+ VERIFY( A::dtor_count == 3 );
+ VERIFY( B::ctor_count == 2 );
+ VERIFY( B::dtor_count == 2 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// Class member construction/destruction
@@ -183,58 +184,60 @@ private:
std::auto_ptr<T> p_impl;
};
-bool test05()
+int
+test05()
{
bool test = true;
reset_count_struct reset;
pimpl<A>();
pimpl<B>();
- test &= A::ctor_count == 2;
- test &= A::dtor_count == 2;
- test &= B::ctor_count == 1;
- test &= B::dtor_count == 1;
+ VERIFY( A::ctor_count == 2 );
+ VERIFY( A::dtor_count == 2 );
+ VERIFY( B::ctor_count == 1 );
+ VERIFY( B::dtor_count == 1 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// 20.4.5.2 auto_ptr members [lib.auto.ptr.members]
// Member access
-bool test06()
+int
+test06()
{
reset_count_struct reset;
bool test = true;
std::auto_ptr<A> A_from_A(new A);
std::auto_ptr<A> A_from_A_ptr(A_from_A.release());
- test &= A_from_A.get() == 0;
- test &= A_from_A_ptr.get() != 0;
- test &= A_from_A->ctor_count == 1;
- test &= (*A_from_A).dtor_count == 0;
+ VERIFY( A_from_A.get() == 0 );
+ VERIFY( A_from_A_ptr.get() != 0 );
+ VERIFY( A_from_A->ctor_count == 1 );
+ VERIFY( (*A_from_A).dtor_count == 0 );
A* A_ptr = A_from_A_ptr.get();
A_from_A_ptr.reset(A_ptr);
- test &= A_from_A_ptr.get() == A_ptr;
- test &= A_from_A_ptr->ctor_count == 1;
- test &= (*A_from_A_ptr).dtor_count == 0;
+ VERIFY( A_from_A_ptr.get() == A_ptr );
+ VERIFY( A_from_A_ptr->ctor_count == 1 );
+ VERIFY( (*A_from_A_ptr).dtor_count == 0 );
A_from_A_ptr.reset(new A);
- test &= A_from_A_ptr.get() != A_ptr;
- test &= A_from_A_ptr->ctor_count == 2;
- test &= (*A_from_A_ptr).dtor_count == 1;
+ VERIFY( A_from_A_ptr.get() != A_ptr );
+ VERIFY( A_from_A_ptr->ctor_count == 2 );
+ VERIFY( (*A_from_A_ptr).dtor_count == 1 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
@@ -251,7 +254,8 @@ template <typename T>
static void drain(std::auto_ptr<T>)
{}
-bool test07()
+int
+test07()
{
bool test = true;
reset_count_struct reset;
@@ -259,30 +263,29 @@ bool test07()
drain(source<A>());
drain<A>(source<B>());
drain(source<B>());
- test &= A::ctor_count == 3;
- test &= A::dtor_count == 3;
- test &= B::ctor_count == 2;
- test &= B::dtor_count == 2;
+ VERIFY( A::ctor_count == 3 );
+ VERIFY( A::dtor_count == 3 );
+ VERIFY( B::ctor_count == 2 );
+ VERIFY( B::dtor_count == 2 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
-
-int main()
+int
+main()
{
- bool test = true;
-
- test &= test01();
- test &= test02();
- test &= test03();
- test &= test04();
- test &= test05();
- test &= test06();
- test &= test07();
-
- return test ? 0 : 1;
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+ test07();
+
+ return 0;
}
+
diff --git a/libstdc++-v3/testsuite/21_strings/append.cc b/libstdc++-v3/testsuite/21_strings/append.cc
index 4dc4aa9..07b1706 100644
--- a/libstdc++-v3/testsuite/21_strings/append.cc
+++ b/libstdc++-v3/testsuite/21_strings/append.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -45,14 +43,14 @@ bool test01(void)
// string& append(const string&)
str05 = str02;
str05.append(str05);
- test &= str05 == "corpus, corpus, ";
+ VERIFY( str05 == "corpus, corpus, " );
str05.append(str01);
- test &= str05 == "corpus, corpus, point bolivar, texas";
+ VERIFY( str05 == "corpus, corpus, point bolivar, texas" );
str05.append(str03);
- test &= str05 == "corpus, corpus, point bolivar, texas";
+ VERIFY( str05 == "corpus, corpus, point bolivar, texas" );
std::string str06;
str06.append(str05);
- test &= str06 == str05;
+ VERIFY( str06 == str05 );
// string& append(const string&, size_type pos, size_type n)
@@ -61,78 +59,78 @@ bool test01(void)
csz01 = str03.size();
try {
str06.append(str03, csz01 + 1, 0);
- test &= false;
+ VERIFY( false );
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
csz01 = str01.size();
try {
str06.append(str01, csz01 + 1, 0);
- test &= false;
+ VERIFY( false );
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
str05 = str02;
str05.append(str01, 0, std::string::npos);
- test &= str05 == "corpus, point bolivar, texas";
- test &= str05 != str02;
+ VERIFY( str05 == "corpus, point bolivar, texas" );
+ VERIFY( str05 != str02 );
str06 = str02;
str06.append(str01, 15, std::string::npos);
- test &= str06 == "corpus, texas";
- test &= str02 != str06;
+ VERIFY( str06 == "corpus, texas" );
+ VERIFY( str02 != str06 );
// string& append(const char* s)
str05.erase();
str06.erase();
str05.append("");
- test &= str05 == str03;
+ VERIFY( str05 == str03 );
str05.append(str_lit01);
- test &= str05 == str01;
+ VERIFY( str05 == str01 );
str06 = str02;
str06.append("corpus, ");
- test &= str06 == "corpus, corpus, ";
+ VERIFY( str06 == "corpus, corpus, " );
// string& append(const char* s, size_type n)
str05.erase();
str06.erase();
str05.append("", 0);
- test &= str05.size() == 0;
- test &= str05 == str03;
+ VERIFY( str05.size() == 0 );
+ VERIFY( str05 == str03 );
str05.append(str_lit01, sizeof(str_lit01) - 1);
- test &= str05 == str01;
+ VERIFY( str05 == str01 );
str06 = str02;
str06.append("corpus, ", 6);
- test &= str06 == "corpus, corpus";
+ VERIFY( str06 == "corpus, corpus" );
str06 = str02;
str06.append("corpus, ", 12);
- test &= str06 != "corpus, corpus, ";
+ VERIFY( str06 != "corpus, corpus, " );
// string& append(size_type n, char c)
str05.erase();
str06.erase();
str05.append(0, 'a');
- test &= str05 == str03;
+ VERIFY( str05 == str03 );
str06.append(8, '.');
- test &= str06 == "........";
+ VERIFY( str06 == "........" );
// template<typename InputIter>
@@ -140,18 +138,18 @@ bool test01(void)
str05.erase();
str06.erase();
str05.append(str03.begin(), str03.end());
- test &= str05 == str03;
+ VERIFY( str05 == str03 );
str06 = str02;
str06.append(str01.begin(), str01.begin() + str01.find('r'));
- test &= str06 == "corpus, point boliva";
- test &= str06 != str01;
- test &= str06 != str02;
+ VERIFY( str06 == "corpus, point boliva" );
+ VERIFY( str06 != str01 );
+ VERIFY( str06 != str02 );
str05 = str01;
str05.append(str05.begin(), str05.begin() + str05.find('r'));
- test &= str05 == "point bolivar, texaspoint boliva";
- test &= str05 != str01;
+ VERIFY( str05 == "point bolivar, texaspoint boliva" );
+ VERIFY( str05 != str01 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/capacity.cc b/libstdc++-v3/testsuite/21_strings/capacity.cc
index 5673434..b93e6fe 100644
--- a/libstdc++-v3/testsuite/21_strings/capacity.cc
+++ b/libstdc++-v3/testsuite/21_strings/capacity.cc
@@ -22,9 +22,7 @@
#include <string>
#include <cstdio>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
template<typename T>
struct A { };
@@ -49,27 +47,27 @@ bool test01()
size_type_s sz01 = str01.capacity();
str01.reserve(100);
size_type_s sz02 = str01.capacity();
- test &= sz02 >= sz01;
- test &= sz02 >= 100;
+ VERIFY( sz02 >= sz01 );
+ VERIFY( sz02 >= 100 );
str01.reserve();
sz01 = str01.capacity();
- test &= sz01 >= 0;
+ VERIFY( sz01 >= 0 );
sz01 = str01.size() + 5;
str01.resize(sz01);
sz02 = str01.size();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
sz01 = str01.size() - 5;
str01.resize(sz01);
sz02 = str01.size();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
std::string str05(30, 'q');
std::string str06 = str05;
str05 = str06 + str05;
- test &= str05.capacity() >= str05.size();
- test &= str06.capacity() >= str06.size();
+ VERIFY( str05.capacity() >= str05.size() );
+ VERIFY( str06.capacity() >= str06.size() );
// 2 non POD types : resize, capacity, reserve
std::basic_string< A<B> > str02;
@@ -80,50 +78,50 @@ bool test01()
sz03 = str02.capacity();
str02.reserve(100);
sz04 = str02.capacity();
- test &= sz04 >= sz03;
- test &= sz04 >= 100;
+ VERIFY( sz04 >= sz03 );
+ VERIFY( sz04 >= 100 );
str02.reserve();
sz03 = str02.capacity();
- test &= sz03 >= 0;
+ VERIFY( sz03 >= 0 );
sz03 = str02.size() + 5;
str02.resize(sz03);
sz04 = str02.size();
- test &= sz03 == sz04;
+ VERIFY( sz03 == sz04 );
sz03 = str02.size() - 5;
str02.resize(sz03);
sz04 = str02.size();
- test &= sz03 == sz04;
+ VERIFY( sz03 == sz04 );
A<B> inst_obj;
std::basic_string<A<B> > str07(30, inst_obj);
std::basic_string<A<B> > str08 = str07;
str07 = str08 + str07;
- test &= str07.capacity() >= str07.size();
- test &= str08.capacity() >= str08.size();
+ VERIFY( str07.capacity() >= str07.size() );
+ VERIFY( str08.capacity() >= str08.size() );
// 3 POD types: size, length, max_size, clear(), empty()
bool b01;
std::string str011;
b01 = str01.empty();
- test &= b01 == true;
+ VERIFY( b01 == true );
sz01 = str01.size();
sz02 = str01.length();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
str01.c_str();
sz01 = str01.size();
sz02 = str01.length();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
sz01 = str01.length();
str01.c_str();
str011 = str01 + "_addendum_";
str01.c_str();
sz02 = str01.length();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
sz02 = str011.length();
- test &= sz02 > sz01;
+ VERIFY( sz02 > sz01 );
// trickster allocator (__USE_MALLOC, luke) issues involved with these:
std::string str3 = "8-chars_8-chars_";
@@ -133,36 +131,36 @@ bool test01()
sz01 = str01.size();
sz02 = str01.max_size();
- test &= sz02 >= sz01;
+ VERIFY( sz02 >= sz01 );
sz01 = str01.size();
str01.clear();
b01 = str01.empty();
- test &= b01 == true;
+ VERIFY( b01 == true );
sz02 = str01.size();
- test &= sz01 >= sz02;
+ VERIFY( sz01 >= sz02 );
// 4 non-POD types: size, length, max_size, clear(), empty()
b01 = str02.empty();
- test &= b01 == true;
+ VERIFY( b01 == true );
sz03 = str02.size();
sz04 = str02.length();
- test &= sz03 == sz04;
+ VERIFY( sz03 == sz04 );
str02.c_str();
sz03 = str02.size();
sz04 = str02.length();
- test &= sz03 == sz04;
+ VERIFY( sz03 == sz04 );
sz03 = str02.max_size();
- test &= sz03 >= sz04;
+ VERIFY( sz03 >= sz04 );
sz03 = str02.size();
str02.clear();
b01 = str02.empty();
- test &= b01 == true;
+ VERIFY( b01 == true );
sz04 = str02.size();
- test &= sz03 >= sz04;
+ VERIFY( sz03 >= sz04 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits.cc b/libstdc++-v3/testsuite/21_strings/char_traits.cc
index 0ad8425..1978bda 100644
--- a/libstdc++-v3/testsuite/21_strings/char_traits.cc
+++ b/libstdc++-v3/testsuite/21_strings/char_traits.cc
@@ -21,9 +21,7 @@
// 21.1 Characher traits
#include <string>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int test01(void)
{
@@ -47,9 +45,9 @@ int test01(void)
// assigns c = d;
char c1 = 'z';
char c2 = 'u';
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
std::char_traits<char>::assign(c1,c2);
- test &= c1 == 'u';
+ VERIFY( c1 == 'u' );
// char* X::move(char* s, const char* p, size_t n)
// for each i in [0,n) performs X::assign(s[i], p[i]). Copies
@@ -59,35 +57,35 @@ int test01(void)
int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars
char array2[len];
- test &= str_lit1[0] == 'm';
+ VERIFY( str_lit1[0] == 'm' );
c1 = array2[0];
c2 = str_lit1[0];
char c3 = array2[1];
char c4 = str_lit1[1];
std::char_traits<char>::move(array2, str_lit1, 0);
- test &= array2[0] == c1;
- test &= str_lit1[0] == c2;
+ VERIFY( array2[0] == c1 );
+ VERIFY( str_lit1[0] == c2 );
std::char_traits<char>::move(array2, str_lit1, 1);
- test &= array2[0] == c2;
- test &= str_lit1[0] == c2;
- test &= array2[1] == c3;
- test &= str_lit1[1] == c4;
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c3 );
+ VERIFY( str_lit1[1] == c4 );
std::char_traits<char>::move(array2, str_lit1, 2);
- test &= array2[0] == c2;
- test &= str_lit1[0] == c2;
- test &= array2[1] == c4;
- test &= str_lit1[1] == c4;
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c4 );
+ VERIFY( str_lit1[1] == c4 );
char* pc1 = array1 + 1;
c1 = pc1[0];
c2 = array1[0];
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
char* pc2 = std::char_traits<char>::move(array1, pc1, 0);
c3 = pc1[0];
c4 = array1[0];
- test &= c1 == c3;
- test &= c2 == c4;
- test &= pc2 == array1;
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == c4 );
+ VERIFY( pc2 == array1 );
c1 = pc1[0];
c2 = array1[0];
@@ -95,13 +93,13 @@ int test01(void)
pc2 = std::char_traits<char>::move(array1, pc1, 10);
c3 = pc1[0];
c4 = array1[0];
- test &= c1 != c3; // underlying char array changed.
- test &= c4 != c3;
- test &= pc2 == array1;
- test &= pc3 == pc1; // but pointers o-tay
+ VERIFY( c1 != c3 ); // underlying char array changed.
+ VERIFY( c4 != c3 );
+ VERIFY( pc2 == array1 );
+ VERIFY( pc3 == pc1 ); // but pointers o-tay
c1 = *(str_01.data());
c2 = array1[0];
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -132,9 +130,9 @@ int test02(void)
// assigns c = d;
wchar_t c1 = L'z';
wchar_t c2 = L'u';
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
std::char_traits<wchar_t>::assign(c1,c2);
- test &= c1 == L'u';
+ VERIFY( c1 == L'u' );
// char* X::move(char* s, const char* p, size_t n)
// for each i in [0,n) performs X::assign(s[i], p[i]). Copies
@@ -144,35 +142,35 @@ int test02(void)
int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars
wchar_t array2[len];
- test &= str_lit1[0] == 'm';
+ VERIFY( str_lit1[0] == 'm' );
c1 = array2[0];
c2 = str_lit1[0];
wchar_t c3 = array2[1];
wchar_t c4 = str_lit1[1];
std::char_traits<wchar_t>::move(array2, str_lit1, 0);
- test &= array2[0] == c1;
- test &= str_lit1[0] == c2;
+ VERIFY( array2[0] == c1 );
+ VERIFY( str_lit1[0] == c2 );
std::char_traits<wchar_t>::move(array2, str_lit1, 1);
- test &= array2[0] == c2;
- test &= str_lit1[0] == c2;
- test &= array2[1] == c3;
- test &= str_lit1[1] == c4;
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c3 );
+ VERIFY( str_lit1[1] == c4 );
std::char_traits<wchar_t>::move(array2, str_lit1, 2);
- test &= array2[0] == c2;
- test &= str_lit1[0] == c2;
- test &= array2[1] == c4;
- test &= str_lit1[1] == c4;
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c4 );
+ VERIFY( str_lit1[1] == c4 );
wchar_t* pc1 = array1 + 1;
c1 = pc1[0];
c2 = array1[0];
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
wchar_t* pc2 = std::char_traits<wchar_t>::move(array1, pc1, 0);
c3 = pc1[0];
c4 = array1[0];
- test &= c1 == c3;
- test &= c2 == c4;
- test &= pc2 == array1;
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == c4 );
+ VERIFY( pc2 == array1 );
c1 = pc1[0];
c2 = array1[0];
@@ -180,13 +178,13 @@ int test02(void)
pc2 = std::char_traits<wchar_t>::move(array1, pc1, 10);
c3 = pc1[0];
c4 = array1[0];
- test &= c1 != c3; // underlying wchar_t array changed.
- test &= c4 != c3;
- test &= pc2 == array1;
- test &= pc3 == pc1; // but pointers o-tay
+ VERIFY( c1 != c3 ); // underlying wchar_t array changed.
+ VERIFY( c4 != c3 );
+ VERIFY( pc2 == array1 );
+ VERIFY( pc3 == pc1 ); // but pointers o-tay
c1 = *(str_01.data());
c2 = array1[0];
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/compare.cc b/libstdc++-v3/testsuite/21_strings/compare.cc
index b3d81a0..822d368 100644
--- a/libstdc++-v3/testsuite/21_strings/compare.cc
+++ b/libstdc++-v3/testsuite/21_strings/compare.cc
@@ -31,14 +31,16 @@
// things would be sorted in a dictionary.
#include <string>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
enum want_value {lt=0, z=1, gt=2};
-void test_value(int result, want_value expected);
-void test_value(int result, want_value expected) {
+int
+test_value(int result, want_value expected);
+
+int
+test_value(int result, want_value expected)
+{
bool pass = false;
switch (expected) {
@@ -61,11 +63,14 @@ void test_value(int result, want_value expected) {
#ifdef DEBUG_ASSERT
assert(pass);
#endif
+
+ return 0;
}
-int test01(void) {
-
+int
+test01()
+{
std::string str_0("costa rica");
std::string str_1("costa marbella");
std::string str_2;
@@ -121,8 +126,12 @@ int test01(void) {
}
-int main() {
+int
+main()
+{
test01();
+
+ return 0;
}
diff --git a/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc b/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
index 24edff4..095c880 100644
--- a/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
+++ b/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
@@ -23,9 +23,7 @@
#include <new>
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int test01(void)
{
@@ -43,22 +41,22 @@ int test01(void)
csz01 = str01.size();
try {
std::string str03(str01, csz01 + 1);
- test &= false;
+ VERIFY( false );
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
try {
std::string str03(str01, csz01);
- test &= str03.size() == 0;
- test &= str03.size() <= str03.capacity();
+ VERIFY( str03.size() == 0 );
+ VERIFY( str03.size() <= str03.capacity() );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
@@ -68,13 +66,13 @@ int test01(void)
// should not crash, but what gets constructed is a bit arbitrary.
try {
std::string str03(str_lit01, csz01 + 1);
- test &= true;
+ VERIFY( true );
}
catch(std::length_error& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// NB: As strlen(str_lit01) != csz01, this test is undefined. It
@@ -82,79 +80,79 @@ int test01(void)
// The "maverick's" of all string objects.
try {
std::string str04(str_lit01, npos);
- test &= true;
+ VERIFY( true );
}
catch(std::length_error& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// Build a maxsize-1 lengthed string consisting of all A's
try {
std::string str03(csz01 - 1, 'A');
- test &= str03.size() == csz01 - 1;
- test &= str03.size() <= str03.capacity();
+ VERIFY( str03.size() == csz01 - 1 );
+ VERIFY( str03.size() <= str03.capacity() );
}
// NB: bad_alloc is regrettable but entirely kosher for
// out-of-memory situations.
catch(std::bad_alloc& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// basic_string(const char* s, const allocator& a = allocator())
std::string str04(str_lit01);
- test &= str01 == str04;
+ VERIFY( str01 == str04 );
// basic_string(size_type n, char c, const allocator& a = allocator())
csz01 = str01.max_size();
try {
std::string str03(csz01 + 1, 'z');
- test &= false;
+ VERIFY( false );
}
catch(std::length_error& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
try {
std::string str04(npos, 'b'); // the "maverick's" of all string objects.
- test &= false;
+ VERIFY( false );
}
catch(std::length_error& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
try {
std::string str03(csz01 - 1, 'z');
- test &= str03.size() != 0;
- test &= str03.size() <= str03.capacity();
+ VERIFY( str03.size() != 0 );
+ VERIFY( str03.size() <= str03.capacity() );
}
// NB: bad_alloc is regrettable but entirely kosher for
// out-of-memory situations.
catch(std::bad_alloc& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// template<typename _InputIter>
// basic_string(_InputIter begin, _InputIter end, const allocator& a)
std::string str06(str01.begin(), str01.end());
- test &= str06 == str01;
+ VERIFY( str06 == str01 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -170,7 +168,7 @@ void test02()
// basic_string(_InputIter begin, _InputIter end, const allocator& a)
// where _InputIter is integral [21.3.1 para 15]
std::string s(10,0);
- test &= s.size() == 10;
+ VERIFY( s.size() == 10 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
diff --git a/libstdc++-v3/testsuite/21_strings/element_access.cc b/libstdc++-v3/testsuite/21_strings/element_access.cc
index 6f1ba06..34d6392 100644
--- a/libstdc++-v3/testsuite/21_strings/element_access.cc
+++ b/libstdc++-v3/testsuite/21_strings/element_access.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -42,45 +40,45 @@ bool test01(void)
// const_reference operator[] (size_type pos) const;
csz01 = str01.size();
cref cref1 = str01[csz01 - 1];
- test &= cref1 == 'a';
+ VERIFY( cref1 == 'a' );
cref cref2 = str01[csz01];
- test &= cref2 == char();
+ VERIFY( cref2 == char() );
// reference operator[] (size_type pos);
csz02 = str02.size();
ref ref1 = str02[csz02 - 1];
- test &= ref1 == 'a';
+ VERIFY( ref1 == 'a' );
ref ref2 = str02[1];
- test &= ref2 == '4';
+ VERIFY( ref2 == '4' );
// const_reference at(size_type pos) const;
csz01 = str01.size();
cref cref3 = str01.at(csz01 - 1);
- test &= cref3 == 'a';
+ VERIFY( cref3 == 'a' );
try {
cref cref4 = str01.at(csz01);
- test &= false; // Should not get here, as exception thrown.
+ VERIFY( false ); // Should not get here, as exception thrown.
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// reference at(size_type pos);
csz01 = str02.size();
ref ref3 = str02.at(csz02 - 1);
- test &= ref3 == 'a';
+ VERIFY( ref3 == 'a' );
try {
ref ref4 = str02.at(csz02);
- test &= false; // Should not get here, as exception thrown.
+ VERIFY( false ); // Should not get here, as exception thrown.
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/21_strings/find.cc b/libstdc++-v3/testsuite/21_strings/find.cc
index 1d63ac5..8bafeb4 100644
--- a/libstdc++-v3/testsuite/21_strings/find.cc
+++ b/libstdc++-v3/testsuite/21_strings/find.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -43,71 +41,71 @@ bool test01(void)
// size_type find(const string&, size_type pos = 0) const;
csz01 = str01.find(str01);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find(str01, 4);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
csz01 = str01.find(str02, 0);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find(str02, 3);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
csz01 = str01.find(str03, 0);
- test &= csz01 == 8;
+ VERIFY( csz01 == 8 );
csz01 = str01.find(str03, 3);
- test &= csz01 == 8;
+ VERIFY( csz01 == 8 );
csz01 = str01.find(str03, 12);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
// An empty string consists of no characters
// therefore it should be found at every point in a string,
// except beyond the end
csz01 = str01.find(str04, 0);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find(str04, 5);
- test &= csz01 == 5;
+ VERIFY( csz01 == 5 );
csz01 = str01.find(str04, str01.size());
- test &= csz01 == str01.size();
+ VERIFY( csz01 == str01.size() );
csz01 = str01.find(str04, str01.size()+1);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
// size_type find(const char* s, size_type pos, size_type n) const;
csz01 = str01.find(str_lit01, 0, 3);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find(str_lit01, 3, 0);
- test &= csz01 == 3;
+ VERIFY( csz01 == 3 );
// size_type find(const char* s, size_type pos = 0) const;
csz01 = str01.find(str_lit01);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find(str_lit01, 3);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
// size_type find(char c, size_type pos = 0) const;
csz01 = str01.find('z');
csz02 = str01.size() - 1;
- test &= csz01 == csz02;
+ VERIFY( csz01 == csz02 );
csz01 = str01.find('/');
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
// size_type find_first_of(const string&, size_type pos = 0) const;
std::string str05("xena rulez");
csz01 = str01.find_first_of(str01);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find_first_of(str01, 4);
- test &= csz01 == 4;
+ VERIFY( csz01 == 4 );
csz01 = str01.find_first_of(str02, 0);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find_first_of(str02, 3);
- test &= csz01 == 3;
+ VERIFY( csz01 == 3 );
csz01 = str01.find_first_of(str03, 0);
- test &= csz01 == 8;
+ VERIFY( csz01 == 8 );
csz01 = str01.find_first_of(str03, 3);
- test &= csz01 == 8;
+ VERIFY( csz01 == 8 );
csz01 = str01.find_first_of(str03, 12);
- test &= csz01 == 16;
+ VERIFY( csz01 == 16 );
csz01 = str01.find_first_of(str05, 0);
- test &= csz01 == 1;
+ VERIFY( csz01 == 1 );
csz01 = str01.find_first_of(str05, 4);
- test &= csz01 == 4;
+ VERIFY( csz01 == 4 );
// An empty string consists of no characters
// therefore it should be found at every point in a string,
@@ -115,26 +113,26 @@ bool test01(void)
// However, str1.find_first_of(str2,pos) finds the first character in
// str1 (starting at pos) that exists in str2, which is none for empty str2
csz01 = str01.find_first_of(str04, 0);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
csz01 = str01.find_first_of(str04, 5);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
// size_type find_first_of(const char* s, size_type pos, size_type n) const;
csz01 = str01.find_first_of(str_lit01, 0, 3);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find_first_of(str_lit01, 3, 0);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
// size_type find_first_of(const char* s, size_type pos = 0) const;
csz01 = str01.find_first_of(str_lit01);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.find_first_of(str_lit01, 3);
- test &= csz01 == 3;
+ VERIFY( csz01 == 3 );
// size_type find_first_of(char c, size_type pos = 0) const;
csz01 = str01.find_first_of('z');
csz02 = str01.size() - 1;
- test &= csz01 == csz02;
+ VERIFY( csz01 == csz02 );
// size_type find_last_of(const string& str, size_type pos = 0) const;
// size_type find_last_of(const char* s, size_type pos, size_type n) const;
@@ -146,45 +144,45 @@ bool test01(void)
std::string x;
std::string::size_type pos;
pos = x.find_last_not_of('X');
- test &= pos == npos;
+ VERIFY( pos == npos );
pos = x.find_last_not_of("XYZ");
- test &= pos == npos;
+ VERIFY( pos == npos );
std::string y("a");
pos = y.find_last_not_of('X');
- test &= pos == 0;
+ VERIFY( pos == 0 );
pos = y.find_last_not_of('a');
- test &= pos == npos;
+ VERIFY( pos == npos );
pos = y.find_last_not_of("XYZ");
- test &= pos == 0;
+ VERIFY( pos == 0 );
pos = y.find_last_not_of("a");
- test &= pos == npos;
+ VERIFY( pos == npos );
std::string z("ab");
pos = z.find_last_not_of('X');
- test &= pos == 1;
+ VERIFY( pos == 1 );
pos = z.find_last_not_of("XYZ");
- test &= pos == 1;
+ VERIFY( pos == 1 );
pos = z.find_last_not_of('b');
- test &= pos == 0;
+ VERIFY( pos == 0 );
pos = z.find_last_not_of("Xb");
- test &= pos == 0;
+ VERIFY( pos == 0 );
pos = z.find_last_not_of("Xa");
- test &= pos == 1;
+ VERIFY( pos == 1 );
pos = z.find_last_of("ab");
- test &= pos == 1;
+ VERIFY( pos == 1 );
pos = z.find_last_of("Xa");
- test &= pos == 0;
+ VERIFY( pos == 0 );
pos = z.find_last_of("Xb");
- test &= pos == 1;
+ VERIFY( pos == 1 );
pos = z.find_last_of("XYZ");
- test &= pos == std::string::npos;
+ VERIFY( pos == std::string::npos );
pos = z.find_last_of('a');
- test &= pos == 0;
+ VERIFY( pos == 0 );
pos = z.find_last_of('b');
- test &= pos == 1;
+ VERIFY( pos == 1 );
pos = z.find_last_of('X');
- test &= pos == std::string::npos;
+ VERIFY( pos == std::string::npos );
#endif
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/21_strings/insert.cc b/libstdc++-v3/testsuite/21_strings/insert.cc
index 71617d6..da51000 100644
--- a/libstdc++-v3/testsuite/21_strings/insert.cc
+++ b/libstdc++-v3/testsuite/21_strings/insert.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int test01(void)
{
@@ -56,13 +54,13 @@ int test01(void)
csz02 = str02.size();
try {
str03.insert(csz01 + 1, str02, 0, 5);
- test &= false;
+ VERIFY( false );
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
str03 = str01;
@@ -70,13 +68,13 @@ int test01(void)
csz02 = str02.size();
try {
str03.insert(0, str02, csz02 + 1, 5);
- test &= false;
+ VERIFY( false );
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
csz01 = str01.max_size();
@@ -86,39 +84,39 @@ int test01(void)
csz02 = str02.size();
try {
str03.insert(0, str02, 0, 5);
- test &= false;
+ VERIFY( false );
}
catch(std::length_error& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
}
catch(std::bad_alloc& failure){
- test &= true;
+ VERIFY( true );
}
catch(std::exception& failure){
- test &= false;
+ VERIFY( false );
}
str03 = str01;
csz01 = str03.size();
csz02 = str02.size();
str03.insert(13, str02, 0, 12);
- test&= str03 == "rodeo beach, baker beach,marin";
+ VERIFY( str03 == "rodeo beach, baker beach,marin" );
str03 = str01;
csz01 = str03.size();
csz02 = str02.size();
str03.insert(0, str02, 0, 12);
- test&= str03 == "baker beach,rodeo beach, marin";
+ VERIFY( str03 == "baker beach,rodeo beach, marin" );
str03 = str01;
csz01 = str03.size();
csz02 = str02.size();
str03.insert(csz01, str02, 0, csz02);
- test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+ VERIFY( str03 == "rodeo beach, marinbaker beach, san francisco" );
// string& insert(size_type __p, const string& string);
// insert(p1, str, 0, npos)
@@ -126,47 +124,47 @@ int test01(void)
csz01 = str03.size();
csz02 = str02.size();
str03.insert(csz01, str02);
- test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+ VERIFY( str03 == "rodeo beach, marinbaker beach, san francisco" );
str03 = str01;
csz01 = str03.size();
csz02 = str02.size();
str03.insert(0, str02);
- test&= str03 == "baker beach, san franciscorodeo beach, marin";
+ VERIFY( str03 == "baker beach, san franciscorodeo beach, marin" );
// string& insert(size_type __p, const char* s, size_type n);
// insert(p1, string(s,n))
str03 = str02;
csz01 = str03.size();
str03.insert(0, "-break at the bridge", 20);
- test&= str03 == "-break at the bridgebaker beach, san francisco";
+ VERIFY( str03 == "-break at the bridgebaker beach, san francisco" );
// string& insert(size_type __p, const char* s);
// insert(p1, string(s))
str03 = str02;
str03.insert(0, "-break at the bridge");
- test&= str03 == "-break at the bridgebaker beach, san francisco";
+ VERIFY( str03 == "-break at the bridgebaker beach, san francisco" );
// string& insert(size_type __p, size_type n, char c)
// insert(p1, string(n,c))
str03 = str02;
csz01 = str03.size();
str03.insert(csz01, 5, 'z');
- test&= str03 == "baker beach, san franciscozzzzz";
+ VERIFY( str03 == "baker beach, san franciscozzzzz" );
// iterator insert(iterator p, char c)
// inserts a copy of c before the character referred to by p
str03 = str02;
citerator cit01 = str03.begin();
str03.insert(cit01, 'u');
- test&= str03 == "ubaker beach, san francisco";
+ VERIFY( str03 == "ubaker beach, san francisco" );
// iterator insert(iterator p, size_type n, char c)
// inserts n copies of c before the character referred to by p
str03 = str02;
cit01 = str03.begin();
str03.insert(cit01, 5, 'u');
- test&= str03 == "uuuuubaker beach, san francisco";
+ VERIFY( str03 == "uuuuubaker beach, san francisco" );
// template<inputit>
// void
@@ -176,12 +174,12 @@ int test01(void)
str03 = str02;
csz01 = str03.size();
str03.insert(str03.begin(), str01.begin(), str01.end());
- test&= str03 == "rodeo beach, marinbaker beach, san francisco";
+ VERIFY( str03 == "rodeo beach, marinbaker beach, san francisco" );
str03 = str02;
csz01 = str03.size();
str03.insert(str03.end(), str01.begin(), str01.end());
- test&= str03 == "baker beach, san franciscorodeo beach, marin";
+ VERIFY( str03 == "baker beach, san franciscorodeo beach, marin" );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
index 4256d07..6b1c2d8 100644
--- a/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
+++ b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc
@@ -29,9 +29,7 @@
#include <sstream>
#include <fstream>
#include <iostream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -54,91 +52,91 @@ bool test01(void)
// istream& operator>>(istream&, string&)
std::istringstream istrs01(str01);
istrs01 >> str10;
- test &= str10 == str02;
+ VERIFY( str10 == str02 );
try {
std::istringstream::int_type i01 = istrs01.peek(); //a-boo
- test &= std::istringstream::traits_type::to_char_type(i01) == ' ';
+ VERIFY( std::istringstream::traits_type::to_char_type(i01) == ' ' );
}
catch(std::exception& fail) {
- test &= false; // shouldn't throw
+ VERIFY( false ); // shouldn't throw
}
istrs01 >> str10;
- test &= str10 == str03;
+ VERIFY( str10 == str03 );
istrs01 >> str10;
- test &= str10 == str04; // sentry picks out the white spaces. .
+ VERIFY( str10 == str04 ); // sentry picks out the white spaces. .
std::istringstream istrs02(str05); // empty
istrs02 >> str10;
- test &= str10 == str04;
+ VERIFY( str10 == str04 );
// istream& getline(istream&, string&, char)
// istream& getline(istream&, string&)
try {
getline(istrs01, str10);
- test &= !istrs01.fail();
- test &= !istrs01.eof();
- test &= istrs01.good();
- test &= str10 == " bay";
+ VERIFY( !istrs01.fail() );
+ VERIFY( !istrs01.eof() );
+ VERIFY( istrs01.good() );
+ VERIFY( str10 == " bay" );
}
catch(std::exception& fail) {
- test &= false; // shouldn't throw
+ VERIFY( false ); // shouldn't throw
}
try {
istrs01.clear();
getline(istrs01, str10,'\t');
- test &= !istrs01.fail();
- test &= !istrs01.eof();
- test &= istrs01.good();
- test &= str10 == str05;
+ VERIFY( !istrs01.fail() );
+ VERIFY( !istrs01.eof() );
+ VERIFY( istrs01.good() );
+ VERIFY( str10 == str05 );
}
catch(std::exception& fail) {
- test &= false; // shouldn't throw
+ VERIFY( false ); // shouldn't throw
}
try {
istrs01.clear();
getline(istrs01, str10,'\t');
- test &= !istrs01.fail();
- test &= !istrs01.eof();
- test &= istrs01.good();
- test &= str10 == str05;
+ VERIFY( !istrs01.fail() );
+ VERIFY( !istrs01.eof() );
+ VERIFY( istrs01.good() );
+ VERIFY( str10 == str05 );
}
catch(std::exception& fail) {
- test &= false; // shouldn't throw
+ VERIFY( false ); // shouldn't throw
}
try {
istrs01.clear();
getline(istrs01, str10, '.');
- test &= !istrs01.fail();
- test &= istrs01.eof();
- test &= !istrs01.good();
- test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
+ VERIFY( !istrs01.fail() );
+ VERIFY( istrs01.eof() );
+ VERIFY( !istrs01.good() );
+ VERIFY( str10 == "\t from Elk Rapids to the point reminds me of miles" );
}
catch(std::exception& fail) {
- test &= false; // shouldn't throw
+ VERIFY( false ); // shouldn't throw
}
try {
getline(istrs02, str10);
- test &= istrs02.fail();
- test &= istrs02.eof();
- test &= str10 == "\t from Elk Rapids to the point reminds me of miles";
+ VERIFY( istrs02.fail() );
+ VERIFY( istrs02.eof() );
+ VERIFY( str10 == "\t from Elk Rapids to the point reminds me of miles" );
}
catch(std::exception& fail) {
- test &= false; // shouldn't throw
+ VERIFY( false ); // shouldn't throw
}
// ostream& operator<<(ostream&, const basic_string&)
std::ostringstream ostrs01;
try {
ostrs01 << str01;
- test &= ostrs01.str() == str01;
+ VERIFY( ostrs01.str() == str01 );
}
catch(std::exception& fail) {
- test &= false;
+ VERIFY( false );
}
std::string hello_world;
@@ -161,8 +159,8 @@ void test04(int size)
std::ostringstream oss(str);
// sanity checks
- test &= str.size() == size;
- test &= oss.good();
+ VERIFY( str.size() == size );
+ VERIFY( oss.good() );
// stress test
oss << str << std::endl;
@@ -173,10 +171,10 @@ void test04(int size)
if (!oss.good())
test = false;
- test &= str.size() == size;
- test &= oss.good();
+ VERIFY( str.size() == size );
+ VERIFY( oss.good() );
std::string str_tmp = oss.str();
- test &= str_tmp.size() == expected_size;
+ VERIFY( str_tmp.size() == expected_size );
#ifdef DEBUG_ASSERT
assert(test);
@@ -196,8 +194,8 @@ void test05(int size)
std::string str(size, fillc);
// sanity checks
- test &= str.size() == size;
- test &= ofs.good();
+ VERIFY( str.size() == size );
+ VERIFY( ofs.good() );
// stress test
ofs << str << std::endl;
@@ -208,8 +206,8 @@ void test05(int size)
if (!ofs.good())
test = false;
- test &= str.size() == size;
- test &= ofs.good();
+ VERIFY( str.size() == size );
+ VERIFY( ofs.good() );
ofs.close();
@@ -229,7 +227,7 @@ void test05(int size)
break;
}
- test &= count == 2 * size;
+ VERIFY( count == 2 * size );
#ifdef DEBUG_ASSERT
assert(test);
@@ -251,16 +249,16 @@ void test06(void)
str01.erase(0, 1);
size_type i03 = str01.size();
size_type i04 = str01.capacity();
- test &= i01 - 1 == i03;
- test &= i02 >= i04;
+ VERIFY( i01 - 1 == i03 );
+ VERIFY( i02 >= i04 );
std::istringstream is(str01);
std::string str02;
is >> str02 >> std::ws;
size_type i05 = str02.size();
size_type i06 = str02.capacity();
- test &= i05 == i03;
- test &= i06 <= i04;
+ VERIFY( i05 == i03 );
+ VERIFY( i06 <= i04 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -281,8 +279,8 @@ void test07(void)
while (iss >> s)
++i;
- test &= i < 3;
- test &= static_cast<bool>(iss.rdstate() & std::ios_base::failbit);
+ VERIFY( i < 3 );
+ VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/invariants.cc b/libstdc++-v3/testsuite/21_strings/invariants.cc
index 1eeabd3..5a00281 100644
--- a/libstdc++-v3/testsuite/21_strings/invariants.cc
+++ b/libstdc++-v3/testsuite/21_strings/invariants.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
// Do a quick sanity check on known problems with element access and
// ref-counted strings. These should all pass, regardless of the
@@ -60,48 +58,48 @@ bool test01(void)
str03 = str01;
it1 = str01.begin();
*it1 = 'x';
- test &= str01[0] == 'x';
- test &= str03[0] == 'm';
+ VERIFY( str01[0] == 'x' );
+ VERIFY( str03[0] == 'm' );
str03 = str01;
csz01 = str01.size();
rit1 = str01.rbegin(); // NB: Pointing at one-past the end, so ...
*rit1 = 'z'; // ... but it's taken care of here
- test &= str01[csz01 - 1] == 'z';
- test &= str03[csz01 - 1] == 'y';
+ VERIFY( str01[csz01 - 1] == 'z' );
+ VERIFY( str03[csz01 - 1] == 'y' );
str03 = str01;
csz01 = str01.size();
std::string::reference r1 = str01.at(csz01 - 2);
- test &= str03 == str01;
+ VERIFY( str03 == str01 );
r1 = 'd';
- test &= str01[csz01 - 2] == 'd';
- test &= str03[csz01 - 2] == 'a';
+ VERIFY( str01[csz01 - 2] == 'd' );
+ VERIFY( str03[csz01 - 2] == 'a' );
str03 = str01;
csz01 = str01.size();
std::string::reference r2 = str01[csz01 - 3];
- test &= str03 == str01;
+ VERIFY( str03 == str01 );
r2 = 'w';
- test &= str01[csz01 - 3] == 'w';
- test &= str03[csz01 - 3] == 'b';
+ VERIFY( str01[csz01 - 3] == 'w' );
+ VERIFY( str03[csz01 - 3] == 'b' );
str03 = str01;
csz02 = str01.size();
it1 = str01.end();
- test &= str03 == str01;
+ VERIFY( str03 == str01 );
--it1;
*it1 = 'q';
- test &= str01[csz02 - 1] == 'q';
- test &= str03[csz02 - 1] == 'z';
+ VERIFY( str01[csz02 - 1] == 'q' );
+ VERIFY( str03[csz02 - 1] == 'z' );
str03 = str01;
rit1 = str01.rend();
- test &= str03 == str01;
+ VERIFY( str03 == str01 );
--rit1;
*rit1 = 'p';
- test &= str01[0] == 'p';
- test &= str03[0] == 'x';
+ VERIFY( str01[0] == 'p' );
+ VERIFY( str03[0] == 'x' );
// need to also test for const begin/const end
#ifdef DEBUG_ASSERT
@@ -129,39 +127,39 @@ bool test02(void)
std::string str05 = str02; // optional, so that begin below causes a mutate
std::string::iterator p = str02.insert(str02.begin(), ' ');
std::string str03 = str02;
- test &= str03 == str02;
+ VERIFY( str03 == str02 );
*p = '!';
- test &= *str03.c_str() == ' ';
+ VERIFY( *str03.c_str() == ' ' );
str03[0] = '@';
- test &= str02[0] == '!';
- test &= *p == '!';
- test &= str02 != str05;
- test &= str02 != str03;
+ VERIFY( str02[0] == '!' );
+ VERIFY( *p == '!' );
+ VERIFY( str02 != str05 );
+ VERIFY( str02 != str03 );
std::string str10 = str01;
std::string::iterator p2 = str10.insert(str10.begin(), 'a');
std::string str11 = str10;
*p2 = 'e';
- test &= str11 != str10;
+ VERIFY( str11 != str10 );
std::string str06 = str01;
std::string str07 = str06; // optional, so that begin below causes a mutate
p = str06.erase(str06.begin());
std::string str08 = str06;
- test &= str08 == str06;
+ VERIFY( str08 == str06 );
*p = '!';
- test &= *str08.c_str() == 't';
+ VERIFY( *str08.c_str() == 't' );
str08[0] = '@';
- test &= str06[0] == '!';
- test &= *p == '!';
- test &= str06 != str07;
- test &= str06 != str08;
+ VERIFY( str06[0] == '!' );
+ VERIFY( *p == '!' );
+ VERIFY( str06 != str07 );
+ VERIFY( str06 != str08 );
std::string str12 = str01;
p2 = str12.erase(str12.begin(), str12.begin() + str12.size() - 1);
std::string str13 = str12;
*p2 = 'e';
- test &= str12 != str13;
+ VERIFY( str12 != str13 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/nonmember.cc b/libstdc++-v3/testsuite/21_strings/nonmember.cc
index 2116839..61704fd 100644
--- a/libstdc++-v3/testsuite/21_strings/nonmember.cc
+++ b/libstdc++-v3/testsuite/21_strings/nonmember.cc
@@ -111,9 +111,7 @@ template<class charT, class traits, class Allocator>
*/
#include <string>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int test01(void)
{
@@ -126,114 +124,114 @@ int test01(void)
str_4 = str_0;
//comparisons between string objects
- test &= !(str_0 == str_1);
- test &= !(str_0 == str_2);
- test &= !(str_0 == str_3);
- test &= !(str_1 == str_0);
- test &= !(str_2 == str_0);
- test &= !(str_3 == str_0);
- test &= str_4 == str_0;
- test &= str_0 == str_4;
-
- test &= str_0 != str_1;
- test &= str_0 != str_2;
- test &= str_0 != str_3;
- test &= str_1 != str_0;
- test &= str_2 != str_0;
- test &= str_3 != str_0;
- test &= !(str_0 != str_4);
- test &= !(str_4 != str_0);
+ VERIFY( !(str_0 == str_1) );
+ VERIFY( !(str_0 == str_2) );
+ VERIFY( !(str_0 == str_3) );
+ VERIFY( !(str_1 == str_0) );
+ VERIFY( !(str_2 == str_0) );
+ VERIFY( !(str_3 == str_0) );
+ VERIFY( str_4 == str_0 );
+ VERIFY( str_0 == str_4 );
+
+ VERIFY( str_0 != str_1 );
+ VERIFY( str_0 != str_2 );
+ VERIFY( str_0 != str_3 );
+ VERIFY( str_1 != str_0 );
+ VERIFY( str_2 != str_0 );
+ VERIFY( str_3 != str_0 );
+ VERIFY( !(str_0 != str_4) );
+ VERIFY( !(str_4 != str_0) );
- test &= str_0 > str_1; //true cuz r>m
- test &= str_0 > str_2;
- test &= !(str_0 > str_3);
- test &= !(str_1 > str_0); //false cuz m<r
- test &= !(str_2 > str_0);
- test &= str_3 > str_0;
- test &= !(str_0 > str_4);
- test &= !(str_4 > str_0);
-
- test &= !(str_0 < str_1); //false cuz r>m
- test &= !(str_0 < str_2);
- test &= str_0 < str_3;
- test &= str_1 < str_0; //true cuz m<r
- test &= str_2 < str_0;
- test &= !(str_3 < str_0);
- test &= !(str_0 < str_4);
- test &= !(str_4 < str_0);
-
- test &= str_0 >= str_1; //true cuz r>m
- test &= str_0 >= str_2;
- test &= !(str_0 >= str_3);
- test &= !(str_1 >= str_0);//false cuz m<r
- test &= !(str_2 >= str_0);
- test &= str_3 >= str_0;
- test &= str_0 >= str_4;
- test &= str_4 >= str_0;
-
- test &= !(str_0 <= str_1);//false cuz r>m
- test &= !(str_0 <= str_2);
- test &= str_0 <= str_3;
- test &= str_1 <= str_0;//true cuz m<r
- test &= str_2 <= str_0;
- test &= !(str_3 <= str_0);
- test &= str_0 <= str_4;
- test &= str_4 <= str_0;
+ VERIFY( str_0 > str_1 ); //true cuz r>m
+ VERIFY( str_0 > str_2 );
+ VERIFY( !(str_0 > str_3) );
+ VERIFY( !(str_1 > str_0) ); //false cuz m<r
+ VERIFY( !(str_2 > str_0) );
+ VERIFY( str_3 > str_0 );
+ VERIFY( !(str_0 > str_4) );
+ VERIFY( !(str_4 > str_0) );
+
+ VERIFY( !(str_0 < str_1) ); //false cuz r>m
+ VERIFY( !(str_0 < str_2) );
+ VERIFY( str_0 < str_3 );
+ VERIFY( str_1 < str_0 ); //true cuz m<r
+ VERIFY( str_2 < str_0 );
+ VERIFY( !(str_3 < str_0) );
+ VERIFY( !(str_0 < str_4) );
+ VERIFY( !(str_4 < str_0) );
+
+ VERIFY( str_0 >= str_1 ); //true cuz r>m
+ VERIFY( str_0 >= str_2 );
+ VERIFY( !(str_0 >= str_3) );
+ VERIFY( !(str_1 >= str_0) );//false cuz m<r
+ VERIFY( !(str_2 >= str_0) );
+ VERIFY( str_3 >= str_0 );
+ VERIFY( str_0 >= str_4 );
+ VERIFY( str_4 >= str_0 );
+
+ VERIFY( !(str_0 <= str_1) );//false cuz r>m
+ VERIFY( !(str_0 <= str_2) );
+ VERIFY( str_0 <= str_3 );
+ VERIFY( str_1 <= str_0 );//true cuz m<r
+ VERIFY( str_2 <= str_0 );
+ VERIFY( !(str_3 <= str_0) );
+ VERIFY( str_0 <= str_4 );
+ VERIFY( str_4 <= str_0 );
//comparisons between string object and string literal
- test &= !(str_0 == "costa marbella");
- test &= !(str_0 == "cost");
- test &= !(str_0 == "costa ricans");
- test &= !("costa marbella" == str_0);
- test &= !("cost" == str_0);
- test &= !("costa ricans" == str_0);
- test &= "costa rica" == str_0;
- test &= str_0 == "costa rica";
-
- test &= str_0 != "costa marbella";
- test &= str_0 != "cost";
- test &= str_0 != "costa ricans";
- test &= "costa marbella" != str_0;
- test &= "cost" != str_0;
- test &= "costa ricans" != str_0;
- test &= !("costa rica" != str_0);
- test &= !(str_0 != "costa rica");
-
- test &= str_0 > "costa marbella"; //true cuz r>m
- test &= str_0 > "cost";
- test &= !(str_0 > "costa ricans");
- test &= !("costa marbella" > str_0);//false cuz m<r
- test &= !("cost" > str_0);
- test &= "costa ricans" > str_0;
- test &= !("costa rica" > str_0);
- test &= !(str_0 > "costa rica");
-
- test &= !(str_0 < "costa marbella");//false cuz r>m
- test &= !(str_0 < "cost");
- test &= str_0 < "costa ricans";
- test &= "costa marbella" < str_0;//true cuz m<r
- test &= "cost" < str_0;
- test &= !("costa ricans" < str_0);
- test &= !("costa rica" < str_0);
- test &= !(str_0 < "costa rica");
-
- test &= str_0 >= "costa marbella";//true cuz r>m
- test &= str_0 >= "cost";
- test &= !(str_0 >= "costa ricans");
- test &= !("costa marbella" >= str_0);//false cuz m<r
- test &= !("cost" >= str_0);
- test &= "costa ricans" >= str_0;
- test &= "costa rica" >= str_0;
- test &= str_0 >= "costa rica";
-
- test &= !(str_0 <= "costa marbella");//false cuz r>m
- test &= !(str_0 <= "cost");
- test &= str_0 <= "costa ricans";
- test &= "costa marbella" <= str_0;//true cuz m<r
- test &= "cost" <= str_0;
- test &= !("costa ricans" <= str_0);
- test &= "costa rica" <= str_0;
- test &= str_0 <= "costa rica";
+ VERIFY( !(str_0 == "costa marbella") );
+ VERIFY( !(str_0 == "cost") );
+ VERIFY( !(str_0 == "costa ricans") );
+ VERIFY( !("costa marbella" == str_0) );
+ VERIFY( !("cost" == str_0) );
+ VERIFY( !("costa ricans" == str_0) );
+ VERIFY( "costa rica" == str_0 );
+ VERIFY( str_0 == "costa rica" );
+
+ VERIFY( str_0 != "costa marbella" );
+ VERIFY( str_0 != "cost" );
+ VERIFY( str_0 != "costa ricans" );
+ VERIFY( "costa marbella" != str_0 );
+ VERIFY( "cost" != str_0 );
+ VERIFY( "costa ricans" != str_0 );
+ VERIFY( !("costa rica" != str_0) );
+ VERIFY( !(str_0 != "costa rica") );
+
+ VERIFY( str_0 > "costa marbella" ); //true cuz r>m
+ VERIFY( str_0 > "cost" );
+ VERIFY( !(str_0 > "costa ricans") );
+ VERIFY( !("costa marbella" > str_0) );//false cuz m<r
+ VERIFY( !("cost" > str_0) );
+ VERIFY( "costa ricans" > str_0 );
+ VERIFY( !("costa rica" > str_0) );
+ VERIFY( !(str_0 > "costa rica") );
+
+ VERIFY( !(str_0 < "costa marbella") );//false cuz r>m
+ VERIFY( !(str_0 < "cost") );
+ VERIFY( str_0 < "costa ricans" );
+ VERIFY( "costa marbella" < str_0 );//true cuz m<r
+ VERIFY( "cost" < str_0 );
+ VERIFY( !("costa ricans" < str_0) );
+ VERIFY( !("costa rica" < str_0) );
+ VERIFY( !(str_0 < "costa rica") );
+
+ VERIFY( str_0 >= "costa marbella" );//true cuz r>m
+ VERIFY( str_0 >= "cost" );
+ VERIFY( !(str_0 >= "costa ricans") );
+ VERIFY( !("costa marbella" >= str_0) );//false cuz m<r
+ VERIFY( !("cost" >= str_0) );
+ VERIFY( "costa ricans" >= str_0 );
+ VERIFY( "costa rica" >= str_0 );
+ VERIFY( str_0 >= "costa rica" );
+
+ VERIFY( !(str_0 <= "costa marbella") );//false cuz r>m
+ VERIFY( !(str_0 <= "cost") );
+ VERIFY( str_0 <= "costa ricans" );
+ VERIFY( "costa marbella" <= str_0 );//true cuz m<r
+ VERIFY( "cost" <= str_0 );
+ VERIFY( !("costa ricans" <= str_0) );
+ VERIFY( "costa rica" <= str_0 );
+ VERIFY( str_0 <= "costa rica" );
// 21.3.7.1 operator+
/*
@@ -262,19 +260,19 @@ template<class charT, class traits, class Allocator>
*/
str_4 = str_0 + "ns";
- test &= str_4 == str_3;
+ VERIFY( str_4 == str_3 );
const std::string str_5(" marbella");
str_4 = "costa" + str_5;
- test &= str_4 == str_1;
+ VERIFY( str_4 == str_1 );
std::string str_6("ns");
str_4 = str_0 + str_6;
- test &= str_4 == str_3;
+ VERIFY( str_4 == str_3 );
str_4 = str_0 + 'n';
str_4 = str_4 + 's';
- test &= str_4 == str_3;
+ VERIFY( str_4 == str_3 );
str_4 = 'a' + str_6;
str_4 = 'c' + str_4;
@@ -286,7 +284,7 @@ template<class charT, class traits, class Allocator>
str_4 = 's' + str_4;
str_4 = 'o' + str_4;
str_4 = 'c' + str_4;
- test &= str_4 == str_3;
+ VERIFY( str_4 == str_3 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/operations.cc b/libstdc++-v3/testsuite/21_strings/operations.cc
index 06e811f..996d7d56 100644
--- a/libstdc++-v3/testsuite/21_strings/operations.cc
+++ b/libstdc++-v3/testsuite/21_strings/operations.cc
@@ -22,9 +22,7 @@
#include <string>
#include <cstdio>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
int test01(void)
{
diff --git a/libstdc++-v3/testsuite/21_strings/replace.cc b/libstdc++-v3/testsuite/21_strings/replace.cc
index b2d1096..2ad1ab6 100644
--- a/libstdc++-v3/testsuite/21_strings/replace.cc
+++ b/libstdc++-v3/testsuite/21_strings/replace.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -60,23 +58,23 @@ bool test01(void)
std::string x = X;
char ch = x[0];
- test &= ch == 'H';
+ VERIFY( ch == 'H' );
std::string z = x.substr(2, 3);
- test &= z == "llo";
+ VERIFY( z == "llo" );
x.replace(2, 2, "r");
- test &= x == "Hero";
+ VERIFY( x == "Hero" );
x = X;
x.replace(0, 1, "j");
- test &= x == "jello";
+ VERIFY( x == "jello" );
int ar[] = { 'H', 'e', 'l', 'l', 'o' };
x.replace(std::find(x.begin(), x.end(), 'l'),
std::find(x.rbegin(), x.rend(), 'l').base(), ar,
ar + sizeof(ar) / sizeof(ar[0]));
- test &= x == "jeHelloo";
+ VERIFY( x == "jeHelloo" );
#endif
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/21_strings/rfind.cc b/libstdc++-v3/testsuite/21_strings/rfind.cc
index eb54295..cf826dd 100644
--- a/libstdc++-v3/testsuite/21_strings/rfind.cc
+++ b/libstdc++-v3/testsuite/21_strings/rfind.cc
@@ -20,9 +20,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
// 21.3.6.2 basic_string rfind
bool test01(void)
@@ -42,50 +40,50 @@ bool test01(void)
// size_type rfind(const string&, size_type pos = 0) const;
csz01 = str01.rfind(str01);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str01, 4);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str02,3);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str02);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str03);
- test &= csz01 == 8;
+ VERIFY( csz01 == 8 );
csz01 = str01.rfind(str03, 3);
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
csz01 = str01.rfind(str03, 12);
- test &= csz01 == 8;
+ VERIFY( csz01 == 8 );
// An empty string consists of no characters
// therefore it should be found at every point in a string,
// except beyond the end
csz01 = str01.rfind(str04, 0);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str04, 5);
- test &= csz01 == 5;
+ VERIFY( csz01 == 5 );
csz01 = str01.rfind(str04, str01.size());
- test &= csz01 == str01.size();
+ VERIFY( csz01 == str01.size() );
csz01 = str01.rfind(str04, str01.size()+1);
- test &= csz01 == str01.size();
+ VERIFY( csz01 == str01.size() );
// size_type rfind(const char* s, size_type pos, size_type n) const;
csz01 = str01.rfind(str_lit01, 0, 3);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str_lit01, 3, 0);
- test &= csz01 == 3;
+ VERIFY( csz01 == 3 );
// size_type rfind(const char* s, size_type pos = 0) const;
csz01 = str01.rfind(str_lit01);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
csz01 = str01.rfind(str_lit01, 3);
- test &= csz01 == 0;
+ VERIFY( csz01 == 0 );
// size_type rfind(char c, size_type pos = 0) const;
csz01 = str01.rfind('z');
csz02 = str01.size() - 1;
- test &= csz01 == csz02;
+ VERIFY( csz01 == csz02 );
csz01 = str01.rfind('/');
- test &= csz01 == npos;
+ VERIFY( csz01 == npos );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/21_strings/substr.cc b/libstdc++-v3/testsuite/21_strings/substr.cc
index 354dbb2..5c64357 100644
--- a/libstdc++-v3/testsuite/21_strings/substr.cc
+++ b/libstdc++-v3/testsuite/21_strings/substr.cc
@@ -22,9 +22,7 @@
#include <string>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -43,30 +41,30 @@ bool test01(void)
// substr(size_type pos = 0, size_type n = npos) const;
csz01 = str01.size();
str02 = str01.substr(0, 1);
- test &= str02 == "r";
+ VERIFY( str02 == "r" );
str02 = str01.substr(10);
- test &= str02 == "pacifica";
+ VERIFY( str02 == "pacifica" );
try {
str02 = str01.substr(csz01 + 1);
- test &= false;
+ VERIFY( false );
}
catch(std::out_of_range& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
try {
str02 = str01.substr(csz01);
- test &= str02.size() == 0;
+ VERIFY( str02.size() == 0 );
}
catch(std::out_of_range& fail) {
- test &= false;
+ VERIFY( false );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc b/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
index 06ce7c3..2e91710 100644
--- a/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
+++ b/libstdc++-v3/testsuite/22_locale/ctype_char_members.cc
@@ -31,9 +31,7 @@
#include <locale>
// NB: Don't include any other headers in this file.
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
class gnu_ctype: public std::ctype<char> {};
@@ -59,37 +57,37 @@ void test01()
char c_array[len + 1];
// bool is(mask m, char c) const;
- test &= gctype.is(std::ctype_base::space, c30);
- test &= gctype.is(std::ctype_base::upper, c00);
- test &= gctype.is(std::ctype_base::lower, c10);
- test &= gctype.is(std::ctype_base::digit, c20);
- test &= gctype.is(std::ctype_base::punct, c40);
- test &= gctype.is(std::ctype_base::alpha, c50);
- test &= gctype.is(std::ctype_base::alpha, c60);
- test &= gctype.is(std::ctype_base::xdigit, c20);
- test &= !gctype.is(std::ctype_base::xdigit, c80);
- test &= gctype.is(std::ctype_base::alnum, c50);
- test &= gctype.is(std::ctype_base::alnum, c20);
- test &= gctype.is(std::ctype_base::graph, c40);
- test &= gctype.is(std::ctype_base::graph, c20);
+ VERIFY( gctype.is(std::ctype_base::space, c30) );
+ VERIFY( gctype.is(std::ctype_base::upper, c00) );
+ VERIFY( gctype.is(std::ctype_base::lower, c10) );
+ VERIFY( gctype.is(std::ctype_base::digit, c20) );
+ VERIFY( gctype.is(std::ctype_base::punct, c40) );
+ VERIFY( gctype.is(std::ctype_base::alpha, c50) );
+ VERIFY( gctype.is(std::ctype_base::alpha, c60) );
+ VERIFY( gctype.is(std::ctype_base::xdigit, c20) );
+ VERIFY( !gctype.is(std::ctype_base::xdigit, c80) );
+ VERIFY( gctype.is(std::ctype_base::alnum, c50) );
+ VERIFY( gctype.is(std::ctype_base::alnum, c20) );
+ VERIFY( gctype.is(std::ctype_base::graph, c40) );
+ VERIFY( gctype.is(std::ctype_base::graph, c20) );
// char toupper(char c) const
c100 = gctype.toupper(c10);
- test &= c100 == c00;
+ VERIFY( c100 == c00 );
// char tolower(char c) const
c100 = gctype.tolower(c00);
- test &= c100 == c10;
+ VERIFY( c100 == c10 );
// char toupper(char* low, const char* hi) const
std::char_traits<char>::copy(c_array, strlit02, len + 1);
gctype.toupper(c_array, c_array + len);
- test &= !std::char_traits<char>::compare(c_array, strlit01, len - 1);
+ VERIFY( !std::char_traits<char>::compare(c_array, strlit01, len - 1) );
// char tolower(char* low, const char* hi) const
std::char_traits<char>::copy(c_array, strlit01, len + 1);
gctype.tolower(c_array, c_array + len);
- test &= !std::char_traits<char>::compare(c_array, strlit02, len - 1);
+ VERIFY( !std::char_traits<char>::compare(c_array, strlit02, len - 1) );
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc b/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
index d044777..9741f24 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset_ctor.cc
@@ -22,9 +22,7 @@
#include <string>
#include <bitset>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -34,15 +32,15 @@ bool test01(void)
const size_t n1 = 5;
std::bitset<n1> bit01;
for (int i = 0; i < n1; ++i)
- test &= !bit01.test(i);
+ VERIFY( !bit01.test(i) );
// bitset(unsigned long)
const size_t n2 = 32;
unsigned long ul1 = 2;
std::bitset<n2> bit02(ul1);
- test &= !bit02.test(0);
- test &= bit02.test(1);
- test &= !bit02.test(2);
+ VERIFY( !bit02.test(0) );
+ VERIFY( bit02.test(1) );
+ VERIFY( !bit02.test(2) );
// template<_CharT, _Traits, _Alloc>
// explicit bitset(const basic_string<_C,_T,_A>&, size_type pos, size_type n)
@@ -52,10 +50,10 @@ bool test01(void)
std::bitset<n3> bit03(str01, 5);
}
catch(std::invalid_argument& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test&= false;
+ VERIFY( false );
}
std::string str02("010101000011");
@@ -66,13 +64,13 @@ bool test01(void)
for (int i = 0; i < sz; ++i)
str03 += (bit03.test(i) ? '1' : '0');
std::reverse(str03.begin(), str03.end());
- test &= str03 == str02;
+ VERIFY( str03 == str02 );
}
catch(std::invalid_argument& fail) {
- test &= false;
+ VERIFY( false );
}
catch(...) {
- test&= false;
+ VERIFY( false );
}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset_shift.cc b/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
index d439edb..3ca2ee3 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset_shift.cc
@@ -22,9 +22,7 @@
#include <set>
#include <bitset>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
static char original_bits[1024];
static char left_shifted[1024];
@@ -78,13 +76,13 @@ template <size_t size>
shifted <<= shift_step;
//correct = std::string(left_shifted);
correct = std::bitset<size> (std::string(left_shifted));
- test &= shifted == correct;
+ VERIFY( shifted == correct );
shifted = original;
shifted >>= shift_step;
//correct = std::string(right_shifted);
correct = std::bitset<size> (std::string(right_shifted));
- test &= shifted == correct;
+ VERIFY( shifted == correct );
}
return test;
@@ -94,13 +92,13 @@ bool
test01() {
bool test = true;
- test &= do_test<32>();
- test &= do_test<48>();
- test &= do_test<64>();
+ VERIFY( do_test<32>() );
+ VERIFY( do_test<48>() );
+ VERIFY( do_test<64>() );
- test &= do_test<511>();
- test &= do_test<513>();
- test &= do_test<997>();
+ VERIFY( do_test<511>() );
+ VERIFY( do_test<513>() );
+ VERIFY( do_test<997>() );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/23_containers/vector_capacity.cc b/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
index c5207f4..b69e2ab 100644
--- a/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector_capacity.cc
@@ -22,9 +22,7 @@
// 23.2.4.2 vector capacity
#include <vector>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
template<typename T>
struct A { };
@@ -42,17 +40,17 @@ bool test01()
size_type sz01 = vec01.capacity();
vec01.reserve(100);
size_type sz02 = vec01.capacity();
- test &= sz02 >= sz01;
+ VERIFY( sz02 >= sz01 );
sz01 = vec01.size() + 5;
vec01.resize(sz01);
sz02 = vec01.size();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
sz01 = vec01.size() - 5;
vec01.resize(sz01);
sz02 = vec01.size();
- test &= sz01 == sz02;
+ VERIFY( sz01 == sz02 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/23_containers/vector_ctor.cc b/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
index 204ab55..aa9b94e 100644
--- a/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector_ctor.cc
@@ -22,9 +22,7 @@
// 23.2.4.1 vector constructors, copy, and assignment
#include <vector>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
template<typename T>
struct A { };
diff --git a/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc b/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
index b72d749..f1ba022 100644
--- a/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector_modifiers.cc
@@ -21,9 +21,7 @@
// 23.2.4.3 vector modifiers
#include <vector>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
template<typename T>
struct A { };
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
index 6338015..78d3633 100644
--- a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator.cc
@@ -22,9 +22,7 @@
#include <sstream>
#include <iterator>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -41,55 +39,55 @@ bool test01(void)
cistreambuf_iter istrb_it01(istrs00);
cistreambuf_iter istrb_it02;
std::string tmp(istrb_it01, istrb_it02);
- test &= tmp == str01;
+ VERIFY( tmp == str01 );
cistreambuf_iter istrb_it03(0);
cistreambuf_iter istrb_it04;
- test &= istrb_it03 == istrb_it04;
+ VERIFY( istrb_it03 == istrb_it04 );
cistreambuf_iter istrb_it05(istrs01);
cistreambuf_iter istrb_it06(istrs01.rdbuf());
- test &= istrb_it05 == istrb_it06;
+ VERIFY( istrb_it05 == istrb_it06 );
// bool equal(istreambuf_iter& b)
cistreambuf_iter istrb_it07(0);
cistreambuf_iter istrb_it08;
- test &= istrb_it07.equal(istrb_it08);
+ VERIFY( istrb_it07.equal(istrb_it08) );
cistreambuf_iter istrb_it09(0);
cistreambuf_iter istrb_it10;
- test &= istrb_it10.equal(istrb_it09);
+ VERIFY( istrb_it10.equal(istrb_it09) );
cistreambuf_iter istrb_it11(istrs01);
cistreambuf_iter istrb_it12(istrs01.rdbuf());
- test &= istrb_it11.equal(istrb_it12);
+ VERIFY( istrb_it11.equal(istrb_it12) );
cistreambuf_iter istrb_it13(istrs01);
cistreambuf_iter istrb_it14(istrs01.rdbuf());
- test &= istrb_it14.equal(istrb_it13);
+ VERIFY( istrb_it14.equal(istrb_it13) );
cistreambuf_iter istrb_it15(istrs01);
cistreambuf_iter istrb_it16;
- test &= !(istrb_it15.equal(istrb_it16));
+ VERIFY( !(istrb_it15.equal(istrb_it16)) );
cistreambuf_iter istrb_it17(istrs01);
cistreambuf_iter istrb_it18;
- test &= !(istrb_it18.equal(istrb_it17));
+ VERIFY( !(istrb_it18.equal(istrb_it17)) );
// bool operator==(const istreambuf_iterator&a, const istreambuf_iterator& b)
// bool operator!=(const istreambuf_iterator&a, const istreambuf_iterator& b)
cistreambuf_iter istrb_it19(0);
cistreambuf_iter istrb_it20;
- test &= istrb_it19 == istrb_it20;
+ VERIFY( istrb_it19 == istrb_it20 );
cistreambuf_iter istrb_it21(istrs01);
cistreambuf_iter istrb_it22(istrs01.rdbuf());
- test &= istrb_it22 == istrb_it21;
+ VERIFY( istrb_it22 == istrb_it21 );
cistreambuf_iter istrb_it23(istrs01);
cistreambuf_iter istrb_it24;
- test &= istrb_it23 != istrb_it24;
+ VERIFY( istrb_it23 != istrb_it24 );
cistreambuf_iter istrb_it25(0);
cistreambuf_iter istrb_it26(istrs01.rdbuf());
- test &= istrb_it25 != istrb_it26;
+ VERIFY( istrb_it25 != istrb_it26 );
// charT operator*() const
// istreambuf_iterator& operator++();
@@ -99,7 +97,7 @@ bool test01(void)
for (int i = 0; i < sizeof(slit01) - 2; ++i)
{
c = *istrb_it27++;
- test &= c == slit01[i];
+ VERIFY( c == slit01[i] );
}
std::istringstream istrs02(str01);
@@ -107,7 +105,7 @@ bool test01(void)
for (int i = 0; i < sizeof(slit01) - 3;)
{
c = *++istrb_it28;
- test &= c == slit01[++i];
+ VERIFY( c == slit01[++i] );
}
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/24_iterators/iterator.cc b/libstdc++-v3/testsuite/24_iterators/iterator.cc
index fe60704..4930f14 100644
--- a/libstdc++-v3/testsuite/24_iterators/iterator.cc
+++ b/libstdc++-v3/testsuite/24_iterators/iterator.cc
@@ -21,11 +21,10 @@
#include <string>
#include <vector>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
-int string_stuff()
+int
+string_stuff()
{
int failures(0);
@@ -250,7 +249,8 @@ int string_stuff()
return failures;
}
-int vector_stuff()
+int
+vector_stuff()
{
int failures(0);
@@ -487,7 +487,8 @@ int vector_stuff()
return failures;
}
-int reverse_stuff()
+int
+reverse_stuff()
{
int failures(0);
@@ -512,7 +513,8 @@ int reverse_stuff()
// the following should be compiler errors
// flag runtime errors in case they slip through the compiler
-int wrong_stuff()
+int
+wrong_stuff()
{
int failures(0);
@@ -575,7 +577,8 @@ int wrong_stuff()
return failures;
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
int failures(0);
@@ -594,6 +597,3 @@ int main(int argc, char **argv)
return failures ? 1 : 0;
}
-
-
-
diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound.cc
index bd88135..c6e12dc 100644
--- a/libstdc++-v3/testsuite/25_algorithms/lower_bound.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound.cc
@@ -17,9 +17,7 @@
// USA.
#include <algorithm>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
// http://sourceware.cygnus.com/ml/libstdc++/2000-06/msg00316.html
struct foo { };
diff --git a/libstdc++-v3/testsuite/25_algorithms/min_max.cc b/libstdc++-v3/testsuite/25_algorithms/min_max.cc
index a5219bf..04cd630 100644
--- a/libstdc++-v3/testsuite/25_algorithms/min_max.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/min_max.cc
@@ -19,22 +19,20 @@
// USA.
#include <algorithm>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
{
bool test = true;
const int& x = std::max(1, 2);
const int& y = std::max(3, 4);
- test &= x == 2;
- test &= y == 4;
+ VERIFY( x == 2 );
+ VERIFY( y == 4 );
const int& z = std::min(1, 2);
const int& w = std::min(3, 4);
- test &= z == 1;
- test &= w == 3;
+ VERIFY( z == 1 );
+ VERIFY( w == 3 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/26_numerics/c_math.cc b/libstdc++-v3/testsuite/26_numerics/c_math.cc
index 0ccdd3f..423adf1 100644
--- a/libstdc++-v3/testsuite/26_numerics/c_math.cc
+++ b/libstdc++-v3/testsuite/26_numerics/c_math.cc
@@ -20,38 +20,48 @@
// USA.
#include <cmath>
-#include <cassert>
+#include <debug_assert.h>
// test compilation.
-void test01()
+int
+test01()
{
- float a = 1.f;
- float b;
- std::modf(a, &b);
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+ return 0;
}
// need more extravagant checks than this, of course, but this used to core...
-void test02()
+int
+test02()
{
sin(static_cast<float>(0));
+ return 0;
}
// as did this.
-void test03()
+int
+test03()
{
double powtest = pow(2., 0);
+ return 0;
}
// this used to abort.
-void test04()
+int
+test04()
{
+ bool test = true;
float x[2] = {1, 2};
float y = 3.4;
std::modf(y, &x[0]);
- assert (x[1] == 2);
+ VERIFY(x[1] == 2);
+ return 0;
}
-int main()
+int
+main()
{
test01();
test02();
@@ -59,3 +69,4 @@ int main()
test04();
return 0;
}
+
diff --git a/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
index 7aff69a..7957591 100644
--- a/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
+++ b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc
@@ -24,9 +24,7 @@
#include <string>
#include <sstream>
#include <complex>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
#include <cmath>
template<typename R>
@@ -37,25 +35,28 @@ inline bool flteq(R x, R y)
}
template<typename R>
-void test_good(std::string str, R x, R y)
+int
+test_good(std::string str, R x, R y)
{
bool test = true;
std::complex<R> z;
char ch;
std::istringstream iss(str);
iss >> z >> ch;
- test &= iss.good();
- test &= flteq(z.real(), x);
- test &= flteq(z.imag(), y);
- test &= ch == '#';
+ VERIFY( iss.good() );
+ VERIFY( flteq(z.real(), x) );
+ VERIFY( flteq(z.imag(), y) );
+ VERIFY( ch == '#' );
#ifdef DEBUG_ASSERT
assert(test);
#endif
+ return 0;
}
template<typename R>
-void test_fail(std::string str)
+int
+test_fail(std::string str)
{
std::complex<R> z;
std::istringstream iss(str);
@@ -63,10 +64,12 @@ void test_fail(std::string str)
#ifdef DEBUG_ASSERT
assert(iss.fail() && !iss.bad());
#endif
+ return 0;
}
template<typename R>
-void testall()
+int
+testall()
{
test_good<R>("(-1.1,3.7)#", -1.1, 3.7);
test_good<R>("( .7e6 , \n-3.1)#", .7e6, -3.1);
@@ -82,9 +85,11 @@ void testall()
test_fail<R>("|1,1)");
test_fail<R>("(1|1)");
test_fail<R>("(1,1|");
+ return 0;
}
-int main()
+int
+main()
{
testall<float>();
testall<double>();
@@ -92,5 +97,3 @@ int main()
return 0;
}
-
-
diff --git a/libstdc++-v3/testsuite/27_io/filebuf.cc b/libstdc++-v3/testsuite/27_io/filebuf.cc
index 3e0450e..bba2fbd 100644
--- a/libstdc++-v3/testsuite/27_io/filebuf.cc
+++ b/libstdc++-v3/testsuite/27_io/filebuf.cc
@@ -23,9 +23,7 @@
// simulated a bit more readily.
#include <fstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
const char carray_01[] = "santa cruz or sandiego?";
const char carray_02[] = "memphis, new orleans, and savanah";
@@ -72,9 +70,9 @@ bool test02() {
bool test = true;
// bool is_open()
- test &= !fb_01.is_open();
- test &= !fb_02.is_open();
- test &= !fb_03.is_open();
+ VERIFY( !fb_01.is_open() );
+ VERIFY( !fb_02.is_open() );
+ VERIFY( !fb_03.is_open() );
// filebuf_type* open(const char* __s, ios_base::openmode __mode)
fb_01.open(name_01, std::ios_base::in | std::ios_base::ate);
@@ -83,17 +81,17 @@ bool test02() {
// Should keep the old file attached, and disregard attempt to overthrow.
fb_02.open(name_03, std::ios_base::in | std::ios_base::out);
fb_03.open(name_03, std::ios_base::out | std::ios_base::trunc);
- test &= fb_01.is_open();
- test &= fb_02.is_open();
- test &= fb_03.is_open();
+ VERIFY( fb_01.is_open() );
+ VERIFY( fb_02.is_open() );
+ VERIFY( fb_03.is_open() );
// filebuf_type* close()
fb_01.close();
fb_02.close();
fb_03.close();
- test &= !fb_01.is_open();
- test &= !fb_02.is_open();
- test &= !fb_03.is_open();
+ VERIFY( !fb_01.is_open() );
+ VERIFY( !fb_02.is_open() );
+ VERIFY( !fb_03.is_open() );
#ifdef DEBUG_ASSERT
assert(test);
@@ -131,35 +129,35 @@ bool test03() {
// else return showmanyc.
strmof_1 = fb_01.in_avail();
strmof_2 = fb_02.in_avail();
- test &= strmof_1 == -1;
- test &= strmof_1 == strmof_2; //fail because not open
+ VERIFY( strmof_1 == -1 );
+ VERIFY( strmof_1 == strmof_2 ); //fail because not open
strmof_1 = fb_03.in_avail();
- test &= strmof_1 == strmof_2;
+ VERIFY( strmof_1 == strmof_2 );
fb_01.open(name_01, std::ios_base::in);
fb_02.open(name_02, std::ios_base::out | std::ios_base::trunc);
fb_03.open(name_03, std::ios_base::out | std::ios_base::in | std::ios_base::trunc);
strmof_1 = fb_01.in_avail();
strmof_2 = fb_02.in_avail();
- test &= strmof_1 != strmof_2;
- test &= strmof_1 >= 0;
- test &= strmof_2 == -1; // empty file
+ VERIFY( strmof_1 != strmof_2 );
+ VERIFY( strmof_1 >= 0 );
+ VERIFY( strmof_2 == -1 ); // empty file
strmof_1 = fb_03.in_avail();
- test &= strmof_1 == -1; // empty file
+ VERIFY( strmof_1 == -1 ); // empty file
// int_type sbumpc()
// if read_cur not avail returns uflow(), else return *read_cur & increment
int_type c1 = fb_01.sbumpc();
int_type c2 = fb_02.sbumpc();
- test &= c1 != c2;
- test &= c1 == '/';
- test &= c2 == -1;
+ VERIFY( c1 != c2 );
+ VERIFY( c1 == '/' );
+ VERIFY( c2 == -1 );
int_type c3 = fb_01.sbumpc();
int_type c4 = fb_02.sbumpc();
- test &= c3 != c4;
- test &= c1 == c3; // fluke, both happen to be '/'
- test &= c2 == c4;
+ VERIFY( c3 != c4 );
+ VERIFY( c1 == c3 ); // fluke, both happen to be '/'
+ VERIFY( c2 == c4 );
int_type c5 = fb_03.sbumpc();
- test &= c5 == traits_type::eof();
+ VERIFY( c5 == traits_type::eof() );
// XXX should do some kind of test to make sure that internal
// buffers point ot the same thing, to check consistancy.
@@ -167,29 +165,29 @@ bool test03() {
// if read_cur not avail, return uflow(), else return *read_cur
int_type c6 = fb_01.sgetc();
int_type c7 = fb_02.sgetc();
- test &= c6 != c3;
- test &= c7 == c4; // both -1
+ VERIFY( c6 != c3 );
+ VERIFY( c7 == c4 ); // both -1
int_type c8 = fb_01.sgetc();
int_type c9 = fb_02.sgetc();
- test &= c6 == c8;
- test &= c7 == c9;
+ VERIFY( c6 == c8 );
+ VERIFY( c7 == c9 );
c5 = fb_03.sgetc();
- test &= c5 == traits_type::eof();
+ VERIFY( c5 == traits_type::eof() );
// int_type snextc()
// calls sbumpc and if sbumpc != eof, return sgetc
c6 = fb_01.snextc();
c7 = fb_02.snextc();
- test &= c6 != c8;
- test &= c7 == c9; // -1
- test &= c6 == '9';
+ VERIFY( c6 != c8 );
+ VERIFY( c7 == c9 ); // -1
+ VERIFY( c6 == '9' );
c6 = fb_01.snextc();
c7 = fb_02.snextc();
- test &= c6 != c8;
- test &= c7 == c9; // -1
- test &= c6 == '9';
+ VERIFY( c6 != c8 );
+ VERIFY( c7 == c9 ); // -1
+ VERIFY( c6 == '9' );
c5 = fb_03.snextc();
- test &= c5 == traits_type::eof();
+ VERIFY( c5 == traits_type::eof() );
// streamsize sgetn(char_type *s, streamsize n)
// streamsize xsgetn(char_type *s, streamsize n)
@@ -202,30 +200,30 @@ bool test03() {
strmsz_1 = fb_01.sgetn(carray1, 10);
char carray2[buffer_size] = "";
strmsz_2 = fb_02.sgetn(carray2, 10);
- test &= strmsz_1 != strmsz_2;
- test &= strmsz_1 == 10;
- test &= strmsz_2 == 0;
+ VERIFY( strmsz_1 != strmsz_2 );
+ VERIFY( strmsz_1 == 10 );
+ VERIFY( strmsz_2 == 0 );
c1 = fb_01.sgetc();
c2 = fb_02.sgetc();
- test &= c1 == '\n';
- test &= c7 == c2; // n != i
+ VERIFY( c1 == '\n' );
+ VERIFY( c7 == c2 ); // n != i
strmsz_1 = fb_03.sgetn(carray1, 10);
- test &= !strmsz_1; //zero
+ VERIFY( !strmsz_1 ); //zero
strmsz_1 = fb_01.in_avail();
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
- test &= strmsz_1 == strmsz_2 - 5;
+ VERIFY( strmsz_1 == strmsz_2 - 5 );
c4 = fb_01.sgetc(); // buffer should have underflowed from above.
- test &= c4 == 'i';
+ VERIFY( c4 == 'i' );
strmsz_1 = fb_01.in_avail();
- test &= strmsz_1 > 0;
+ VERIFY( strmsz_1 > 0 );
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
- test &= strmsz_1 == strmsz_2; //at the end of the actual file
+ VERIFY( strmsz_1 == strmsz_2 ); //at the end of the actual file
strmsz_1 = fb_02.in_avail();
strmsz_2 = fb_02.sgetn(carray2, strmsz_1 + 5);
- test &= strmsz_1 == -1;
- test &= strmsz_2 == 0;
+ VERIFY( strmsz_1 == -1 );
+ VERIFY( strmsz_2 == 0 );
c4 = fb_02.sgetc(); // should be EOF
- test &= c4 == traits_type::eof();
+ VERIFY( c4 == traits_type::eof() );
// PUT
// int_type sputc(char_type c)
@@ -235,12 +233,12 @@ bool test03() {
// strmsz_1 = fb_03.in_avail(); // XXX valid for in|out??
c1 = fb_02.sputc('a');
c2 = fb_03.sputc('b');
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
c1 = fb_02.sputc('c');
c2 = fb_03.sputc('d');
- test &= c1 != c2;
+ VERIFY( c1 != c2 );
// strmsz_2 = fb_03.in_avail();
- // test &= strmsz_1 != strmsz_2;
+ // VERIFY( strmsz_1 != strmsz_2 );
for (int i = 50; i <= 90; ++i)
c2 = fb_02.sputc(char(i));
// 27filebuf-2.txt == ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
@@ -249,30 +247,30 @@ bool test03() {
for (int i = 50; i <= 90; ++i)
c2 = fb_03.sputc(char(i));
strmsz_2 = fb_03.in_avail();
- // test &= strmsz_1 != strmsz_2;
- // test &= strmsz_1 > 0;
- // test &= strmsz_2 > 0;
+ // VERIFY( strmsz_1 != strmsz_2 );
+ // VERIFY( strmsz_1 > 0 );
+ // VERIFY( strmsz_2 > 0 );
// 27filebuf-2.txt == bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
// fb_02._M_out_cur = '2'
c3 = fb_01.sputc('a'); // should be EOF because this is read-only
- test &= c3 == traits_type::eof();
+ VERIFY( c3 == traits_type::eof() );
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
// NB *sputn will happily put '\0' into your stream if you give it a chance*
strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
- test &= strmsz_1 == 10;
+ VERIFY( strmsz_1 == 10 );
strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
- test &= strmsz_2 == 10;
- test &= strmsz_1 == strmsz_2;
+ VERIFY( strmsz_2 == 10 );
+ VERIFY( strmsz_1 == strmsz_2 );
// fb_03._M_out_beg = "YZracadabras, i wanna FGHIJKLMNOPQRSTUVW"
// fb_03._M_out_cur = "FGHIJKLMNOPQRSTUVW"
strmsz_1 = fb_02.sputn("racadabras", 10);
- test &= strmsz_1 == 10;
+ VERIFY( strmsz_1 == 10 );
// fb_02._M_out_beg = "YZracadabras<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
// fb_02._M_out_cur = "<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
strmsz_1 = fb_01.sputn("racadabra", 10);
- test &= strmsz_1 == 0;
+ VERIFY( strmsz_1 == 0 );
// PUTBACK
// int_type pbfail(int_type c)
@@ -293,9 +291,9 @@ bool test03() {
c2 = fb_03.sputbackc('z');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
- test &= c3 == c2;
- test &= c1 != c3;
- test &= 1 == strmsz_2;
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( 1 == strmsz_2 );
//test for _in_cur == _in_beg
// fb_03._M_out_beg = "bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracada" etc
fb_03.pubseekoff(10, std::ios_base::beg,
@@ -307,11 +305,11 @@ bool test03() {
c2 = fb_03.sputbackc('z');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
- test &= c1 != c2;
- test &= c3 == c2;
- test &= c1 != c3;
- test &= c2 == 'z';
- test &= strmsz_1 == strmsz_2;
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( c2 == 'z' );
+ VERIFY( strmsz_1 == strmsz_2 );
// test for replacing char with identical one
fb_03.snextc();
fb_03.sputc('u');
@@ -321,13 +319,13 @@ bool test03() {
c2 = fb_03.sputbackc('a');
strmsz_2 = fb_03.in_avail();
c3 = fb_03.sgetc();
- test &= c3 == c2;
- test &= strmsz_1 + 1 == strmsz_2;
+ VERIFY( c3 == c2 );
+ VERIFY( strmsz_1 + 1 == strmsz_2 );
//test for ios_base::out
c1 = fb_02.sgetc(); // undefined
c2 = fb_02.sputbackc('a');
- test &= c1 == c2;
- test &= c1 == -1;
+ VERIFY( c1 == c2 );
+ VERIFY( c1 == -1 );
// int_type sungetc()
// if in_cur not avail, return pbackfail(), else decrement and
@@ -337,8 +335,8 @@ bool test03() {
strmsz_1 = fb_03.in_avail();
c2 = fb_03.sungetc(); // delete the 'a'
strmsz_2 = fb_03.in_avail();
- test &= c2 == 'v'; // test &= c2 != traits_type::eof();
- test &= strmsz_1 + 1 == strmsz_2;
+ VERIFY( c2 == 'v' ); // VERIFY( c2 != traits_type::eof() );
+ VERIFY( strmsz_1 + 1 == strmsz_2 );
//test for _in_cur == _in_beg
for (int i = 50; i < 32 + 29; ++i)
fb_02.sputc(char(i));
@@ -348,11 +346,11 @@ bool test03() {
c2 = fb_02.sungetc();
strmsz_2 = fb_02.in_avail();
c3 = fb_02.sgetc();
- test &= c1 == c2;
- test &= c3 == c2;
- test &= c1 == c3;
- test &= c2 == traits_type::eof();
- test &= strmsz_1 == strmsz_2;
+ VERIFY( c1 == c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == traits_type::eof() );
+ VERIFY( strmsz_1 == strmsz_2 );
//test for _in_cur == _in_end
fb_03.pubseekoff(0, std::ios_base::end);
strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
@@ -360,10 +358,10 @@ bool test03() {
c2 = fb_03.sungetc();
strmsz_2 = fb_03.in_avail(); // 1
c3 = fb_03.sgetc();
- test &= c1 != c2;
- // test &= c2 == c3 || c2 == traits_type::not_eof(int(c3));
- test &= strmsz_2 != strmsz_1;
- test &= strmsz_2 == 1;
+ VERIFY( c1 != c2 );
+ // VERIFY( c2 == c3 || c2 == traits_type::not_eof(int(c3)) );
+ VERIFY( strmsz_2 != strmsz_1 );
+ VERIFY( strmsz_2 == 1 );
//test for ios_base::out
// BUFFER MANAGEMENT & POSITIONING
@@ -373,21 +371,21 @@ bool test03() {
strmsz_1 = fb_01.in_avail();
fb_01.pubsync();
strmsz_2 = fb_01.in_avail();
- test &= strmsz_2 == strmsz_1;
+ VERIFY( strmsz_2 == strmsz_1 );
strmsz_1 = fb_02.in_avail();
fb_02.pubsync();
// 27filebuf-2.txt == 53 bytes after this.
strmsz_2 = fb_02.in_avail();
- test &= strmsz_2 == -1;
- test &= strmsz_2 == strmsz_1;
+ VERIFY( strmsz_2 == -1 );
+ VERIFY( strmsz_2 == strmsz_1 );
strmsz_1 = fb_03.in_avail();
fb_03.pubsync();
// 27filebuf-3.txt
// bd23456789mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
// 63 bytes.
strmsz_2 = fb_03.in_avail();
- test &= strmsz_1 == 1;
- test &= strmsz_2 == 1;
+ VERIFY( strmsz_1 == 1 );
+ VERIFY( strmsz_2 == 1 );
// setbuf
// pubsetbuf(char_type* s, streamsize n)
@@ -412,42 +410,42 @@ bool test03() {
pt_1 = fb_03.pubseekoff(2, std::ios_base::beg);
strmsz_2 = fb_03.in_avail();
off_1 = pt_1;
- test &= off_1 > 0;
+ VERIFY( off_1 > 0 );
c1 = fb_03.snextc(); //current in pointer +1
- test &= c1 == '3';
+ VERIFY( c1 == '3' );
c2 = fb_03.sputc('\n'); //current in pointer +1
c3 = fb_03.sgetc();
- test &= c2 != c3;
- test &= c3 == '4';
+ VERIFY( c2 != c3 );
+ VERIFY( c3 == '4' );
fb_03.pubsync();
c1 = fb_03.sgetc();
- test &= c1 == c3;
+ VERIFY( c1 == c3 );
//cur
// 27filebuf-3.txt = bd2\n456789:;<=>?...
pt_2 = fb_03.pubseekoff(2, std::ios_base::cur);
off_2 = pt_2;
- test &= (off_2 == (off_1 + 2 + 1 + 1));
+ VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb_03.snextc(); //current in pointer +1
- test &= c1 == '7';
+ VERIFY( c1 == '7' );
c2 = fb_03.sputc('x'); //test current out pointer
c3 = fb_03.sputc('\n');
c1 = fb_03.sgetc();
fb_03.pubsync();
c3 = fb_03.sgetc();
- test &= c1 == c3;
+ VERIFY( c1 == c3 );
//end
// 27filebuf-3.txt = "bd2\n456x\n9"
pt_2 = fb_03.pubseekoff(0, std::ios_base::end,
std::ios_base::in|std::ios_base::out);
off_1 = pt_2;
- test &= off_1 > off_2; //weak, but don't know exactly where it ends
+ VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb_03.sputc('\n');
strmsz_1 = fb_03.sputn("because because because. . .", 28);
- test &= strmsz_1 == 28;
+ VERIFY( strmsz_1 == 28 );
c1 = fb_03.sungetc();
fb_03.pubsync();
c3 = fb_03.sgetc();
- test &= c1 == c3;
+ VERIFY( c1 == c3 );
// IN
// OUT
@@ -459,20 +457,20 @@ bool test03() {
//beg
pt_1 = fb_03.pubseekoff(78, std::ios_base::beg);
off_1 = pt_1;
- test &= off_1 > 0;
+ VERIFY( off_1 > 0 );
c1 = fb_03.snextc(); //current in pointer +1
- test &= c1 == ' ';
+ VERIFY( c1 == ' ' );
c2 = fb_03.sputc('\n'); //test current out pointer
c3 = fb_03.sgetc();
fb_03.pubsync(); //resets pointers
pt_2 = fb_03.pubseekpos(pt_1);
off_2 = pt_2;
- test &= off_1 == off_2;
+ VERIFY( off_1 == off_2 );
c3 = fb_03.snextc(); //current in pointer +1
- test &= c2 == c3;
+ VERIFY( c2 == c3 );
pt_1 = fb_03.pubseekoff(0, std::ios_base::end);
off_1 = pt_1;
- test &= off_1 > off_2;
+ VERIFY( off_1 > off_2 );
fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
fb_03.pubsync();
@@ -494,9 +492,9 @@ bool test03() {
fb_01.close();
fb_02.close();
fb_03.close();
- test &= !fb_01.is_open();
- test &= !fb_02.is_open();
- test &= !fb_03.is_open();
+ VERIFY( !fb_01.is_open() );
+ VERIFY( !fb_02.is_open() );
+ VERIFY( !fb_03.is_open() );
#ifdef DEBUG_ASSERT
assert(test);
@@ -514,8 +512,8 @@ bool test04()
ifstream ifs(name_02);
char buffer[] = "xxxxxxxxxx";
int_type len1 = ifs.rdbuf()->sgetn(buffer, sizeof(buffer));
- test &= len1 == sizeof(buffer);
- test &= buffer[0] == 'a';
+ VERIFY( len1 == sizeof(buffer) );
+ VERIFY( buffer[0] == 'a' );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/filebuf_members.cc b/libstdc++-v3/testsuite/27_io/filebuf_members.cc
index 5933bfd..beaf6da 100644
--- a/libstdc++-v3/testsuite/27_io/filebuf_members.cc
+++ b/libstdc++-v3/testsuite/27_io/filebuf_members.cc
@@ -25,7 +25,7 @@
#include <cassert>
#include <unistd.h>
#include <fcntl.h>
-
+#include <debug_assert.h>
// verify that std::filebuf doesn't close files that it didn't open
// when using the following std::filebuf ctor:
@@ -48,29 +48,29 @@ test_01()
// read (ext)
int fd = open(name_01, O_RDONLY);
- test &= fd >= 0;
+ VERIFY( fd >= 0 );
{
std::filebuf fb(fd, "double_read", std::ios_base::in);
}
close_num = close(fd);
- test &= close_num == 0;
+ VERIFY( close_num == 0 );
// read (standard)
FILE* f = fopen(name_01, "r");
- test &= f != NULL;
+ VERIFY( f != NULL );
{
std::ifstream ifstream1(name_01);
- test &= ifstream1.is_open();
+ VERIFY( ifstream1.is_open() );
std::ios_base::iostate st01 = ifstream1.rdstate();
- test &= st01 == std::ios_base::goodbit;
+ VERIFY( st01 == std::ios_base::goodbit );
}
close_num = fclose(f);
- test &= close_num == 0;
+ VERIFY( close_num == 0 );
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/27_io/fpos.cc b/libstdc++-v3/testsuite/27_io/fpos.cc
index 2e8c275..54c1524 100644
--- a/libstdc++-v3/testsuite/27_io/fpos.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos.cc
@@ -30,9 +30,7 @@
// 27.4.3 template class fpos
#include <ios>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
{
@@ -61,7 +59,7 @@ void test01()
// operators, increment and deincrement operators need to be in place.
pos01.state(state02);
state01 = pos01.state();
- test &= state01 == state02;
+ VERIFY( state01 == state02 );
#endif
#ifdef DEBUG_ASSERT
@@ -87,43 +85,43 @@ void test02()
// p(i), p = i
std::streampos pos01(i02);
std::streampos pos02 = i02;
- test &= pos01 == pos02;
+ VERIFY( pos01 == pos02 );
// p(o), p = o
// NB: P(o) is only required.
std::streampos pos03(off02);
std::streampos pos04 = off02;
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
// O(p)
std::streamoff off03(pos04);
- test &= off03 == off02;
+ VERIFY( off03 == off02 );
// p == q, p!= q
- test &= pos01 == pos02;
- test &= pos02 != pos03;
+ VERIFY( pos01 == pos02 );
+ VERIFY( pos02 != pos03 );
// q = p + o
// p += o
pos03 = pos03 + off02;
pos04 += off02;
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
// q = p - o
// p -= o
pos03 = pos03 - off02;
pos04 -= off02;
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
// o = p - q
- test &= 0 == pos03 - pos04;
+ VERIFY( 0 == pos03 - pos04 );
// streamsize -> streamoff
// streamoff -> streamsize
off01 = off02;
std::streamsize size01(off02);
std::streamoff off04(size01);
- test &= off01 == off04;
+ VERIFY( off01 == off04 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -152,14 +150,14 @@ void test03()
// equality/inequality with const args
const std::streampos pos02(54);
std::streampos pos03(44);
- test &= !(pos03 == pos02);
- test &= pos03 != pos02;
- test &= !(pos02 == pos03);
- test &= pos02 != pos03;
+ VERIFY( !(pos03 == pos02) );
+ VERIFY( pos03 != pos02 );
+ VERIFY( !(pos02 == pos03) );
+ VERIFY( pos02 != pos03 );
// default values
std::streampos pos04;
- test &= (std::streamoff)pos04 == 0;
+ VERIFY( (std::streamoff)pos04 == 0 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ifstream_members.cc b/libstdc++-v3/testsuite/27_io/ifstream_members.cc
index 79e683a..b9d788c 100644
--- a/libstdc++-v3/testsuite/27_io/ifstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/ifstream_members.cc
@@ -20,9 +20,7 @@
#include <istream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
const char name_01[] = "testsuite/ifstream_members-1.tst";
const char name_02[] = "testsuite/ifstream_members-1.txt";
@@ -35,15 +33,15 @@ bool test00()
ifs1.close();
// false as expected:
- test &= !ifs1.is_open();
+ VERIFY( !ifs1.is_open() );
// this is now true:
- test &= !(ifs1);
+ VERIFY( !(ifs1) );
ifs1.open(name_01);
- test &= ifs1.is_open();
+ VERIFY( ifs1.is_open() );
// fail bit still true
- test &= !(ifs1);
- test &= ifs1.rdstate() == std::ios_base::failbit;
+ VERIFY( !(ifs1) );
+ VERIFY( ifs1.rdstate() == std::ios_base::failbit );
ifs1.close();
@@ -63,7 +61,7 @@ bool test01()
for(int i = 0; ++i < more_than_max_open_files;)
{
std::ifstream ifs(name_01);
- test &= static_cast<bool>(ifs);
+ VERIFY( static_cast<bool>(ifs) );
}
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc b/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
index 5f7aeab..2985749 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base_callbacks.cc
@@ -22,9 +22,7 @@
#include <string>
#include <sstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
const std::string str01("the nubians of plutonia");
std::string str02;
@@ -52,7 +50,7 @@ bool test01()
ios01.register_callback(callb02, 1);
ios01.register_callback(callb01, 1);
ios01.imbue(locco);
- test &= str01 == str02;
+ VERIFY( str01 == str02 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc b/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
index f01372c..e3cb4bb 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base_members_static.cc
@@ -24,9 +24,7 @@
#include <sstream>
#include <iostream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01()
{
@@ -36,15 +34,15 @@ bool test01()
std::ios ios01(&strbuf01);
// 1: basic invocation
- test &= ios01.sync_with_stdio();
- test &= ios01.sync_with_stdio(false); //returns previous state
+ VERIFY( ios01.sync_with_stdio() );
+ VERIFY( ios01.sync_with_stdio(false) ); //returns previous state
// 2: need to test interleaving of C and C++ io on a file object.
- test &= std::cout.good();
- test &= !std::cout.sync_with_stdio(0);
- test &= std::cout.good();
- test &= !std::cout.sync_with_stdio(0);
- test &= std::cout.good();
+ VERIFY( std::cout.good() );
+ VERIFY( !std::cout.sync_with_stdio(0) );
+ VERIFY( std::cout.good() );
+ VERIFY( !std::cout.sync_with_stdio(0) );
+ VERIFY( std::cout.good() );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ios_ctor.cc b/libstdc++-v3/testsuite/27_io/ios_ctor.cc
index eeaa6c9..acebb87 100644
--- a/libstdc++-v3/testsuite/27_io/ios_ctor.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_ctor.cc
@@ -31,9 +31,7 @@
#include <ios>
#include <sstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
{
@@ -60,27 +58,27 @@ void test01()
// void init(sreambuf* sb)
// NB: This is protected so need to go through fstream/stringstream
// Can double-check the accuracy of the above initializations though.
- test &= ios_00.rdbuf() == 0;
- test &= ios_00.tie() == 0;
- test &= ios_00.rdstate() == std::ios_base::badbit;
- test &= ios_00.exceptions() == std::ios_base::goodbit;
+ VERIFY( ios_00.rdbuf() == 0 );
+ VERIFY( ios_00.tie() == 0 );
+ VERIFY( ios_00.rdstate() == std::ios_base::badbit );
+ VERIFY( ios_00.exceptions() == std::ios_base::goodbit );
flag02 = ios_00.flags();
- test &= flag02 == flag01;
- test &= ios_00.width() == 0;
- test &= ios_00.precision() == 6;
- test &= ios_00.fill() == ios_00.widen(' ');
- test &= ios_00.getloc() == glocale;
+ VERIFY( flag02 == flag01 );
+ VERIFY( ios_00.width() == 0 );
+ VERIFY( ios_00.precision() == 6 );
+ VERIFY( ios_00.fill() == ios_00.widen(' ') );
+ VERIFY( ios_00.getloc() == glocale );
- test &= ios_01.rdbuf() == &strb_01;
- test &= ios_01.tie() == 0;
- test &= ios_01.rdstate() == std::ios_base::goodbit;
- test &= ios_01.exceptions() == std::ios_base::goodbit;
+ VERIFY( ios_01.rdbuf() == &strb_01 );
+ VERIFY( ios_01.tie() == 0 );
+ VERIFY( ios_01.rdstate() == std::ios_base::goodbit );
+ VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
flag02 = ios_01.flags();
- test &= flag02 == flag01;
- test &= ios_01.width() == 0;
- test &= ios_01.precision() == 6;
- test &= ios_01.fill() == ios_01.widen(' ');
- test &= ios_01.getloc() == glocale;
+ VERIFY( flag02 == flag01 );
+ VERIFY( ios_01.width() == 0 );
+ VERIFY( ios_01.precision() == 6 );
+ VERIFY( ios_01.fill() == ios_01.widen(' ') );
+ VERIFY( ios_01.getloc() == glocale );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc b/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
index ebe1472..717bebb 100644
--- a/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
@@ -31,9 +31,7 @@
#include <sstream>
#include <locale>
#include <iomanip>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
struct MyNP : std::numpunct<char>
{
@@ -44,7 +42,8 @@ struct MyNP : std::numpunct<char>
std::string MyNP::do_grouping() const { static std::string s("\3"); return s; }
char MyNP::do_thousands_sep() const { return ' '; }
-void test01()
+int
+test01()
{
std::cout.imbue(std::locale(std::locale(), new MyNP));
std::cout << std::oct << std::showbase;
@@ -71,9 +70,11 @@ void test01()
#ifdef DEBUG_ASSERT
assert (std::cout.good());
#endif
+ return 0;
}
-void test02()
+int
+test02()
{
bool test = true;
const std::string str_blank;
@@ -82,23 +83,25 @@ void test02()
std::ostream o(&strbuf);
o << std::setw(6) << std::right << "san";
- test &= strbuf.str() == " san";
+ VERIFY( strbuf.str() == " san" );
strbuf.str(str_blank);
o << std::setw(6) << std::internal << "fran";
- test &= strbuf.str() == " fran";
+ VERIFY( strbuf.str() == " fran" );
strbuf.str(str_blank);
o << std::setw(6) << std::left << "cisco";
- test &= strbuf.str() == "cisco ";
+ VERIFY( strbuf.str() == "cisco " );
strbuf.str(str_blank);
#ifdef DEBUG_ASSERT
assert (test);
#endif
+ return 0;
}
-int main() {
+int
+main() {
test01();
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc b/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
index d0030ff..4dcf748 100644
--- a/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
@@ -31,9 +31,7 @@
#include <sstream>
#include <locale>
#include <iomanip>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
struct MyNP : std::numpunct<char>
{
@@ -44,7 +42,8 @@ struct MyNP : std::numpunct<char>
std::string MyNP::do_truename() const { static std::string s("yea"); return s; }
std::string MyNP::do_falsename() const { static std::string s("nay"); return s; }
-void test01()
+int
+test01()
{
std::cout << true << " " << false << std::endl;
std::cout << std::boolalpha;
@@ -71,9 +70,11 @@ void test01()
#ifdef DEBUG_ASSERT
assert (std::cout.good());
#endif
+ return 0;
}
-void test02()
+int
+test02()
{
bool test = true;
const std::string strue("true");
@@ -88,19 +89,21 @@ void test02()
ostr01 << true;
str02 = ostr01.str();
- test &= str02 == strue;
+ VERIFY( str02 == strue );
ostr01.str(str01);
ostr01 << false;
str02 = ostr01.str();
- test &= str02 == sfalse;
+ VERIFY( str02 == sfalse );
#ifdef DEBUG_ASSERT
assert(test);
#endif
+ return 0;
}
-int main() {
+int
+main() {
test01();
test02();
return 0;
diff --git a/libstdc++-v3/testsuite/27_io/ios_members.cc b/libstdc++-v3/testsuite/27_io/ios_members.cc
index 0f36967..b096d42 100644
--- a/libstdc++-v3/testsuite/27_io/ios_members.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_members.cc
@@ -31,9 +31,7 @@
#include <ios>
// NB: Don't include any other headers in this file.
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
{
@@ -54,11 +52,11 @@ void test01()
// char narrow(char_type c, char dfault) const;
char c1 = ios_01.narrow(ct02, 0);
- test &= c1 == 'x';
+ VERIFY( c1 == 'x' );
// char_type widen(char c) const;
ct01 = ios_01.widen('c');
- test &= ct01 == 'c';
+ VERIFY( ct01 == 'c' );
#ifdef DEBUG_ASSERT
assert(test);
@@ -85,57 +83,57 @@ void test02()
std::ios::char_type ct02('x');;
// bool fail() const
- test &= ios_01.fail();
+ VERIFY( ios_01.fail() );
// bool operator!() const
- test &= !ios_01;
+ VERIFY( !ios_01 );
// iostate rdstate() const
iostate03 = ios_01.rdstate();
- test &= static_cast<bool>(iostate03 & std::ios_base::badbit);
+ VERIFY( static_cast<bool>(iostate03 & std::ios_base::badbit) );
// void clear(iostate state = goodbit)
try {
ios_01.clear(std::ios_base::eofbit);
iostate02 = ios_01.rdstate();
- test &= static_cast<bool>(iostate02 & iostate01);
+ VERIFY( static_cast<bool>(iostate02 & iostate01) );
}
catch(std::ios_base::failure& fail) {
- test &= false;
+ VERIFY( false );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// iostate exceptions() const
- test &= ios_01.exceptions() == std::ios_base::goodbit;
+ VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
// void exceptions(iostate except)
try {
ios_01.exceptions(std::ios_base::eofbit);
- test &= false;
+ VERIFY( false );
}
catch(std::ios_base::failure& fail) {
iostate02 = ios_01.exceptions();
- test &= static_cast<bool>(iostate02 & std::ios_base::eofbit);
+ VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
// basic_ios& copyfmt(const basic_ios& rhs)
std::ios ios_02(NULL);
ios_02.exceptions(std::ios_base::eofbit);
- test &= static_cast<bool>(ios_02.exceptions() & std::ios_base::eofbit);
+ VERIFY( static_cast<bool>(ios_02.exceptions() & std::ios_base::eofbit) );
try {
ios_01.copyfmt(ios_02);
- test &= false;
+ VERIFY( false );
}
catch(std::ios_base::failure& fail) {
- test &= true;
+ VERIFY( true );
}
catch(...) {
- test &= false;
+ VERIFY( false );
}
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
index 199d585..d2e55a9 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc
@@ -24,9 +24,7 @@
#include <ostream>
#include <sstream>
#include <locale>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
std::string str_01;
std::string str_02("true false 0 1 110001");
@@ -71,44 +69,44 @@ bool test01() {
fmt = is_02.flags();
testfmt = fmt & std::ios_base::boolalpha;
is_02 >> b1;
- test &= b1 == 1;
+ VERIFY( b1 == 1 );
is_02 >> b1;
- test &= b1 == 0;
+ VERIFY( b1 == 0 );
// process numeric versions of of bool values
is_02.unsetf(std::ios_base::boolalpha);
fmt = is_02.flags();
testfmt = fmt & std::ios_base::boolalpha;
is_02 >> b1;
- test &= b1 == 0;
+ VERIFY( b1 == 0 );
is_02 >> b1;
- test &= b1 == 1;
+ VERIFY( b1 == 1 );
// is_03 == "-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"
is_03 >> l1;
- test &= l1 == -19999999;
+ VERIFY( l1 == -19999999 );
is_03 >> ul1;
- test &= ul1 == 777777;
+ VERIFY( ul1 == 777777 );
is_03 >> i1;
- test &= i1 == -234234;
+ VERIFY( i1 == -234234 );
is_03 >> ui1;
- test &= ui1 == 233;
+ VERIFY( ui1 == 233 );
is_03 >> s1;
- test &= s1 == -234;
+ VERIFY( s1 == -234 );
is_03 >> us1;
- test &= us1 == 33;
+ VERIFY( us1 == 33 );
is_03 >> b1;
- test &= b1 == 1;
+ VERIFY( b1 == 1 );
is_03 >> ld1;
- test &= ld1 == 66300.25;
+ VERIFY( ld1 == 66300.25 );
is_03 >> d1;
- test &= d1 == .315;
+ VERIFY( d1 == .315 );
is_03 >> f1;
- test &= f1 == 1.5;
+ VERIFY( f1 == 1.5 );
is_04 >> std::hex >> i1;
printf ("%d %d %d\n", i1, i1 == 0x123, test);
- test &= i1 == 0x123;
+ VERIFY( i1 == 0x123 );
printf ("%d %d %d\n", i1, i1 == 0x123, test);
// test void pointers
@@ -119,7 +117,7 @@ bool test01() {
ss_01 << po;
ss_01 >> pi;
printf ("%x %x\n", pi, po);
- test &= po == pi;
+ VERIFY( po == pi );
#ifdef DEBUG_ASSERT
assert(test);
@@ -138,9 +136,9 @@ bool test02() {
int n = 15;
is >> n;
- test &= n == 20000;
+ VERIFY( n == 20000 );
char c = is.peek();
- test &= c == 65;
+ VERIFY( c == 65 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -159,8 +157,8 @@ bool test03()
long l01;
ostr << "12220101";
istr >> l01; // _M_in_end set completely incorrectly here.
- test &= l01 == 12220101;
- test &= istr.rdstate() == std::ios_base::eofbit;
+ VERIFY( l01 == 12220101 );
+ VERIFY( istr.rdstate() == std::ios_base::eofbit );
#ifdef DEBUG_ASSERT
assert(test);
@@ -181,21 +179,21 @@ void test06()
std::istringstream is(s);
is >> h4; // 205
- test &= h4 == 205;
+ VERIFY( h4 == 205 );
is >> c; // ','
- test &= c == ',';
+ VERIFY( c == ',' );
is >> h4; // 199
- test &= h4 == 199;
+ VERIFY( h4 == 199 );
is >> c; // ','
- test &= c == ',';
+ VERIFY( c == ',' );
is >> h4; // 144
- test &= is.rdstate() == std::ios_base::eofbit;
- test &= h4 == 144;
+ VERIFY( is.rdstate() == std::ios_base::eofbit );
+ VERIFY( h4 == 144 );
is >> c; // EOF
- test &= c == ',';
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ VERIFY( c == ',' );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
#ifdef DEBUG_ASSERT
assert(test);
@@ -224,24 +222,24 @@ void test07()
// Basic operation.
is >> h4;
- test &= h4 == 205199;
- test &= is.good();
+ VERIFY( h4 == 205199 );
+ VERIFY( is.good() );
is.clear();
is >> f1;
- test &= f1 == 23445.25;
- test &= is.good();
+ VERIFY( f1 == 23445.25 );
+ VERIFY( is.good() );
is.clear();
is >> h3;
- test &= h3 == 1024365;
- test &= is.good();
+ VERIFY( h3 == 1024365 );
+ VERIFY( is.good() );
is.clear();
is >> h2;
- test &= h2 == 0;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
- test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+ VERIFY( h2 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) );
// Stress tests for explicit errors in grouping corner cases. The
// validity of these tests and results have been hammered out in
@@ -256,64 +254,64 @@ void test07()
is.str(s2);
is >> h4;
- test &= h4 == 0;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ VERIFY( h4 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
is.clear();
is >> c;
- test &= c == ',';
- test &= is.good();
+ VERIFY( c == ',' );
+ VERIFY( is.good() );
is.ignore(3);
is >> f1;
- test &= f1 == 0.0;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ VERIFY( f1 == 0.0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
is.clear();
is >> c;
- test &= c == ',';
+ VERIFY( c == ',' );
is >> c;
- test &= c == '4';
- test &= is.good();
+ VERIFY( c == '4' );
+ VERIFY( is.good() );
is >> f1;
- test &= f1 == 0.25;
- test &= is.good();
+ VERIFY( f1 == 0.25 );
+ VERIFY( is.good() );
is >> c;
- test &= c == ',';
+ VERIFY( c == ',' );
is >> h2;
- test &= h2 == 345;
- test &= is.good();
+ VERIFY( h2 == 345 );
+ VERIFY( is.good() );
f1 = 0.0;
h2 = 0;
is >> f1;
- test &= f1 == 5.0;
- test &= is.good();
+ VERIFY( f1 == 5.0 );
+ VERIFY( is.good() );
is >> f1;
- test &= f1 == .25;
- test &= is.good();
+ VERIFY( f1 == .25 );
+ VERIFY( is.good() );
is >> h3;
- test &= h3 == 0;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ VERIFY( h3 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
is.clear();
is >> c;
- test &= c == ','; // second one
- test &= is.good();
+ VERIFY( c == ',' ); // second one
+ VERIFY( is.good() );
is >> h2;
- test &= h2 == 0;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
+ VERIFY( h2 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
is.clear();
is >> h2;
- test &= h2 == 1000000;
- test &= is.good();
+ VERIFY( h2 == 1000000 );
+ VERIFY( is.good() );
h2 = 0;
is >> h2;
- test &= h2 == 0;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::failbit);
- test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+ VERIFY( h2 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) );
is.clear();
#ifdef DEBUG_ASSERT
@@ -345,18 +343,18 @@ void test08()
// Basic operation.
is >> h4;
- test &= h4 == 122;
- test &= is.good();
+ VERIFY( h4 == 122 );
+ VERIFY( is.good() );
is.clear();
is >> h3;
- test &= h3 == 20519;
- test &= is.good();
+ VERIFY( h3 == 20519 );
+ VERIFY( is.good() );
is.clear();
is >> h2;
- test &= h2 == 2212322;
- test &= static_cast<bool>(is.rdstate() & std::ios_base::eofbit);
+ VERIFY( h2 == 2212322 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) );
#ifdef DEBUG_ASSERT
@@ -378,8 +376,8 @@ bool test09()
(is>>std::ws) >> c;
(is>>std::ws) >> f2;
test = f1 == 2456;
- test &= f2 == 0.00567;
- test &= c == '-';
+ VERIFY( f2 == 0.00567 );
+ VERIFY( c == '-' );
#ifdef DEBUG_ASSERT
assert(test);
#endif
@@ -396,37 +394,37 @@ bool test10() {
int n = 365;
is_01 >> n;
- test &= n == 0;
+ VERIFY( n == 0 );
n = 364;
is_01 >> n;
- test &= n == 0;
+ VERIFY( n == 0 );
n = 363;
is_01 >> n;
- test &= n == 0;
+ VERIFY( n == 0 );
n = 362;
is_01 >> n;
- test &= n == 0;
+ VERIFY( n == 0 );
n = 361;
is_01 >> n;
- test &= n == 0;
+ VERIFY( n == 0 );
n = 360;
is_01 >> n;
- test &= n == 0;
- test &= is_01.rdstate() == std::ios_base::eofbit;
+ VERIFY( n == 0 );
+ VERIFY( is_01.rdstate() == std::ios_base::eofbit );
std::string str_02("0x32 0X33 033 33");
std::stringbuf isbuf_02(str_02);
std::istream is_02(&isbuf_02);
is_02.unsetf(std::ios_base::basefield);
is_02 >> n;
- test &= n == 50;
+ VERIFY( n == 50 );
is_02 >> n;
- test &= n == 51;
+ VERIFY( n == 51 );
is_02 >> n;
- test &= n == 27;
+ VERIFY( n == 27 );
is_02 >> n;
- test &= n == 33;
- test &= is_02.rdstate() == std::ios_base::eofbit;
+ VERIFY( n == 33 );
+ VERIFY( is_02.rdstate() == std::ios_base::eofbit );
std::stringbuf isbuf_03(str_02);
std::istream is_03(&isbuf_03);
@@ -434,19 +432,19 @@ bool test10() {
int m;
is_03 >> std::dec >> n >> c >> m;
- test &= n == 0;
- test &= c == 'x';
- test &= m == 32;
+ VERIFY( n == 0 );
+ VERIFY( c == 'x' );
+ VERIFY( m == 32 );
is_03 >> std::oct >> m >> c >> n;
- test &= m == 0;
- test &= c == 'X';
- test &= n == 27;
+ VERIFY( m == 0 );
+ VERIFY( c == 'X' );
+ VERIFY( n == 27 );
is_03 >> std::dec >> m >> n;
- test &= m == 33;
- test &= n == 33;
- test &= is_03.rdstate() == std::ios_base::eofbit;
+ VERIFY( m == 33 );
+ VERIFY( n == 33 );
+ VERIFY( is_03.rdstate() == std::ios_base::eofbit );
std::string str_04("3. 4.5E+ 2a5E-3 .6E1");
std::stringbuf isbuf_04(str_04);
@@ -454,35 +452,35 @@ bool test10() {
double f;
is_04 >> f;
- test &= f == 3.0;
+ VERIFY( f == 3.0 );
is_04 >> f;
- test &= f == 450.0;
+ VERIFY( f == 450.0 );
is_04.ignore();
is_04 >> f;
- test &= f == 0.005;
+ VERIFY( f == 0.005 );
is_04 >> f;
- test &= f == 6;
- test &= is_03.rdstate() == std::ios_base::eofbit;
+ VERIFY( f == 6 );
+ VERIFY( is_03.rdstate() == std::ios_base::eofbit );
std::string str_05("0E20 5Ea E16");
std::stringbuf isbuf_05(str_05);
std::istream is_05(&isbuf_05);
is_05 >> f;
- test &= f == 0;
+ VERIFY( f == 0 );
is_05 >> f;
- test &= f == 0;
- test &= is_05.rdstate() == std::ios_base::failbit;
+ VERIFY( f == 0 );
+ VERIFY( is_05.rdstate() == std::ios_base::failbit );
is_05.clear();
is_05 >> c;
- test &= c == 'a';
+ VERIFY( c == 'a' );
is_05 >> f;
- test &= f == 0;
- test &= is_05.rdstate() == std::ios_base::failbit;
+ VERIFY( f == 0 );
+ VERIFY( is_05.rdstate() == std::ios_base::failbit );
is_05.clear();
is_05.ignore();
is_05 >> n;
- test &= n == 16;
+ VERIFY( n == 16 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
index 6a63128..f70d4fb 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_char.cc
@@ -22,9 +22,7 @@
#include <istream>
#include <sstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01() {
@@ -53,28 +51,28 @@ bool test01() {
is_01 >> array1; // should snake 0 characters, not alter stream state
i2 = ctraits_type::length(array1);
state2 = is_01.rdstate();
- test &= i1 == i2;
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
+ VERIFY( i1 == i2 );
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
state1 = is_02.rdstate();
is_02 >> array1; // should snake "coltrane"
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= !static_cast<bool>(state2 & statefail);
- test &= array1[str_03.size() - 1] == 'e';
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+ VERIFY( array1[str_03.size() - 1] == 'e' );
array1[str_03.size()] = '\0';
- test &= !str_03.compare(0, str_03.size(), array1);
+ VERIFY( !str_03.compare(0, str_03.size(), array1) );
std::istream::int_type int1 = is_02.peek(); // should be ' '
- test &= int1 == ' ';
+ VERIFY( int1 == ' ' );
state1 = is_02.rdstate();
is_02 >> array1; // should snake "playing" as sentry "eats" ws
state2 = is_02.rdstate();
int1 = is_02.peek(); // should be ' '
- test &= int1 == ' ';
- test &= state1 == state2;
- test &= !static_cast<bool>(state2 & statefail);
+ VERIFY( int1 == ' ' );
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
// template<_CharT, _Traits>
@@ -83,13 +81,13 @@ bool test01() {
state1 = is_02.rdstate();
is_02 >> array2; // should snake 'softly
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= !static_cast<bool>(state2 & statefail);
- test &= array2[0] == '\'';
- test &= array2[1] == 's';
- test &= array2[6] == 'y';
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+ VERIFY( array2[0] == '\'' );
+ VERIFY( array2[1] == 's' );
+ VERIFY( array2[6] == 'y' );
int1 = is_02.peek(); // should be ' '
- test &= int1 == ' ';
+ VERIFY( int1 == ' ' );
// template<_CharT, _Traits>
@@ -98,12 +96,12 @@ bool test01() {
state1 = is_02.rdstate();
is_02 >> array3; // should snake "as"
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= !static_cast<bool>(state2 & statefail);
- test &= array3[0] == 'a';
- test &= array3[1] == 's';
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+ VERIFY( array3[0] == 'a' );
+ VERIFY( array3[1] == 's' );
int1 = is_02.peek(); // should be ' '
- test &= int1 == ' ';
+ VERIFY( int1 == ' ' );
// testing with width() control enabled.
@@ -111,25 +109,25 @@ bool test01() {
state1 = is_02.rdstate();
is_02 >> array1; // should snake a
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= !ctraits_type::compare(array1, "a", 2);
+ VERIFY( state1 == state2 );
+ VERIFY( !ctraits_type::compare(array1, "a", 2) );
is_02.width(1);
state1 = is_02.rdstate();
is_02 >> array1; // should snake nothing, set failbit
state2 = is_02.rdstate();
- test &= state1 != state2;
- test &= state2 == statefail;
- test &= array1[0] == '\0';
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == statefail );
+ VERIFY( array1[0] == '\0' );
is_02.width(8);
is_02.clear();
state1 = is_02.rdstate();
- test &= !state1;
+ VERIFY( !state1 );
is_02 >> array1; // should snake "morning"
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= !ctraits_type::compare(array1, "morning", 8);
+ VERIFY( state1 == state2 );
+ VERIFY( !ctraits_type::compare(array1, "morning", 8) );
// testing for correct exception setting
const std::string str_04(" impulse!!");
@@ -139,13 +137,13 @@ bool test01() {
std::istream is_04(&isbuf_04);
is_03 >> array1;
- test &= !ctraits_type::compare(array1,"impulse!!", 10);
- test &= is_03.rdstate() == std::ios_base::eofbit;
+ VERIFY( !ctraits_type::compare(array1,"impulse!!", 10) );
+ VERIFY( is_03.rdstate() == std::ios_base::eofbit );
is_04.width(9);
is_04 >> array1;
- test &= ! std::ios::traits_type::compare(array1,"impulse!", 9);
- test &= !is_04.rdstate();
+ VERIFY( ! std::ios::traits_type::compare(array1,"impulse!", 9) );
+ VERIFY( !is_04.rdstate() );
#ifdef DEBUG_ASSERT
assert(test);
@@ -176,19 +174,19 @@ bool test02() {
state1 = is_01.rdstate();
is_01 >> c1;
state2 = is_01.rdstate();
- test &= state1 != state2;
- test &= c1 == c2;
- test &= static_cast<bool>(state2 & statefail);
+ VERIFY( state1 != state2 );
+ VERIFY( c1 == c2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
state1 = is_02.rdstate();
is_02 >> c1;
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= c1 == 'o';
+ VERIFY( state1 == state2 );
+ VERIFY( c1 == 'o' );
is_02 >> c1;
is_02 >> c1;
- test &= c1 == 'c';
- test &= !static_cast<bool>(state2 & statefail);
+ VERIFY( c1 == 'c' );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, unsigned char&)
@@ -196,11 +194,11 @@ bool test02() {
state1 = is_02.rdstate();
is_02 >> uc1;
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= uc1 == 'o';
+ VERIFY( state1 == state2 );
+ VERIFY( uc1 == 'o' );
is_02 >> uc1;
is_02 >> uc1;
- test &= uc1 == 't';
+ VERIFY( uc1 == 't' );
// template<_CharT, _Traits>
// basic_istream& operator>>(istream&, signed char&)
@@ -208,11 +206,11 @@ bool test02() {
state1 = is_02.rdstate();
is_02 >> sc1;
state2 = is_02.rdstate();
- test &= state1 == state2;
- test &= sc1 == 'r';
+ VERIFY( state1 == state2 );
+ VERIFY( sc1 == 'r' );
is_02 >> sc1;
is_02 >> sc1;
- test &= sc1 == 'n';
+ VERIFY( sc1 == 'n' );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
index 09b1ac2..72633af 100644
--- a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
@@ -23,9 +23,7 @@
#include <istream>
#include <sstream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
// stringbufs.
@@ -71,78 +69,78 @@ bool test01() {
state1 = is_00.rdstate();
is_00 >> &isbuf_00;
state2 = is_00.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_00.str() == str_01;
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_00.str() == str_01 );
// null istream to empty in_out_buf
is_00.clear(std::ios_base::goodbit);
state1 = is_00.rdstate();
is_00 >> &isbuf_01;
state2 = is_00.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_01.str() == str_01;
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_01.str() == str_01 );
// null istream to full in_buf
is_00.clear(std::ios_base::goodbit);
state1 = is_00.rdstate();
is_00 >> &isbuf_04;
state2 = is_00.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_04.str() == str_02;
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_04.str() == str_02 );
// null istream to full in_out_buf
is_00.clear(std::ios_base::goodbit);
state1 = is_00.rdstate();
is_00 >> &isbuf_05;
state2 = is_00.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_05.str() == str_02;
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_05.str() == str_02 );
// empty but non-null istream to full in_buf
state1 = is_02.rdstate();
is_02 >> &isbuf_04;
state2 = is_02.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_04.str() == str_02; // as only an "in" buffer
- test &= isbuf_04.sgetc() == 'a';
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_04.str() == str_02 ); // as only an "in" buffer
+ VERIFY( isbuf_04.sgetc() == 'a' );
// empty but non-null istream to full in_out_buf
is_02.clear(std::ios_base::goodbit);
state1 = is_02.rdstate();
is_02 >> &isbuf_05;
state2 = is_02.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_05.str() == str_02; // as only an "in" buffer
- test &= isbuf_05.sgetc() == 'a';
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_05.str() == str_02 ); // as only an "in" buffer
+ VERIFY( isbuf_05.sgetc() == 'a' );
// full istream to empty in_buf (need out_buf, you know?)
state1 = is_04.rdstate();
is_04 >> &isbuf_02;
state2 = is_04.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
- test &= isbuf_02.str() == str_01; // as only an "in" buffer
- test &= isbuf_02.sgetc() == ctraits_type::eof();
- test &= is_04.peek() == ctraits_type::eof(); // as failed
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_02.str() == str_01 ); // as only an "in" buffer
+ VERIFY( isbuf_02.sgetc() == ctraits_type::eof() );
+ VERIFY( is_04.peek() == ctraits_type::eof() ); // as failed
// full istream to empty in_out_buf
is_04.clear(std::ios_base::goodbit);
state1 = is_04.rdstate();
is_04 >> &isbuf_03;
state2 = is_04.rdstate();
- test &= state1 != state2;
- test &= !static_cast<bool>(state2 & statefail);
- test &= state2 == stateeof;
+ VERIFY( state1 != state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+ VERIFY( state2 == stateeof );
strtmp = isbuf_03.str();
- test &= strtmp == str_02; // as only an "in" buffer
- test &= isbuf_03.sgetc() == 'a';
- test &= is_04.peek() == ctraits_type::eof();
+ VERIFY( strtmp == str_02 ); // as only an "in" buffer
+ VERIFY( isbuf_03.sgetc() == 'a' );
+ VERIFY( is_04.peek() == ctraits_type::eof() );
#ifdef DEBUG_ASSERT
assert(test);
@@ -162,8 +160,8 @@ bool test02() {
std::filebuf fbin, fbout;
fbin.open(name_01, std::ios_base::in);
fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
- test &= fbin.is_open();
- test &= fbout.is_open();
+ VERIFY( fbin.is_open() );
+ VERIFY( fbout.is_open() );
if (test)
{
@@ -174,8 +172,8 @@ bool test02() {
fbout.close();
fbin.close();
- test &= !fbin.is_open();
- test &= !fbout.is_open();
+ VERIFY( !fbin.is_open() );
+ VERIFY( !fbout.is_open() );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/istream_manip.cc b/libstdc++-v3/testsuite/27_io/istream_manip.cc
index 206e406..57d376c 100644
--- a/libstdc++-v3/testsuite/27_io/istream_manip.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_manip.cc
@@ -23,9 +23,7 @@
#include <istream>
#include <sstream>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -44,36 +42,36 @@ bool test01(void)
std::istringstream iss02(str01);
iss01 >> str04;
- test &= str04.size() != str01.size();
- test &= str04 == "santa";
+ VERIFY( str04.size() != str01.size() );
+ VERIFY( str04 == "santa" );
iss02 >> std::ws;
iss02 >> str05;
- test &= str05.size() != str01.size();
- test &= str05 == "santa";
- test &= str05 == str04;
+ VERIFY( str05.size() != str01.size() );
+ VERIFY( str05 == "santa" );
+ VERIFY( str05 == str04 );
iss01 >> str04;
- test &= str04.size() != str01.size();
- test &= str04 == "barbara";
+ VERIFY( str04.size() != str01.size() );
+ VERIFY( str04 == "barbara" );
iss02 >> std::ws;
iss02 >> str05;
- test &= str05.size() != str01.size();
- test &= str05 == "barbara";
- test &= str05 == str04;
+ VERIFY( str05.size() != str01.size() );
+ VERIFY( str05 == "barbara" );
+ VERIFY( str05 == str04 );
flag3 = std::ios_base::eofbit;
flag4 = std::ios_base::badbit;
flag5 = std::ios_base::failbit;
- test &= !iss01.fail();
- test &= !iss02.fail();
- test &= !iss01.eof();
- test &= !iss02.eof();
+ VERIFY( !iss01.fail() );
+ VERIFY( !iss02.fail() );
+ VERIFY( !iss01.eof() );
+ VERIFY( !iss02.eof() );
iss01 >> std::ws;
- test &= !iss01.fail();
- test &= iss01.eof();
+ VERIFY( !iss01.fail() );
+ VERIFY( iss01.eof() );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/istream_seeks.cc b/libstdc++-v3/testsuite/27_io/istream_seeks.cc
index 4a506f2..52f6ecb 100644
--- a/libstdc++-v3/testsuite/27_io/istream_seeks.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_seeks.cc
@@ -24,9 +24,7 @@
#include <istream>
#include <sstream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01()
@@ -45,7 +43,7 @@ bool test01()
ifstream ifs1;
pos_type p4 = ifs1.tellg();
- test &= p3 == p4;
+ VERIFY( p3 == p4 );
// in
// test ctors leave things in the same positions...
@@ -55,7 +53,7 @@ bool test01()
ifstream ifs2(str_lit01);
p4 = ifs2.tellg();
- test &= p3 == p4;
+ VERIFY( p3 == p4 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -75,9 +73,9 @@ void test04(void)
std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
std::ifstream if02(str_lit01, std::ios_base::in);
std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
- test &= if01.good();
- test &= if02.good();
- test &= if03.good();
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
std::istream is01(if01.rdbuf());
std::istream is02(if02.rdbuf());
@@ -87,20 +85,20 @@ void test04(void)
// in | out
pos01 = is01.tellg();
pos02 = is01.tellg();
- test &= pos01 == pos02;
- // test &= istream::pos_type(0) != pos01; //depricated
+ VERIFY( pos01 == pos02 );
+ // VERIFY( istream::pos_type(0) != pos01 ); //depricated
// in
pos03 = is02.tellg();
pos04 = is02.tellg();
- test &= pos03 == pos04;
- // test &= istream::pos_type(0) != pos03; //depricated
+ VERIFY( pos03 == pos04 );
+ // VERIFY( istream::pos_type(0) != pos03 ); //depricated
// out
pos05 = is03.tellg();
pos06 = is03.tellg();
- test &= pos05 == pos06;
- // test &= istream::pos_type(0) != pos01; //depricated
+ VERIFY( pos05 == pos06 );
+ // VERIFY( istream::pos_type(0) != pos01 ); //depricated
// istream& seekg(pos_type)
// istream& seekg(off_type, ios_base::seekdir)
@@ -114,56 +112,56 @@ void test04(void)
is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate();
pos01 = is01.tellg();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellg();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(10, std::ios_base::cur);
state02 = is02.rdstate();
pos03 = is02.tellg();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellg();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(10, std::ios_base::cur);
state02 = is03.rdstate();
pos05 = is03.tellg();
- test &= pos05 == pos06 + 10;
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 + 10 );
+ VERIFY( state01 == state02 );
pos06 = is03.tellg();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
// beg
state01 = is01.rdstate();
is01.seekg(20, std::ios_base::beg);
state02 = is01.rdstate();
pos01 = is01.tellg();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellg();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(20, std::ios_base::beg);
state02 = is02.rdstate();
pos03 = is02.tellg();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellg();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(20, std::ios_base::beg);
state02 = is03.rdstate();
pos05 = is03.tellg();
- test &= pos05 == pos06 + 10;
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 + 10 );
+ VERIFY( state01 == state02 );
pos06 = is03.tellg();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -180,9 +178,9 @@ void test05(void)
std::ifstream if01(str_lit01);
std::ifstream if02(str_lit01);
std::ifstream if03(str_lit01);
- test &= if01.good();
- test &= if02.good();
- test &= if03.good();
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
if01 >> &strbuf01;
@@ -199,20 +197,20 @@ void test05(void)
// in | out
pos01 = is01.tellg();
pos02 = is01.tellg();
- test &= pos01 == pos02;
- // test &= istream::pos_type(0) != pos01; // deprecated
+ VERIFY( pos01 == pos02 );
+ // VERIFY( istream::pos_type(0) != pos01 ); // deprecated
// in
pos03 = is02.tellg();
pos04 = is02.tellg();
- test &= pos03 == pos04;
- // test &= istream::pos_type(0) != pos03; // deprecated
+ VERIFY( pos03 == pos04 );
+ // VERIFY( istream::pos_type(0) != pos03 ); // deprecated
// out
pos05 = is03.tellg();
pos06 = is03.tellg();
- test &= pos05 == pos06;
- // test &= istream::pos_type(0) != pos01; //deprecated
+ VERIFY( pos05 == pos06 );
+ // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
// istream& seekg(pos_type)
// istream& seekg(off_type, ios_base::seekdir)
@@ -226,56 +224,56 @@ void test05(void)
is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate();
pos01 = is01.tellg();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellg();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(10, std::ios_base::cur);
state02 = is02.rdstate();
pos03 = is02.tellg();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellg();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(10, std::ios_base::cur);
state02 = is03.rdstate();
pos05 = is03.tellg();
- test &= pos05 == pos06; // as only out buffer
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 ); // as only out buffer
+ VERIFY( state01 == state02 );
pos06 = is03.tellg();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
// beg
state01 = is01.rdstate();
is01.seekg(20, std::ios_base::beg);
state02 = is01.rdstate();
pos01 = is01.tellg();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellg();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(20, std::ios_base::beg);
state02 = is02.rdstate();
pos03 = is02.tellg();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellg();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(20, std::ios_base::beg);
state02 = is03.rdstate();
pos05 = is03.tellg();
- test &= pos05 == pos06; // as only out buffer
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 ); // as only out buffer
+ VERIFY( state01 == state02 );
pos06 = is03.tellg();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/istream_sentry.cc b/libstdc++-v3/testsuite/27_io/istream_sentry.cc
index ba4f7cb..5baca93 100644
--- a/libstdc++-v3/testsuite/27_io/istream_sentry.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_sentry.cc
@@ -31,9 +31,7 @@
#include <istream>
#include <sstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
{
@@ -48,17 +46,17 @@ void test01()
// test negatives
std::istream::sentry sentry01(istr01);
- test &= bool(sentry01) == false;
+ VERIFY( bool(sentry01) == false );
std::istream::sentry sentry02(istr01, true);
- test &= bool(sentry02) == false;
+ VERIFY( bool(sentry02) == false );
// positive tests
std::istream::sentry sentry03(istr02);
- test &= bool(sentry03) == true;
+ VERIFY( bool(sentry03) == true );
std::istream::sentry sentry04(istr02, true);
- test &= bool(sentry04) == true;
+ VERIFY( bool(sentry04) == true );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
index b6a547a..6757a39 100644
--- a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
+++ b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc
@@ -23,15 +23,11 @@
#include <istream>
#include <sstream>
#include <fstream>
-#ifdef DEBUG_ASSERT
-#include <cassert>
-# define VERIFY(fn) assert(fn)
-#else
-# define VERIFY(fn)
-#endif
-
-bool test01() {
+#include <debug_assert.h>
+int
+test01()
+{
typedef std::ios::traits_type traits_type;
bool test = true;
@@ -54,78 +50,78 @@ bool test01() {
state1 = is_04.rdstate();
is_04.read(carray, 0);
state2 = is_04.rdstate();
- test &= state1 == state2;
+ VERIFY( state1 == state2 );
state1 = is_04.rdstate();
is_04.read(carray, 9);
state2 = is_04.rdstate();
- test &= state1 == state2;
- test &= !strncmp(carray, "soul eyes", 9);
- test &= is_04.peek() == ':';
+ VERIFY( state1 == state2 );
+ VERIFY( !strncmp(carray, "soul eyes", 9) );
+ VERIFY( is_04.peek() == ':' );
state1 = is_03.rdstate();
is_03.read(carray, 60);
state2 = is_03.rdstate();
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & stateeof);
- test &= static_cast<bool>(state2 & statefail);
- test &= !strncmp(carray, "soul eyes: john coltrane quartet", 35);
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & stateeof) );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( !strncmp(carray, "soul eyes: john coltrane quartet", 35) );
// istream& ignore(streamsize n = 1, int_type delim = traits::eof())
state1 = is_04.rdstate();
is_04.ignore();
- test &= is_04.gcount() == 1;
+ VERIFY( is_04.gcount() == 1 );
state2 = is_04.rdstate();
- test &= state1 == state2;
- test &= is_04.peek() == ' ';
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == ' ' );
state1 = is_04.rdstate();
is_04.ignore(0);
- test &= is_04.gcount() == 0;
+ VERIFY( is_04.gcount() == 0 );
state2 = is_04.rdstate();
- test &= state1 == state2;
- test &= is_04.peek() == ' ';
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == ' ' );
state1 = is_04.rdstate();
is_04.ignore(5, traits_type::to_int_type(' '));
- test &= is_04.gcount() == 1;
+ VERIFY( is_04.gcount() == 1 );
state2 = is_04.rdstate();
- test &= state1 == state2;
- test &= is_04.peek() == 'j';
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == 'j' );
// int_type peek()
state1 = is_04.rdstate();
- test &= is_04.peek() == 'j';
- test &= is_04.gcount() == 0;
+ VERIFY( is_04.peek() == 'j' );
+ VERIFY( is_04.gcount() == 0 );
state2 = is_04.rdstate();
- test &= state1 == state2;
+ VERIFY( state1 == state2 );
is_04.ignore(30);
state1 = is_04.rdstate();
- test &= is_04.peek() == traits_type::eof();
- test &= is_04.gcount() == 0;
+ VERIFY( is_04.peek() == traits_type::eof() );
+ VERIFY( is_04.gcount() == 0 );
state2 = is_04.rdstate();
- test &= state1 == state2;
+ VERIFY( state1 == state2 );
// istream& putback(char c)
is_04.clear();
state1 = is_04.rdstate();
is_04.putback('|');
- test &= is_04.gcount() == 0;
+ VERIFY( is_04.gcount() == 0 );
state2 = is_04.rdstate();
- test &= state1 == state2;
- test &= is_04.peek() == '|';
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == '|' );
// istream& unget()
is_04.clear();
state1 = is_04.rdstate();
is_04.unget();
- test &= is_04.gcount() == 0;
+ VERIFY( is_04.gcount() == 0 );
state2 = is_04.rdstate();
- test &= state1 == state2;
- test &= is_04.peek() == 'e';
+ VERIFY( state1 == state2 );
+ VERIFY( is_04.peek() == 'e' );
// int sync()
int i = is_00.sync();
@@ -134,10 +130,11 @@ bool test01() {
assert(test);
#endif
- return test;
+ return 0;
}
-bool test02(void)
+int
+test02()
{
typedef std::char_traits<char> traits_type;
@@ -166,67 +163,68 @@ bool test02(void)
state2 = is_00.rdstate();
// make sure failbit was set, since we couldn't extract
// from the NULL streambuf...
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & statefail);
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
- test &= is_04.gcount() == 0;
+ VERIFY( is_04.gcount() == 0 );
state1 = is_04.rdstate();
is_04.getline(carray1, 1, '\t'); // extracts, throws away
state2 = is_04.rdstate();
- test &= is_04.gcount() == 1;
- test &= state1 == state2;
- test &= state1 == 0;
- test &= !traits_type::compare("", carray1, 1);
+ VERIFY( is_04.gcount() == 1 );
+ VERIFY( state1 == state2 );
+ VERIFY( state1 == 0 );
+ VERIFY( !traits_type::compare("", carray1, 1) );
state1 = is_04.rdstate();
is_04.getline(carray1, 20, '*');
state2 = is_04.rdstate();
- test &= is_04.gcount() == 10;
- test &= state1 == state2;
- test &= state1 == 0;
- test &= !traits_type::compare("\t\t sun", carray1, 10);
+ VERIFY( is_04.gcount() == 10 );
+ VERIFY( state1 == state2 );
+ VERIFY( state1 == 0 );
+ VERIFY( !traits_type::compare("\t\t sun", carray1, 10) );
state1 = is_04.rdstate();
is_04.getline(carray1, 20);
state2 = is_04.rdstate();
- test &= is_04.gcount() == 4;
- test &= state1 == state2;
- test &= state1 == 0;
- test &= !traits_type::compare("ra ", carray1, 4);
+ VERIFY( is_04.gcount() == 4 );
+ VERIFY( state1 == state2 );
+ VERIFY( state1 == 0 );
+ VERIFY( !traits_type::compare("ra ", carray1, 4) );
state1 = is_04.rdstate();
is_04.getline(carray1, 65);
state2 = is_04.rdstate();
- test &= is_04.gcount() == 64;
- test &= state1 != state2;
- test &= state2 == statefail;
- test &= !traits_type::compare(" and his myth science arkestra presen", carray1, 65);
+ VERIFY( is_04.gcount() == 64 );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == statefail );
+ VERIFY( !traits_type::compare(" and his myth science arkestra presen", carray1, 65) );
is_04.clear();
state1 = is_04.rdstate();
is_04.getline(carray1, 120, '|');
state2 = is_04.rdstate();
- test &= is_04.gcount() == 106;
- test &= state1 != state2;
- test &= state2 == stateeof;
+ VERIFY( is_04.gcount() == 106 );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
is_04.clear();
state1 = is_04.rdstate();
is_04.getline(carray1, 100, '|');
state2 = is_04.rdstate();
- test &= is_04.gcount() == 0;
- test &= state1 != state2;
- test &= static_cast<bool>(state2 & stateeof);
- test &= static_cast<bool>(state2 & statefail);
+ VERIFY( is_04.gcount() == 0 );
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & stateeof) );
+ VERIFY( static_cast<bool>(state2 & statefail) );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
-bool test03(void)
+int
+test03()
{
typedef std::char_traits<char> traits_type;
@@ -256,73 +254,74 @@ bool test03(void)
// istream& get(streambuf&, char delim)
// istream& get(streambuf&)
is_00.get(carray1, 2);
- test &= static_cast<bool>(is_00.rdstate() & statefail);
- test &= is_00.gcount() == 0;
+ VERIFY( static_cast<bool>(is_00.rdstate() & statefail) );
+ VERIFY( is_00.gcount() == 0 );
is_04.get(carray1, 4);
- test &= !(is_04.rdstate() & statefail);
- test &= !traits_type::compare(carray1, " ", 4);
- test &= is_04.gcount() == 3;
+ VERIFY( !(is_04.rdstate() & statefail) );
+ VERIFY( !traits_type::compare(carray1, " ", 4) );
+ VERIFY( is_04.gcount() == 3 );
is_04.clear();
is_04.get(carray1 + 3, 200);
- test &= !(is_04.rdstate() & statefail);
- test &= !(is_04.rdstate() & stateeof);
- test &= !traits_type::compare(carray1, str_lit01, 10);
- test &= is_04.gcount() == 7;
+ VERIFY( !(is_04.rdstate() & statefail) );
+ VERIFY( !(is_04.rdstate() & stateeof) );
+ VERIFY( !traits_type::compare(carray1, str_lit01, 10) );
+ VERIFY( is_04.gcount() == 7 );
is_04.clear();
is_04.get(carray1, 200);
- test &= !(is_04.rdstate() & stateeof);
- test &= static_cast<bool>(is_04.rdstate() & statefail); // delimiter
- test &= is_04.gcount() == 0;
+ VERIFY( !(is_04.rdstate() & stateeof) );
+ VERIFY( static_cast<bool>(is_04.rdstate() & statefail) ); // delimiter
+ VERIFY( is_04.gcount() == 0 );
is_04.clear();
is_04.get(carray1, 200, '[');
- test &= static_cast<bool>(is_04.rdstate() & stateeof);
- test &= !(is_04.rdstate() & statefail);
- test &= is_04.gcount() == 125;
+ VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
+ VERIFY( !(is_04.rdstate() & statefail) );
+ VERIFY( is_04.gcount() == 125 );
is_04.clear();
is_04.get(carray1, 200);
- test &= static_cast<bool>(is_04.rdstate() & stateeof);
- test &= static_cast<bool>(is_04.rdstate() & statefail);
- test &= is_04.gcount() == 0;
+ VERIFY( static_cast<bool>(is_04.rdstate() & stateeof) );
+ VERIFY( static_cast<bool>(is_04.rdstate() & statefail) );
+ VERIFY( is_04.gcount() == 0 );
std::stringbuf sbuf_02(std::ios_base::in);
is_05.clear();
is_05.get(sbuf_02);
- test &= is_05.gcount() == 0;
- test &= static_cast<bool>(is_05.rdstate() & statefail);
- test &= !(is_05.rdstate() & stateeof);
+ VERIFY( is_05.gcount() == 0 );
+ VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
+ VERIFY( !(is_05.rdstate() & stateeof) );
is_05.clear();
is_05.get(sbuf_03);
- test &= is_05.gcount() == 10;
- test &= sbuf_03.str() == " sun*ra ";
- test &= !(is_05.rdstate() & statefail);
- test &= !(is_05.rdstate() & stateeof);
+ VERIFY( is_05.gcount() == 10 );
+ VERIFY( sbuf_03.str() == " sun*ra " );
+ VERIFY( !(is_05.rdstate() & statefail) );
+ VERIFY( !(is_05.rdstate() & stateeof) );
is_05.clear();
is_05.get(sbuf_03, '|');
- test &= is_05.gcount() == 125;
- test &= sbuf_03.str() == str_lit01;
- test &= !(is_05.rdstate() & statefail);
- test &= static_cast<bool>(is_05.rdstate() & stateeof);
+ VERIFY( is_05.gcount() == 125 );
+ VERIFY( sbuf_03.str() == str_lit01 );
+ VERIFY( !(is_05.rdstate() & statefail) );
+ VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
is_05.clear();
is_05.get(sbuf_03, '|');
- test &= is_05.gcount() == 0;
- test &= static_cast<bool>(is_05.rdstate() & stateeof);
- test &= static_cast<bool>(is_05.rdstate() & statefail);
+ VERIFY( is_05.gcount() == 0 );
+ VERIFY( static_cast<bool>(is_05.rdstate() & stateeof) );
+ VERIFY( static_cast<bool>(is_05.rdstate() & statefail) );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00177.html
-void test04()
+int
+test04()
{
bool test = true;
@@ -337,21 +336,23 @@ void test04()
stateeof = std::ios_base::eofbit;
state1 = stateeof | statefail;
- test &= is_00.gcount() == 0;
+ VERIFY( is_00.gcount() == 0 );
is_00.read(c_array, str_00.size() + 1);
- test &= is_00.gcount() == str_00.size();
- test &= is_00.rdstate() == state1;
+ VERIFY( is_00.gcount() == str_00.size() );
+ VERIFY( is_00.rdstate() == state1 );
is_00.read(c_array, str_00.size());
- test &= is_00.rdstate() == state1;
+ VERIFY( is_00.rdstate() == state1 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
+ return 0;
}
// http://sourceware.cygnus.com/ml/libstdc++/2000-07/msg00003.html
-bool test05()
+int
+test05()
{
const char* charray = "
a
@@ -420,7 +421,7 @@ aaaaaaaaaaaaaa
// http://sources.redhat.com/ml/libstdc++/2000-07/msg00126.html
-bool
+int
test06()
{
using namespace std;
@@ -434,24 +435,26 @@ test06()
istream istr(&strbuf);
istr.getline(tmp,it);
- test &= istr.gcount() == it; // extracted whole string
- test &= strlen(tmp) == 4; // stored all but '\n'
- test &= !istr.eof(); // extracted up to but not eof
- test &= !istr.fail(); // failbit not set
+ VERIFY( istr.gcount() == it ); // extracted whole string
+ VERIFY( strlen(tmp) == 4 ); // stored all but '\n'
+ VERIFY( !istr.eof() ); // extracted up to but not eof
+ VERIFY( !istr.fail() ); // failbit not set
char c = 'z';
istr.get(c);
- test &= c == 'z';
- test &= istr.eof();
+ VERIFY( c == 'z' );
+ VERIFY( istr.eof() );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+
+ return 0;
}
-int main()
+int
+main()
{
test01();
test02();
@@ -459,6 +462,7 @@ int main()
test04();
test05();
test06();
+
return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/istringstream_members.cc b/libstdc++-v3/testsuite/27_io/istringstream_members.cc
index 6047b65..e11b6ab 100644
--- a/libstdc++-v3/testsuite/27_io/istringstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/istringstream_members.cc
@@ -24,9 +24,7 @@
// stringbuf* rdbuf() const
#include <sstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
@@ -47,30 +45,30 @@ void test01()
state1 = is01.rdstate();
is01 >> a;
state2 = is01.rdstate();
- test &= a = i01;
+ VERIFY( a = i01 );
// 22.2.2.1.2 num_get virtual functions
// p 13
// in any case, if stage 2 processing was terminated by the test for
// in == end then err != ios_base::eofbit is performed.
- test &= state1 != state2;
- test &= state2 == stateeof;
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
is01.str(str01);
is01 >> b;
- test &= b != a;
+ VERIFY( b != a );
// as is01.good() is false, istream::sentry blocks extraction.
is01.clear();
state1 = is01.rdstate();
is01 >> b;
state2 = is01.rdstate();
- test &= b == a;
- test &= state1 != state2;
- test &= state2 == stateeof;
+ VERIFY( b == a );
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == stateeof );
// string str() const
str02 = is01.str();
- test &= str01 == str02;
+ VERIFY( str01 == str02 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc b/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc
index e790033..3fbe3dd 100644
--- a/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc
+++ b/libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc
@@ -66,13 +66,15 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include <debug_assert.h>
// Include iostream last, just to make is as difficult as possible to
// properly initialize the standard iostream objects.
#include <iostream>
// Make sure all the standard streams are defined.
-bool test01()
+int
+test01()
{
bool test = true;
@@ -83,17 +85,19 @@ bool test01()
array1[i] = '\0';
std::cout << "testing cout" << std::endl;
std::cerr << "testing cerr" << std::endl;
- test &= std::cerr.flags() & std::ios_base::unitbuf;
+ VERIFY( std::cerr.flags() & std::ios_base::unitbuf );
std::clog << "testing clog" << std::endl;
// std::cin >> array1; // requires somebody to type something in.
- test &= std::cin.tie() == &std::cout;
+ VERIFY( std::cin.tie() == &std::cout );
- return test;
+ return 0;
}
-int main(void)
+int
+main()
{
test01();
return 0;
}
+
diff --git a/libstdc++-v3/testsuite/27_io/ofstream_members.cc b/libstdc++-v3/testsuite/27_io/ofstream_members.cc
index 76c5a1d..578ad1f 100644
--- a/libstdc++-v3/testsuite/27_io/ofstream_members.cc
+++ b/libstdc++-v3/testsuite/27_io/ofstream_members.cc
@@ -20,9 +20,7 @@
#include <ostream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
const char name_01[] = "testsuite/ofstream_members-1.tst";
const char name_02[] = "testsuite/ofstream_members-1.txt";
@@ -35,15 +33,15 @@ bool test00()
ofs1.close();
// false as expected:
- test &= !ofs1.is_open();
+ VERIFY( !ofs1.is_open() );
// this is now true:
- test &= !(ofs1);
+ VERIFY( !(ofs1) );
ofs1.open(name_02);
- test &= ofs1.is_open();
+ VERIFY( ofs1.is_open() );
// fail bit still true
- test &= !(ofs1);
- test &= ofs1.rdstate() == std::ios_base::failbit;
+ VERIFY( !(ofs1) );
+ VERIFY( ofs1.rdstate() == std::ios_base::failbit );
ofs1.close();
@@ -64,7 +62,7 @@ bool test01()
for(int i = 0; ++i < more_than_max_open_files;)
{
std::ofstream ifs(name_02);
- test &= static_cast<bool>(ifs);
+ VERIFY( static_cast<bool>(ifs) );
}
#ifdef DEBUG_ASSERT
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
index 88ec5e4..722ce1c 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc
@@ -24,7 +24,7 @@
#include <locale>
#include <sstream>
#include <limits>
-#include <assert.h>
+#include <debug_assert.h>
using namespace std;
@@ -187,8 +187,10 @@ void apply_formatting(const _TestCase & tc, basic_ostream<_CharT> & os)
os.setf(ios::right);
}
-void test01()
+int
+test01()
{
+ bool test = true;
for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
{
_TestCase & tc = testcases[j];
@@ -206,7 +208,7 @@ void test01()
#ifdef TEST_NUMPUT_VERBOSE
cout << "result: " << os.str() << endl;
#endif
- assert(os && os.str() == tc.result);
+ VERIFY( os && os.str() == tc.result );
}
// test long double with char type
{
@@ -219,7 +221,7 @@ void test01()
#ifdef TEST_NUMPUT_VERBOSE
cout << "result: " << os.str() << endl;
#endif
- assert(os && os.str() == tc.result);
+ VERIFY( os && os.str() == tc.result );
}
#if _GLIBCPP_USE_WCHAR_T
// test double with wchar_t type
@@ -230,7 +232,7 @@ void test01()
os.imbue(__loc);
apply_formatting(tc, os);
os << tc.val;
- assert(os && os.str() == tc.wresult);
+ VERIFY( os && os.str() == tc.wresult );
}
// test long double with wchar_t type
{
@@ -240,14 +242,18 @@ void test01()
os.imbue(__loc);
apply_formatting(tc, os);
os << (long double)tc.val;
- assert(os && os.str() == tc.wresult);
+ VERIFY( os && os.str() == tc.wresult );
}
#endif
}
+
+ return 0;
}
-void test02()
+int
+test02()
{
+ bool test = true;
// make sure we can output a very long float
long double val = 1.2345678901234567890123456789e+1000L;
int prec = numeric_limits<long double>::digits10;
@@ -263,10 +269,13 @@ void test02()
cout << "expect: " << largebuf << endl;
cout << "result: " << os.str() << endl;
#endif
- assert(os && os.str() == largebuf);
+ VERIFY(os && os.str() == largebuf);
+
+ return 0;
}
-void test03()
+int
+test03()
{
short s = -1;
int i = -1;
@@ -279,24 +288,27 @@ void test03()
ostream o(&strbuf);
o << oct << s << ' ' << hex << s;
- test &= strbuf.str() == "177777 ffff"; // Assuming 2byte-shorts
+ VERIFY( strbuf.str() == "177777 ffff" ); // Assuming 2byte-shorts
strbuf.str(str_blank);
o << oct << i << ' ' << hex << i;
- test &= strbuf.str() == "37777777777 ffffffff";
+ VERIFY( strbuf.str() == "37777777777 ffffffff" );
strbuf.str(str_blank);
o << oct << l << ' ' << hex << l;
- test &= strbuf.str() == "37777777777 ffffffff";
+ VERIFY( strbuf.str() == "37777777777 ffffffff" );
strbuf.str(str_blank);
o << showpos << hex << showbase << 11;
- test &= strbuf.str() == "0xb";
+ VERIFY( strbuf.str() == "0xb" );
- assert(test);
+ VERIFY(test);
+
+ return 0;
}
-int main()
+int
+main()
{
test01();
test02();
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
index 893631e..c22b53b 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
@@ -24,9 +24,7 @@
#include <ostream>
#include <sstream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
// ofstream
bool test01()
@@ -75,7 +73,7 @@ bool test02(void)
oss01.flags(std::ios_base::left);
oss01 << str01;
tmp = oss01.str();
- test &= tmp == "00000";
+ VERIFY( tmp == "00000" );
std::string str02 = "1";
std::ostringstream oss02;
@@ -84,7 +82,7 @@ bool test02(void)
oss02.flags(std::ios_base::left);
oss02 << str02;
tmp = oss02.str();
- test &= tmp == "10000";
+ VERIFY( tmp == "10000" );
std::string str03 = "909909";
std::ostringstream oss03;
@@ -93,7 +91,7 @@ bool test02(void)
oss03.flags(std::ios_base::left);
oss03 << str03;
tmp = oss03.str();
- test &= tmp == "909909";
+ VERIFY( tmp == "909909" );
#ifdef DEBUG_ASSERT
assert(test);
@@ -116,7 +114,7 @@ bool test03(void)
oss01.flags(std::ios_base::right);
oss01 << str01;
tmp = oss01.str();
- test &= tmp == "00000";
+ VERIFY( tmp == "00000" );
std::string str02 = "1";
std::ostringstream oss02;
@@ -125,7 +123,7 @@ bool test03(void)
oss02.flags(std::ios_base::right);
oss02 << str02;
tmp = oss02.str();
- test &= tmp == "00001";
+ VERIFY( tmp == "00001" );
std::string str03 = "909909";
std::ostringstream oss03;
@@ -134,7 +132,7 @@ bool test03(void)
oss03.flags(std::ios_base::right);
oss03 << str03;
tmp = oss03.str();
- test &= tmp == "909909";
+ VERIFY( tmp == "909909" );
#ifdef DEBUG_ASSERT
assert(test);
@@ -164,10 +162,10 @@ bool test04() {
for (int i = 0; i < i_max; ++i)
oss_02 << "Test: " << i << std::endl;
str_tmp = oss_02.str();
- test &= !oss_02.bad();
- test &= oss_02.good();
- test &= str_tmp != str_01;
- test &= str_tmp.size() == 2390;
+ VERIFY( !oss_02.bad() );
+ VERIFY( oss_02.good() );
+ VERIFY( str_tmp != str_01 );
+ VERIFY( str_tmp.size() == 2390 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -207,8 +205,8 @@ bool test05()
sstr02 << str01;
str05 = sstr01.str();
str10 = sstr02.str();
- test &= str05 == str01;
- test &= str10 == str01;
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
// test 2: in | out
std::ostringstream sstr04(str01, std::ios_base::out | std::ios_base::in);
@@ -216,8 +214,8 @@ bool test05()
sstr05 << str01;
str05 = sstr04.str();
str10 = sstr05.str();
- test &= str05 == str01;
- test &= str10 == str01;
+ VERIFY( str05 == str01 );
+ VERIFY( str10 == str01 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -236,21 +234,21 @@ void test06()
// normal
std::ostringstream ostr1("mos def");
- test &= ostr1.str() == "mos def";
+ VERIFY( ostr1.str() == "mos def" );
ostr1 << " & talib kweli"; // should overwrite first part of buffer
- test &= ostr1.str() == " & talib kweli";
+ VERIFY( ostr1.str() == " & talib kweli" );
ostr1 << " are black star"; // should append to string from above
- test &= ostr1.str() != carray01;
- test &= ostr1.str() == " & talib kweli are black star";
+ VERIFY( ostr1.str() != carray01 );
+ VERIFY( ostr1.str() == " & talib kweli are black star" );
// appending
std::ostringstream ostr2("blackalicious",
std::ios_base::out | std::ios_base::ate);
- test &= ostr2.str() == "blackalicious";
+ VERIFY( ostr2.str() == "blackalicious" );
ostr2 << " NIA "; // should not overwrite first part of buffer
- test &= ostr2.str() == "blackalicious NIA ";
+ VERIFY( ostr2.str() == "blackalicious NIA " );
ostr2 << "4: deception (5:19)"; // should append to full string from above
- test &= ostr2.str() == "blackalicious NIA 4: deception (5:19)";
+ VERIFY( ostr2.str() == "blackalicious NIA 4: deception (5:19)" );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
index 0c8738e..a62a218 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
@@ -24,9 +24,7 @@
#include <ostream>
#include <sstream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
const int size = 1000;
const char name_01[] = "testsuite/ostream_inserter_other-1.tst";
@@ -36,16 +34,20 @@ const char name_04[] = "testsuite/ostream_inserter_other-2.txt";
// stringstream
-bool test01() {
+int
+test01()
+{
bool test = true;
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
// fstream
-bool test02() {
+int
+test02()
+{
typedef std::ios_base::iostate iostate;
bool test = true;
@@ -57,13 +59,13 @@ bool test02() {
iostate state01 = f_in1.rdstate();
f_in1 >> strbuf01;
iostate state02 = f_in1.rdstate();
- test &= state01 != state02;
- test &= (state02 & std::ios_base::failbit) != 0;
+ VERIFY( state01 != state02 );
+ VERIFY( (state02 & std::ios_base::failbit) != 0 );
state01 = f_out1.rdstate();
f_out1 << strbuf01;
state02 = f_out1.rdstate();
- test &= state01 != state02;
- test &= (state02 & std::ios_base::failbit) != 0;
+ VERIFY( state01 != state02 );
+ VERIFY( (state02 & std::ios_base::failbit) != 0 );
// filebuf->filebuf
std::ifstream f_in(name_01);
@@ -86,8 +88,8 @@ bool test02() {
#ifdef DEBUG_ASSERT
assert(test);
#endif
-
- return test;
+
+ return 0;
}
// via Brent Verner <brent@rcfile.org>
@@ -130,7 +132,8 @@ test03(void)
return 0;
}
-int main()
+int
+main()
{
test01();
test02();
diff --git a/libstdc++-v3/testsuite/27_io/ostream_manip.cc b/libstdc++-v3/testsuite/27_io/ostream_manip.cc
index e9b30c1..17d376a 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_manip.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_manip.cc
@@ -23,9 +23,7 @@
#include <ostream>
#include <sstream>
#include <stdexcept>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01(void)
{
@@ -47,33 +45,33 @@ bool test01(void)
oss01 << std::endl;
str04 = oss01.str();
- test &= str04.size() == str01.size();
+ VERIFY( str04.size() == str01.size() );
oss02 << std::endl;
str05 = oss02.str();
- test &= str05.size() == 1;
+ VERIFY( str05.size() == 1 );
// template<_CharT, _Traits>
// basic_ostream<_CharT, _Traits>& ends(basic_ostream<_Char, _Traits>& os)
oss01 << std::ends;
str04 = oss01.str();
- test &= str04.size() == str01.size();
- test &= str04[1] == char();
+ VERIFY( str04.size() == str01.size() );
+ VERIFY( str04[1] == char() );
oss02 << std::ends;
str05 = oss02.str();
- test &= str05.size() == 2;
- test &= str05[1] == char();
+ VERIFY( str05.size() == 2 );
+ VERIFY( str05[1] == char() );
// template<_CharT, _Traits>
// basic_ostream<_CharT, _Traits>& flush(basic_ostream<_Char, _Traits>& os)
oss01.flush();
str04 = oss01.str();
- test &= str04.size() == str01.size();
+ VERIFY( str04.size() == str01.size() );
oss02.flush();
str05 = oss02.str();
- test &= str05.size() == 2;
+ VERIFY( str05.size() == 2 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -94,7 +92,7 @@ bool test02()
const string str_00("herbie_hancock");
int_type len1 = str_00.size();
osst_01 << str_00;
- test &= osst_01.str().size() == len1;
+ VERIFY( osst_01.str().size() == len1 );
osst_01 << ends;
@@ -102,8 +100,8 @@ bool test02()
int_type len2 = str_01.size();
osst_01 << str_01;
int_type len3 = osst_01.str().size();
- test &= len1 < len3;
- test &= len3 == len1 + len2 + 1;
+ VERIFY( len1 < len3 );
+ VERIFY( len3 == len1 + len2 + 1 );
osst_01 << ends;
@@ -111,8 +109,8 @@ bool test02()
int_type len4 = str_02.size();
osst_01 << str_02;
int_type len5 = osst_01.str().size();
- test &= len3 < len5;
- test &= len5 == len3 + len4 + 1;
+ VERIFY( len3 < len5 );
+ VERIFY( len5 == len3 + len4 + 1 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ostream_seeks.cc b/libstdc++-v3/testsuite/27_io/ostream_seeks.cc
index 4963d58..2f5404f 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_seeks.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_seeks.cc
@@ -23,9 +23,7 @@
#include <ostream>
#include <sstream>
#include <fstream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
bool test01()
@@ -44,7 +42,7 @@ bool test01()
ofstream ofs1;
pos_type p2 = ofs1.tellp();
- test &= p1 == p2;
+ VERIFY( p1 == p2 );
// out
// test ctors leave things in the same positions...
@@ -54,7 +52,7 @@ bool test01()
ofstream ofs2(str_lit01);
p2 = ofs2.tellp();
- test &= p1 == p2;
+ VERIFY( p1 == p2 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -79,9 +77,9 @@ void test04(void)
std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
std::ifstream if02(str_lit01, std::ios_base::in);
std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
- test &= if01.good();
- test &= if02.good();
- test &= if03.good();
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
std::istream is01(if01.rdbuf());
std::istream is02(if02.rdbuf());
@@ -91,20 +89,20 @@ void test04(void)
// in | out
pos01 = is01.tellp();
pos02 = is01.tellp();
- test &= pos01 == pos02;
- // test &= istream::pos_type(0) != pos01; //depricated
+ VERIFY( pos01 == pos02 );
+ // VERIFY( istream::pos_type(0) != pos01 ); //depricated
// in
pos03 = is02.tellp();
pos04 = is02.tellp();
- test &= pos03 == pos04;
- // test &= istream::pos_type(0) != pos03; //depricated
+ VERIFY( pos03 == pos04 );
+ // VERIFY( istream::pos_type(0) != pos03 ); //depricated
// out
pos05 = is03.tellp();
pos06 = is03.tellp();
- test &= pos05 == pos06;
- // test &= istream::pos_type(0) != pos01; //depricated
+ VERIFY( pos05 == pos06 );
+ // VERIFY( istream::pos_type(0) != pos01 ); //depricated
// istream& seekg(pos_type)
// istream& seekg(off_type, ios_base::seekdir)
@@ -118,56 +116,56 @@ void test04(void)
is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate();
pos01 = is01.tellp();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellp();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(10, std::ios_base::cur);
state02 = is02.rdstate();
pos03 = is02.tellp();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellp();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(10, std::ios_base::cur);
state02 = is03.rdstate();
pos05 = is03.tellp();
- test &= pos05 == pos06 + 10;
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 + 10 );
+ VERIFY( state01 == state02 );
pos06 = is03.tellp();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
// beg
state01 = is01.rdstate();
is01.seekg(20, std::ios_base::beg);
state02 = is01.rdstate();
pos01 = is01.tellp();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellp();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(20, std::ios_base::beg);
state02 = is02.rdstate();
pos03 = is02.tellp();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellp();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(20, std::ios_base::beg);
state02 = is03.rdstate();
pos05 = is03.tellp();
- test &= pos05 == pos06 + 10;
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 + 10 );
+ VERIFY( state01 == state02 );
pos06 = is03.tellp();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -184,9 +182,9 @@ void test05(void)
std::ifstream if01(str_lit01);
std::ifstream if02(str_lit01);
std::ifstream if03(str_lit01);
- test &= if01.good();
- test &= if02.good();
- test &= if03.good();
+ VERIFY( if01.good() );
+ VERIFY( if02.good() );
+ VERIFY( if03.good() );
std::stringbuf strbuf01(std::ios_base::in | std::ios_base::out);
if01 >> &strbuf01;
@@ -203,20 +201,20 @@ void test05(void)
// in | out
pos01 = is01.tellp();
pos02 = is01.tellp();
- test &= pos01 == pos02;
- // test &= istream::pos_type(0) != pos01; // deprecated
+ VERIFY( pos01 == pos02 );
+ // VERIFY( istream::pos_type(0) != pos01 ); // deprecated
// in
pos03 = is02.tellp();
pos04 = is02.tellp();
- test &= pos03 == pos04;
- // test &= istream::pos_type(0) != pos03; // deprecated
+ VERIFY( pos03 == pos04 );
+ // VERIFY( istream::pos_type(0) != pos03 ); // deprecated
// out
pos05 = is03.tellp();
pos06 = is03.tellp();
- test &= pos05 == pos06;
- // test &= istream::pos_type(0) != pos01; //deprecated
+ VERIFY( pos05 == pos06 );
+ // VERIFY( istream::pos_type(0) != pos01 ); //deprecated
// istream& seekg(pos_type)
// istream& seekg(off_type, ios_base::seekdir)
@@ -230,56 +228,56 @@ void test05(void)
is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate();
pos01 = is01.tellp();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellp();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(10, std::ios_base::cur);
state02 = is02.rdstate();
pos03 = is02.tellp();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellp();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(10, std::ios_base::cur);
state02 = is03.rdstate();
pos05 = is03.tellp();
- test &= pos05 == pos06; // as only out buffer
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 ); // as only out buffer
+ VERIFY( state01 == state02 );
pos06 = is03.tellp();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
// beg
state01 = is01.rdstate();
is01.seekg(20, std::ios_base::beg);
state02 = is01.rdstate();
pos01 = is01.tellp();
- test &= pos01 == pos02 + 10;
- test &= state01 == state02;
+ VERIFY( pos01 == pos02 + 10 );
+ VERIFY( state01 == state02 );
pos02 = is01.tellp();
- test &= pos02 == pos01;
+ VERIFY( pos02 == pos01 );
state01 = is02.rdstate();
is02.seekg(20, std::ios_base::beg);
state02 = is02.rdstate();
pos03 = is02.tellp();
- test &= pos03 == pos04 + 10;
- test &= state01 == state02;
+ VERIFY( pos03 == pos04 + 10 );
+ VERIFY( state01 == state02 );
pos04 = is02.tellp();
- test &= pos03 == pos04;
+ VERIFY( pos03 == pos04 );
state01 = is03.rdstate();
is03.seekg(20, std::ios_base::beg);
state02 = is03.rdstate();
pos05 = is03.tellp();
- test &= pos05 == pos06; // as only out buffer
- test &= state01 == state02;
+ VERIFY( pos05 == pos06 ); // as only out buffer
+ VERIFY( state01 == state02 );
pos06 = is03.tellp();
- test &= pos05 == pos06;
+ VERIFY( pos05 == pos06 );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc b/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
index e3d1693..657aa79 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_unformatted.cc
@@ -20,9 +20,7 @@
#include <sstream>
#include <ostream>
-#ifdef DEBUG_ASSERT
- #include <assert.h>
-#endif
+#include <debug_assert.h>
void test01()
@@ -36,13 +34,13 @@ void test01()
ostringstream ost;
pos_type pos1;
pos1 = ost.tellp();
- test &= pos1 == pos_type(-1);
+ VERIFY( pos1 == pos_type(-1) );
ost << "RZA ";
pos1 = ost.tellp();
- test &= pos1 == pos_type(4);
+ VERIFY( pos1 == pos_type(4) );
ost << "ghost dog: way of the samurai";
pos1 = ost.tellp();
- test &= pos1 == pos_type(33);
+ VERIFY( pos1 == pos_type(33) );
#ifdef DEBUG_ASSERT
assert(test);
diff --git a/libstdc++-v3/testsuite/27_io/streambuf.cc b/libstdc++-v3/testsuite/27_io/streambuf.cc
index bdd4f16..8b7989f 100644
--- a/libstdc++-v3/testsuite/27_io/streambuf.cc
+++ b/libstdc++-v3/testsuite/27_io/streambuf.cc
@@ -31,9 +31,7 @@
#include <streambuf>
#include <ostream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
class testbuf : public std::streambuf
{
@@ -50,12 +48,12 @@ public:
check_pointers()
{
bool test = true;
- test &= this->eback() == NULL;
- test &= this->gptr() == NULL;
- test &= this->egptr() == NULL;
- test &= this->pbase() == NULL;
- test &= this->pptr() == NULL;
- test &= this->epptr() == NULL;
+ VERIFY( this->eback() == NULL );
+ VERIFY( this->gptr() == NULL );
+ VERIFY( this->egptr() == NULL );
+ VERIFY( this->pbase() == NULL );
+ VERIFY( this->pptr() == NULL );
+ VERIFY( this->epptr() == NULL );
return test;
}
@@ -103,33 +101,33 @@ void test01()
// default ctor initializes
// - all pointer members to null pointers
// - locale to current global locale
- test &= buf01.check_pointers();
- test &= buf01.getloc() == std::locale();
+ VERIFY( buf01.check_pointers() );
+ VERIFY( buf01.getloc() == std::locale() );
// 27.5.2.3.1 get area
// 27.5.2.2.3 get area
// 27.5.2.4.3 get area
int i01 = 3;
buf01.pub_setg(lit01, lit01, (lit01 + i01));
- test &= i01 == buf01.in_avail();
+ VERIFY( i01 == buf01.in_avail() );
- test &= buf01.pub_uflow() == lit01[0];
- test &= buf01.sgetc() == traits_type::to_int_type(lit01[1]);
- test &= buf01.pub_uflow() == lit01[1];
- test &= buf01.sgetc() == traits_type::to_int_type(lit01[2]);
- test &= buf01.pub_uflow() == lit01[2];
- test &= buf01.sgetc() == traits_type::eof();
+ VERIFY( buf01.pub_uflow() == lit01[0] );
+ VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[1]) );
+ VERIFY( buf01.pub_uflow() == lit01[1] );
+ VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[2]) );
+ VERIFY( buf01.pub_uflow() == lit01[2] );
+ VERIFY( buf01.sgetc() == traits_type::eof() );
// pbackfail
buf01.pub_setg(lit01, lit01, (lit01 + i01));
- test &= i01 == buf01.in_avail();
+ VERIFY( i01 == buf01.in_avail() );
int_type intt01 = traits_type::to_int_type('b');
- test &= traits_type::eof() == buf01.pub_pbackfail(intt01);
+ VERIFY( traits_type::eof() == buf01.pub_pbackfail(intt01) );
// overflow
- test &= traits_type::eof() == buf01.pub_overflow(intt01);
- test &= traits_type::eof() == buf01.pub_overflow();
- test &= buf01.sgetc() == traits_type::to_int_type(lit01[0]);
+ VERIFY( traits_type::eof() == buf01.pub_overflow(intt01) );
+ VERIFY( traits_type::eof() == buf01.pub_overflow() );
+ VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[0]) );
// sputn/xsputn
char* lit02 = "isotope 217: the unstable molecule on thrill jockey";
@@ -139,16 +137,16 @@ void test01()
buf01.pub_setp(carray, (carray + i02));
buf01.sputn(lit02, 0);
- test &= carray[0] == 0;
- test &= lit02[0] == 'i';
+ VERIFY( carray[0] == 0 );
+ VERIFY( lit02[0] == 'i' );
buf01.sputn(lit02, 1);
- test &= lit02[0] == carray[0];
- test &= lit02[1] == 's';
- test &= carray[1] == 0;
+ VERIFY( lit02[0] == carray[0] );
+ VERIFY( lit02[1] == 's' );
+ VERIFY( carray[1] == 0 );
buf01.sputn(lit02 + 1, 10);
- test &= memcmp(lit02, carray, 10) == 0;
+ VERIFY( memcmp(lit02, carray, 10) == 0 );
buf01.sputn(lit02 + 11, 20);
- test &= memcmp(lit02, carray, 30) == 0;
+ VERIFY( memcmp(lit02, carray, 30) == 0 );
#ifdef DEBUG_ASSERT
assert(test);
@@ -168,8 +166,8 @@ void test02()
// default ctor initializes
// - all pointer members to null pointers
// - locale to current global locale
- test &= buf01.check_pointers();
- test &= buf01.getloc() == std::locale();
+ VERIFY( buf01.check_pointers() );
+ VERIFY( buf01.getloc() == std::locale() );
// 27.5.2.2.5 Put area
size_t i01 = traits_type::length(lit01);
@@ -178,13 +176,13 @@ void test02()
buf01.pub_setg(lit01, lit01, lit01 + i01);
buf01.sgetn(carray01, 0);
- test &= carray01[0] == 0;
+ VERIFY( carray01[0] == 0 );
buf01.sgetn(carray01, 1);
- test &= carray01[0] == 'c';
+ VERIFY( carray01[0] == 'c' );
buf01.sgetn(carray01 + 1, i01 - 1);
- test &= carray01[0] == 'c';
- test &= carray01[1] == 'h';
- test &= carray01[i01 - 1] == 'k';
+ VERIFY( carray01[0] == 'c' );
+ VERIFY( carray01[1] == 'h' );
+ VERIFY( carray01[i01 - 1] == 'k' );
#ifdef DEBUG_ASSERT
assert(test);
@@ -227,7 +225,7 @@ void test03()
test01 += print('x');
test01 += print("pipo");
- test &= test01 == control01;
+ VERIFY( test01 == control01 );
#ifdef DEBUG_ASSERT
assert(test);
#endif
diff --git a/libstdc++-v3/testsuite/27_io/stringbuf.cc b/libstdc++-v3/testsuite/27_io/stringbuf.cc
index 20deda4..556b0c0 100644
--- a/libstdc++-v3/testsuite/27_io/stringbuf.cc
+++ b/libstdc++-v3/testsuite/27_io/stringbuf.cc
@@ -19,9 +19,7 @@
// USA.
#include <sstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
std::string str_01("mykonos. . . or what?");
std::string str_02("paris, or sainte-maxime?");
@@ -59,20 +57,20 @@ bool test03() {
std::string str_tmp;
//stringbuf::str()
- test &= strb_01.str() == str_01;
- test &= strb_02.str() == str_02;
- test &= strb_03.str() == str_03;
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( strb_02.str() == str_02 );
+ VERIFY( strb_03.str() == str_03 );
//stringbuf::str(string&)
strb_03.str("none of the above, go to the oberoi in cairo, egypt.");
strb_03.str(str_01);
std::streamsize d1 = strb_01.in_avail();
std::streamsize d2 = strb_03.in_avail();
- test &= d1; // non-zero
- test &= !d2; // zero, cuz ios_base::out
- test &= d1 != d2; //these should be the same
- test &= str_01.length() == d1;
- test &= strb_01.str() == strb_03.str(); //ditto
+ VERIFY( d1 ); // non-zero
+ VERIFY( !d2 ); // zero, cuz ios_base::out
+ VERIFY( d1 != d2 ); //these should be the same
+ VERIFY( str_01.length() == d1 );
+ VERIFY( strb_01.str() == strb_03.str() ); //ditto
#ifdef DEBUG_ASSERT
assert(test);
@@ -98,50 +96,50 @@ bool test04() {
// int in_avail()
strmof_1 = strb_01.in_avail();
strmof_2 = strb_02.in_avail();
- test &= strmof_1 != strmof_2;
- test &= strmof_1 == str_01.length();
- test &= strmof_2 == str_02.length();
+ VERIFY( strmof_1 != strmof_2 );
+ VERIFY( strmof_1 == str_01.length() );
+ VERIFY( strmof_2 == str_02.length() );
strmof_1 = strb_03.in_avail();
- test &= strmof_1 == 0; // zero cuz write-only, or eof()? zero, from showmany
+ VERIFY( strmof_1 == 0 ); // zero cuz write-only, or eof()? zero, from showmany
// int_type sbumpc()
// if read_cur not avail, return uflow(), else return *read_cur & increment
int_type c1 = strb_01.sbumpc();
int_type c2 = strb_02.sbumpc();
- test &= c1 != c2;
- test &= c1 == str_01[0];
- test &= c2 == str_02[0]; //should equal first letter at this point
+ VERIFY( c1 != c2 );
+ VERIFY( c1 == str_01[0] );
+ VERIFY( c2 == str_02[0] ); //should equal first letter at this point
int_type c3 = strb_01.sbumpc();
int_type c4 = strb_02.sbumpc();
- test &= c1 != c2;
- test &= c1 != c3;
- test &= c2 != c4;
+ VERIFY( c1 != c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( c2 != c4 );
int_type c5 = strb_03.sbumpc();
- test &= c5 == traits_type::eof();
+ VERIFY( c5 == traits_type::eof() );
// int_type sgetc()
// if read_cur not avail, return uflow(), else return *read_cur
int_type c6 = strb_01.sgetc();
int_type c7 = strb_02.sgetc();
- test &= c6 != c3;
- test &= c7 != c4;
+ VERIFY( c6 != c3 );
+ VERIFY( c7 != c4 );
int_type c8 = strb_01.sgetc();
int_type c9 = strb_02.sgetc();
- test &= c6 == c8;
- test &= c7 == c9;
+ VERIFY( c6 == c8 );
+ VERIFY( c7 == c9 );
c5 = strb_03.sgetc();
- test &= c5 == traits_type::eof();
+ VERIFY( c5 == traits_type::eof() );
// int_type snextc()
// calls sbumpc and if sbumpc != eof, return sgetc
c6 = strb_01.snextc();
c7 = strb_02.snextc();
- test &= c6 != c8;
- test &= c7 != c9;
- test &= c6 == str_01[3];
- test &= c7 == str_02[3]; //should equal fourth letter at this point
+ VERIFY( c6 != c8 );
+ VERIFY( c7 != c9 );
+ VERIFY( c6 == str_01[3] );
+ VERIFY( c7 == str_02[3] ); //should equal fourth letter at this point
c5 = strb_03.snextc();
- test &= c5 == traits_type::eof();
+ VERIFY( c5 == traits_type::eof() );
// int showmanyc
// streamsize sgetn(char_type *s, streamsize n)
@@ -151,27 +149,27 @@ bool test04() {
strmsz_1 = strb_01.in_avail();
strmsz_2 = strb_02.in_avail();
test = strmsz_1 != strmsz_2;
- test &= strmsz_1 != str_01.length();
- test &= strmsz_2 != str_02.length(); //because now we've moved into string
+ VERIFY( strmsz_1 != str_01.length() );
+ VERIFY( strmsz_2 != str_02.length() ); //because now we've moved into string
char carray1[11] = "";
strmsz_1 = strb_01.sgetn(carray1, 10);
char carray2[20] = "";
strmsz_2 = strb_02.sgetn(carray2, 10);
- test &= strmsz_1 == strmsz_2;
- test &= strmsz_1 == 10;
+ VERIFY( strmsz_1 == strmsz_2 );
+ VERIFY( strmsz_1 == 10 );
c1 = strb_01.sgetc();
c2 = strb_02.sgetc();
- test &= c6 == c1; //just by co-incidence both o's
- test &= c7 != c2; // n != i
- test &= c1 == str_01[13];
- test &= c2 == str_02[13]; //should equal fourteenth letter at this point
+ VERIFY( c6 == c1 ); //just by co-incidence both o's
+ VERIFY( c7 != c2 ); // n != i
+ VERIFY( c1 == str_01[13] );
+ VERIFY( c2 == str_02[13] ); //should equal fourteenth letter at this point
strmsz_1 = strb_03.sgetn(carray1, 10);
- test &= !strmsz_1; //zero
+ VERIFY( !strmsz_1 ); //zero
strmsz_1 = strb_02.in_avail();
strmsz_2 = strb_02.sgetn(carray2, strmsz_1 + 5);
- test &= strmsz_1 == strmsz_2; //write off the end
+ VERIFY( strmsz_1 == strmsz_2 ); //write off the end
c4 = strb_02.sgetc(); // should be EOF
- test &= c4 == traits_type::eof();
+ VERIFY( c4 == traits_type::eof() );
// PUT
// int_type sputc(char_type c)
@@ -181,12 +179,12 @@ bool test04() {
std::string::size_type sz1 = strb_03.str().length();
c1 = strb_03.sputc('a');
std::string::size_type sz2 = strb_03.str().length();
- test &= sz1 == sz2; //cuz inserting at out_cur, which is at beg to start
+ VERIFY( sz1 == sz2 ); //cuz inserting at out_cur, which is at beg to start
c2 = strb_03.sputc('b');
- test &= c1 != c2;
- test &= strb_03.str() != str_01;
+ VERIFY( c1 != c2 );
+ VERIFY( strb_03.str() != str_01 );
c3 = strb_02.sputc('a'); // should be EOF because this is read-only
- test &= c3 == traits_type::eof();
+ VERIFY( c3 == traits_type::eof() );
// streamsize sputn(const char_typs* s, streamsize n)
// write up to n chars to out_cur from s, returning number assigned
@@ -195,20 +193,20 @@ bool test04() {
sz1 = str_tmp.length();
strmsz_1 = strb_03.sputn("racadabras", 10);//"abracadabras or what?"
sz2 = strb_03.str().length();
- test &= sz1 == sz2; //shouldn't have changed length
- test &= strmsz_1 == 10;
- test &= str_tmp != strb_03.str();
+ VERIFY( sz1 == sz2 ); //shouldn't have changed length
+ VERIFY( strmsz_1 == 10 );
+ VERIFY( str_tmp != strb_03.str() );
strmsz_2 = strb_03.sputn(", i wanna reach out and", 10);
- test &= strmsz_1 == strmsz_2; // should re-allocate, copy 10 chars.
- test &= strmsz_1 == 10;
- test &= strmsz_2 == 10;
+ VERIFY( strmsz_1 == strmsz_2 ); // should re-allocate, copy 10 chars.
+ VERIFY( strmsz_1 == 10 );
+ VERIFY( strmsz_2 == 10 );
sz2 = strb_03.str().length();
- test &= sz1 != sz2; // need to change length
- test &= str_tmp != strb_03.str();
+ VERIFY( sz1 != sz2 ); // need to change length
+ VERIFY( str_tmp != strb_03.str() );
str_tmp = strb_02.str();
strmsz_1 = strb_02.sputn("racadabra", 10);
- test &= strmsz_1 == 0;
- test &= str_tmp == strb_02.str();
+ VERIFY( strmsz_1 == 0 );
+ VERIFY( str_tmp == strb_02.str() );
// PUTBACK
// int_type pbfail(int_type c)
@@ -230,22 +228,22 @@ bool test04() {
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sputbackc('z');//"mykonos. . .zor what?"
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= c3 == c2;
- test &= strb_01.str() == std::string("mykonos. . .zor what?");
- test &= str_tmp.size() == strb_01.str().size();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( strb_01.str() == std::string("mykonos. . .zor what?") );
+ VERIFY( str_tmp.size() == strb_01.str().size() );
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
strmsz_1 = strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sputbackc('z');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= c3 != c2;
- test &= c1 == c3;
- test &= c2 == traits_type::eof();
- test &= strb_01.str() == str_tmp;
- test &= str_tmp.size() == strb_01.str().size();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 != c2 );
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == traits_type::eof() );
+ VERIFY( strb_01.str() == str_tmp );
+ VERIFY( str_tmp.size() == strb_01.str().size() );
// test for replacing char with identical one
strb_01.str(str_01); //reset
strmsz_1 = strb_01.in_avail();
@@ -254,15 +252,15 @@ bool test04() {
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
c2 = strb_01.sputbackc('y');//"mykonos. . . or what?"
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= c3 == c2;
- test &= c1 != c3;
- test &= strb_01.str() == str_01;
- test &= str_01.size() == strb_01.str().size();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
//test for ios_base::out
strmsz_2 = strb_03.in_avail();
c4 = strb_03.sputbackc('x');
- test &= c4 == traits_type::eof();
+ VERIFY( c4 == traits_type::eof() );
// int_type sungetc()
// if in_cur not avail, return pbackfail(), else decrement and
@@ -274,24 +272,24 @@ bool test04() {
c1 = strb_01.sgetc(); //"mykonos. . . 'o'r what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= c3 == c2;
- test &= c1 != c3;
- test &= c2 == ' ';
- test &= strb_01.str() == str_01;
- test &= str_01.size() == strb_01.str().size();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( c2 == ' ' );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
//test for _in_cur == _in_beg
strb_01.str(str_tmp);
strmsz_1 = strb_01.in_avail();
c1 = strb_01.sgetc(); //"'m'ykonos. . . or what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= c3 != c2;
- test &= c1 == c3;
- test &= c2 == traits_type::eof();
- test &= strb_01.str() == str_01;
- test &= str_01.size() == strb_01.str().size();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 != c2 );
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == traits_type::eof() );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
// test for replacing char with identical one
strb_01.str(str_01); //reset
strmsz_1 = strb_01.in_avail();
@@ -300,15 +298,15 @@ bool test04() {
c1 = strb_01.sgetc(); //"my'k'onos. . . or what?"
c2 = strb_01.sungetc();//"mykonos. . . or what?"
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= c3 == c2;
- test &= c1 != c3;
- test &= strb_01.str() == str_01;
- test &= str_01.size() == strb_01.str().size();
+ VERIFY( c1 != c2 );
+ VERIFY( c3 == c2 );
+ VERIFY( c1 != c3 );
+ VERIFY( strb_01.str() == str_01 );
+ VERIFY( str_01.size() == strb_01.str().size() );
//test for ios_base::out
strmsz_2 = strb_03.in_avail();
c4 = strb_03.sungetc();
- test &= c4 == traits_type::eof();
+ VERIFY( c4 == traits_type::eof() );
// BUFFER MANAGEMENT & POSITIONING
// sync
@@ -321,9 +319,9 @@ bool test04() {
// pubsetbuf(char_type* s, streamsize n)
str_tmp = std::string("naaaah, go to cebu");
strb_01.pubsetbuf(const_cast<char*> (str_tmp.c_str()), str_tmp.size());
- test &= strb_01.str() == str_tmp;
+ VERIFY( strb_01.str() == str_tmp );
strb_01.pubsetbuf(0,0);
- test &= strb_01.str() == str_tmp;
+ VERIFY( strb_01.str() == str_tmp );
// seekoff
// pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
@@ -339,31 +337,31 @@ bool test04() {
//beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
off_1 = pt_1;
- test &= off_1 >= 0;
+ VERIFY( off_1 >= 0 );
c1 = strb_01.snextc(); //current in pointer +1
- test &= c1 == 'o';
+ VERIFY( c1 == 'o' );
c2 = strb_01.sputc('x'); //test current out pointer
str_tmp = std::string("myxonos. . . or what?");
- test &= strb_01.str() == str_tmp;
+ VERIFY( strb_01.str() == str_tmp );
//cur
pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
off_1 = pt_1;
- test &= off_1 == -1; // can't seekoff for in and out + cur in sstreams
+ VERIFY( off_1 == -1 ); // can't seekoff for in and out + cur in sstreams
pt_1 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
off_1 = pt_1;
pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
off_2 = pt_2;
- test &= off_2 == off_1 + 2;
+ VERIFY( off_2 == off_1 + 2 );
c1 = strb_01.snextc(); //current in pointer + 1
- test &= c1 == ' ';
+ VERIFY( c1 == ' ' );
c2 = strb_01.sputc('x'); //test current out pointer
str_tmp = std::string("myxxnos. . . or what?");
- test &= strb_01.str() == str_tmp;
+ VERIFY( strb_01.str() == str_tmp );
//end
pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
off_1 = pt_2;
- test &= off_1 == -1; // not a valid position
- test &= strb_01.str() == str_tmp;
+ VERIFY( off_1 == -1 ); // not a valid position
+ VERIFY( strb_01.str() == str_tmp );
// end part two (from the filebuf tests)
strb_01.pubseekoff(0, std::ios_base::end);
strmsz_1 = strb_01.in_avail(); // 0 cuz at the end
@@ -371,16 +369,16 @@ bool test04() {
c2 = strb_01.sungetc();
strmsz_2 = strb_01.in_avail(); // 1
c3 = strb_01.sgetc();
- test &= c1 != c2;
- test &= strmsz_2 != strmsz_1;
- test &= strmsz_2 == 1;
+ VERIFY( c1 != c2 );
+ VERIFY( strmsz_2 != strmsz_1 );
+ VERIFY( strmsz_2 == 1 );
// end part three
strmsz_1 = strb_01.str().size();
strmsz_2 = strb_01.sputn(" ravi shankar meets carlos santana in LoHa", 90);
strb_01.pubseekoff(0, std::ios_base::end);
strb_01.sputc('<');
str_tmp = strb_01.str();
- test &= str_tmp.size() == strmsz_1 + strmsz_2 + 1;
+ VERIFY( str_tmp.size() == strmsz_1 + strmsz_2 + 1 );
// IN
// OUT
@@ -394,23 +392,23 @@ bool test04() {
//beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
off_1 = pt_1;
- test &= off_1 >= 0;
+ VERIFY( off_1 >= 0 );
pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
off_1 = pt_1;
c1 = strb_01.snextc(); //current in pointer +1
- test &= c1 == 'o';
+ VERIFY( c1 == 'o' );
c2 = strb_01.sputc('x'); //test current out pointer
str_tmp = std::string("myxonos. . . or what?");
- test &= strb_01.str() == str_tmp;
+ VERIFY( strb_01.str() == str_tmp );
strb_01.pubsync(); //resets pointers
pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out);
off_2 = pt_2;
- test &= off_1 == off_2;
+ VERIFY( off_1 == off_2 );
c3 = strb_01.snextc(); //current in pointer +1
- test &= c1 == c3;
+ VERIFY( c1 == c3 );
c2 = strb_01.sputc('x'); //test current out pointer
str_tmp = std::string("myxonos. . . or what?");
- test &= strb_01.str() == str_tmp;
+ VERIFY( strb_01.str() == str_tmp );
// VIRTUALS (indirectly tested)
// underflow
diff --git a/libstdc++-v3/testsuite/27_io/stringstream.cc b/libstdc++-v3/testsuite/27_io/stringstream.cc
index fc72e95..361e087 100644
--- a/libstdc++-v3/testsuite/27_io/stringstream.cc
+++ b/libstdc++-v3/testsuite/27_io/stringstream.cc
@@ -32,12 +32,11 @@
#include <vector>
#include <string>
#include <sstream>
-#ifdef DEBUG_ASSERT
-#include <assert.h>
-#endif
+#include <debug_assert.h>
// 01: sanity checks for strings, stringbufs
-std::string test01()
+std::string
+test01()
{
bool test = false;
@@ -47,7 +46,7 @@ std::string test01()
std::string::iterator __i_end = str01.end();
std::string::size_type len = str01.size();
test = __i_start == __i_end;
- test &= len == 0;
+ VERIFY( len == 0 );
// Full string sanity check.
std::string str02("these golden days, i spend waiting for you:\n
@@ -55,8 +54,8 @@ std::string test01()
__i_start = str02.begin();
__i_end = str02.end();
len = str02.size();
- test &= __i_start != __i_end;
- test &= len != 0;
+ VERIFY( __i_start != __i_end );
+ VERIFY( len != 0 );
// Test an empty ostring stream for sanity.
std::ostringstream ostrstream0;
@@ -64,16 +63,17 @@ std::string test01()
__i_start = str03.begin();
__i_end = str03.end();
len = str03.size();
- test &= __i_start == __i_end;
- test &= len == 0;
- test &= str01 == str03;
+ VERIFY( __i_start == __i_end );
+ VERIFY( len == 0 );
+ VERIFY( str01 == str03 );
return str02;
}
-bool test02(void) {
-
+int
+test02()
+{
bool test = true;
//
@@ -96,8 +96,8 @@ bool test02(void) {
std::string msg01 = ostrst01.str();
std::string msg02 = ostrst02.str();
- test &= msg01 != msg02;
- test &= msg02 != blank;
+ VERIFY( msg01 != msg02 );
+ VERIFY( msg02 != blank );
//
// 2: istringstream
@@ -113,10 +113,10 @@ bool test02(void) {
istrst01 >> i2 >> pi2 >> d2 >> pd2;
//istrst01 >> i2;
//istrst01 >> pi2;
- test &= i2 == i;
- test &= d2 == d;
- test &= pd2 == pd;
- test &= pi2 == pi;
+ VERIFY( i2 == i );
+ VERIFY( d2 == d );
+ VERIFY( pd2 == pd );
+ VERIFY( pi2 == pi );
#endif
// stringstream
@@ -125,7 +125,7 @@ bool test02(void) {
std::stringstream ss1(str1, std::ios_base::in|std::ios_base::out);
std::stringstream ss2(str3, std::ios_base::in|std::ios_base::out);
- return test;
+ return 0;
}
// user-reported error
@@ -135,25 +135,29 @@ public:
derived_oss() : std::ostringstream() {}
};
-bool test03()
+int
+test03()
{
bool test = true;
derived_oss yy;
yy << "buena vista social club\n";
- test &= yy.str() == std::string("buena vista social club\n");
+ VERIFY( yy.str() == std::string("buena vista social club\n") );
#ifdef DEBUG_ASSERT
assert(test);
#endif
- return test;
+ return 0;
}
-int main()
+int
+main()
{
test01();
test02();
test03();
+
+ return 0;
}
diff --git a/libstdc++-v3/testsuite/27_io/wide_stream_objects.cc b/libstdc++-v3/testsuite/27_io/wide_stream_objects.cc
index 5901d08..91cb21b 100644
--- a/libstdc++-v3/testsuite/27_io/wide_stream_objects.cc
+++ b/libstdc++-v3/testsuite/27_io/wide_stream_objects.cc
@@ -71,13 +71,15 @@
#include <cwchar>
#include <cwctype>
#endif
+#include <debug_assert.h>
// Include iostream last, just to make is as difficult as possible to
// properly initialize the standard iostream objects.
#include <iostream>
// Make sure all the standard streams are defined.
-bool test01()
+int
+test01()
{
bool test = true;
@@ -88,18 +90,20 @@ bool test01()
wtraits_type::copy(array2, L"testing istream", wi);
std::wcout << L"testing wcout" << std::endl;
std::wcerr << L"testing wcerr" << std::endl;
- test &= std::wcerr.flags() & std::ios_base::unitbuf;
+ VERIFY( std::wcerr.flags() & std::ios_base::unitbuf );
std::wclog << L"testing wclog" << std::endl;
// std::wcin >> array2; // requires somebody to type something in.
- test &= std::wcin.tie() == &std::wcout;
+ VERIFY( std::wcin.tie() == &std::wcout );
#endif
- return test;
+ return 0;
}
-int main(void)
+int
+main()
{
test01();
+
return 0;
}