From 51077e49f56e1d1677e065f18a65881dc47bbe88 Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Thu, 2 Sep 2004 13:19:50 +0000 Subject: [PATCH] Fixed CW problems and refactored fail cases [SVN r24870] --- value_init_test.cpp | 9 --------- value_init_test_fail1.cpp | 37 +++++++++++++++++++++++++++++++++++++ value_init_test_fail2.cpp | 36 ++++++++++++++++++++++++++++++++++++ value_init_test_fail3.cpp | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 9 deletions(-) create mode 100644 value_init_test_fail1.cpp create mode 100644 value_init_test_fail2.cpp create mode 100644 value_init_test_fail3.cpp diff --git a/value_init_test.cpp b/value_init_test.cpp index c8f5ce5..8bf5ff1 100644 --- a/value_init_test.cpp +++ b/value_init_test.cpp @@ -76,23 +76,14 @@ void test ( T const& y, T const& z ) T& x_c_ref = x_c ; x_c_ref = z ; BOOST_TEST ( x_c == z ) ; - #ifdef PRODUCE_ERROR_1 - get(x_c) = z ; // this should produce an ERROR - #endif boost::value_initialized cx ; BOOST_TEST ( y == cx ) ; BOOST_TEST ( y == get(cx) ) ; - #ifdef PRODUCE_ERROR_2 - get(cx) = z ; // this should produce an ERROR - #endif boost::value_initialized const cx_c ; BOOST_TEST ( y == cx_c ) ; BOOST_TEST ( y == get(cx_c) ) ; - #ifdef PRODUCE_ERROR_3 - get(cx_c) = z ; // this should produce an ERROR - #endif } int test_main(int, char **) diff --git a/value_init_test_fail1.cpp b/value_init_test_fail1.cpp new file mode 100644 index 0000000..8904732 --- /dev/null +++ b/value_init_test_fail1.cpp @@ -0,0 +1,37 @@ +// (C) 2002, Fernando Luis Cacciola Carballal. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Test program for "boost/utility/value_init.hpp" +// +// Initial: 21 Agu 2002 + +#include +#include + +#include "boost/utility/value_init.hpp" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "boost/test/minimal.hpp" + +int test_main(int, char **) +{ + boost::value_initialized const x_c ; + + get(x_c) = 1234 ; // this should produce an ERROR + + return 0; +} + + +unsigned int expected_failures = 0; + + + + + diff --git a/value_init_test_fail2.cpp b/value_init_test_fail2.cpp new file mode 100644 index 0000000..1f40061 --- /dev/null +++ b/value_init_test_fail2.cpp @@ -0,0 +1,36 @@ +// (C) 2002, Fernando Luis Cacciola Carballal. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Test program for "boost/utility/value_init.hpp" +// +// Initial: 21 Agu 2002 + +#include +#include + +#include "boost/utility/value_init.hpp" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "boost/test/minimal.hpp" + +int test_main(int, char **) +{ + boost::value_initialized cx ; + + get(cx) = 1234 ; // this should produce an ERROR + + return 0; +} + +unsigned int expected_failures = 0; + + + + + diff --git a/value_init_test_fail3.cpp b/value_init_test_fail3.cpp new file mode 100644 index 0000000..72fd761 --- /dev/null +++ b/value_init_test_fail3.cpp @@ -0,0 +1,37 @@ +// (C) 2002, Fernando Luis Cacciola Carballal. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Test program for "boost/utility/value_init.hpp" +// +// Initial: 21 Agu 2002 + +#include +#include + +#include "boost/utility/value_init.hpp" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "boost/test/minimal.hpp" + +int test_main(int, char **) +{ + boost::value_initialized const cx_c ; + + get(cx_c) = 1234 ; // this should produce an ERROR + + return 0; +} + + +unsigned int expected_failures = 0; + + + + +