|
Boost-Commit : |
From: grafikrobot_at_[hidden]
Date: 2008-04-13 18:12:13
Author: grafik
Date: 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
New Revision: 44376
URL: http://svn.boost.org/trac/boost/changeset/44376
Log:
Move array test into canonical test subdir structure.
Added:
trunk/libs/array/test/
trunk/libs/array/test/Jamfile.v2 (contents, props changed)
trunk/libs/array/test/array0.cpp
- copied unchanged from r44373, /trunk/libs/array/array0.cpp
trunk/libs/array/test/array1.cpp
- copied unchanged from r44373, /trunk/libs/array/array1.cpp
trunk/libs/array/test/array2.cpp
- copied unchanged from r44373, /trunk/libs/array/array2.cpp
trunk/libs/array/test/array3.cpp
- copied unchanged from r44373, /trunk/libs/array/array3.cpp
trunk/libs/array/test/array4.cpp
- copied unchanged from r44373, /trunk/libs/array/array4.cpp
trunk/libs/array/test/array5.cpp
- copied unchanged from r44373, /trunk/libs/array/array5.cpp
trunk/libs/array/test/print.hpp
- copied unchanged from r44373, /trunk/libs/array/print.hpp
Removed:
trunk/libs/array/array0.cpp
trunk/libs/array/array1.cpp
trunk/libs/array/array2.cpp
trunk/libs/array/array3.cpp
trunk/libs/array/array4.cpp
trunk/libs/array/array5.cpp
trunk/libs/array/print.hpp
Text files modified:
trunk/status/Jamfile.v2 | 29 ++++++-----------------------
1 files changed, 6 insertions(+), 23 deletions(-)
Deleted: trunk/libs/array/array0.cpp
==============================================================================
--- trunk/libs/array/array0.cpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,107 +0,0 @@
-/* tests for using class array<> specialization for size 0
- * (C) Copyright Alisdair Meredith 2006.
- * 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)
- */
-
-#include <string>
-#include <iostream>
-#include <boost/array.hpp>
-
-namespace {
-unsigned int failed_tests = 0;
-
-void fail_test( const char * reason ) {
- ++failed_tests;
- std::cerr << "Test failure " << failed_tests << ": " << reason << std::endl;
-}
-
-template< class T >
-void BadValue( const T & )
-{
- fail_test( "Unexpected value" );
-}
-
-template< class T >
-void RunTests()
-{
- typedef boost::array< T, 0 > test_type;
-
- // Test value and aggegrate initialization
- test_type test_case = {};
- const boost::array< T, 0 > const_test_case = test_type();
-
- test_case.assign( T() );
-
- // front/back and operator[] must compile, but calling them is undefined
- // Likewise, all tests below should evaluate to false, avoiding undefined behaviour
- if( !test_case.empty() ) {
- BadValue( test_case.front() );
- }
-
- if( !const_test_case.empty() ) {
- BadValue( const_test_case.back() );
- }
-
- if( test_case.size() > 0 ) {
- BadValue( test_case[ 0 ] );
- }
-
- if( const_test_case.max_size() > 0 ) {
- BadValue( const_test_case[ 0 ] );
- }
-
- // Assert requirements of TR1 6.2.2.4
- if( test_case.begin() != test_case.end() ) {
- fail_test( "Not an empty range" );
- }
- if( const_test_case.begin() != const_test_case.end() ) {
- fail_test( "Not an empty range" );
- }
-
- if( test_case.begin() == const_test_case.begin() ) {
- fail_test( "iterators for different containers are not distinct" );
- }
-
- if( test_case.data() == const_test_case.data() ) {
- // Value of data is unspecified in TR1, so no requirement this test pass or fail
- // However, it must compile!
- }
-
-
- // Check can safely use all iterator types with std algorithms
- std::for_each( test_case.begin(), test_case.end(), BadValue< T > );
- std::for_each( test_case.rbegin(), test_case.rend(), BadValue< T > );
- std::for_each( const_test_case.begin(), const_test_case.end(), BadValue< T > );
- std::for_each( const_test_case.rbegin(), const_test_case.rend(), BadValue< T > );
-
- // Check swap is well formed
- std::swap( test_case, test_case );
-
- // Check assigment operator and overloads are well formed
- test_case = const_test_case;
-
- // Confirm at() throws the std lib defined exception
- try {
- BadValue( test_case.at( 0 ) );
- } catch ( const std::out_of_range & ) {
- }
-
- try {
- BadValue( const_test_case.at( 0 ) );
- } catch ( const std::out_of_range & ) {
- }
-}
-
-}
-
-int main()
-{
- RunTests< bool >();
- RunTests< void * >();
- RunTests< long double >();
- RunTests< std::string >();
- return failed_tests;
-}
-
Deleted: trunk/libs/array/array1.cpp
==============================================================================
--- trunk/libs/array/array1.cpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,58 +0,0 @@
-/* simple example for using class array<>
- *
- * (C) Copyright Nicolai M. Josuttis 2001.
- * 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)
- *
- * Changelog:
- * 20 Jan 2001 - Removed boolalpha use since stock GCC doesn't support it
- * (David Abrahams)
- */
-
-#include <iostream>
-#include <boost/array.hpp>
-
-int main()
-{
- // define special type name
- typedef boost::array<float,6> Array;
-
- // create and initialize an array
- Array a = { { 42 } };
-
- // access elements
- for (unsigned i=1; i<a.size(); ++i) {
- a[i] = a[i-1]+1;
- }
-
- // use some common STL container operations
- std::cout << "size: " << a.size() << std::endl;
- std::cout << "empty: " << (a.empty() ? "true" : "false") << std::endl;
- std::cout << "max_size: " << a.max_size() << std::endl;
- std::cout << "front: " << a.front() << std::endl;
- std::cout << "back: " << a.back() << std::endl;
- std::cout << "elems: ";
-
- // iterate through all elements
- for (Array::const_iterator pos=a.begin(); pos<a.end(); ++pos) {
- std::cout << *pos << ' ';
- }
- std::cout << std::endl;
-
- // check copy constructor and assignment operator
- Array b(a);
- Array c;
- c = a;
- if (a==b && a==c) {
- std::cout << "copy construction and copy assignment are OK"
- << std::endl;
- }
- else {
- std::cout << "copy construction and copy assignment FAILED"
- << std::endl;
- }
-
- return 0; // makes Visual-C++ compiler happy
-}
-
Deleted: trunk/libs/array/array2.cpp
==============================================================================
--- trunk/libs/array/array2.cpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,40 +0,0 @@
-/* example for using class array<>
- * (C) Copyright Nicolai M. Josuttis 2001.
- * 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)
- */
-
-#include <algorithm>
-#include <functional>
-#include <boost/array.hpp>
-#include "print.hpp"
-using namespace std;
-using namespace boost;
-
-int main()
-{
- // create and initialize array
- array<int,10> a = { { 1, 2, 3, 4, 5 } };
-
- print_elements(a);
-
- // modify elements directly
- for (unsigned i=0; i<a.size(); ++i) {
- ++a[i];
- }
- print_elements(a);
-
- // change order using an STL algorithm
- reverse(a.begin(),a.end());
- print_elements(a);
-
- // negate elements using STL framework
- transform(a.begin(),a.end(), // source
- a.begin(), // destination
- negate<int>()); // operation
- print_elements(a);
-
- return 0; // makes Visual-C++ compiler happy
-}
-
Deleted: trunk/libs/array/array3.cpp
==============================================================================
--- trunk/libs/array/array3.cpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,55 +0,0 @@
-/* example for using class array<>
- * (C) Copyright Nicolai M. Josuttis 2001.
- * 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)
- */
-
-#include <string>
-#include <iostream>
-#include <boost/array.hpp>
-
-template <class T>
-void print_elements (const T& x);
-
-int main()
-{
- // create array of four seasons
- boost::array<std::string,4> seasons = {
- { "spring", "summer", "autumn", "winter" }
- };
-
- // copy and change order
- boost::array<std::string,4> seasons_orig = seasons;
- for (unsigned i=seasons.size()-1; i>0; --i) {
- std::swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
- }
-
- std::cout << "one way: ";
- print_elements(seasons);
-
- // try swap()
- std::cout << "other way: ";
- std::swap(seasons,seasons_orig);
- print_elements(seasons);
-
- // try reverse iterators
- std::cout << "reverse: ";
- for (boost::array<std::string,4>::reverse_iterator pos
- =seasons.rbegin(); pos<seasons.rend(); ++pos) {
- std::cout << " " << *pos;
- }
- std::cout << std::endl;
-
- return 0; // makes Visual-C++ compiler happy
-}
-
-template <class T>
-void print_elements (const T& x)
-{
- for (unsigned i=0; i<x.size(); ++i) {
- std::cout << " " << x[i];
- }
- std::cout << std::endl;
-}
-
Deleted: trunk/libs/array/array4.cpp
==============================================================================
--- trunk/libs/array/array4.cpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,43 +0,0 @@
-/* example for using class array<>
- * (C) Copyright Nicolai M. Josuttis 2001.
- * 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)
- */
-
-#include <algorithm>
-#include <functional>
-#include <string>
-#include <iostream>
-#include <boost/array.hpp>
-
-int main()
-{
- // array of arrays of seasons
- boost::array<boost::array<std::string,4>,2> seasons_i18n = {
- { { { "spring", "summer", "autumn", "winter", } },
- { { "Fruehling", "Sommer", "Herbst", "Winter" } }
- }
- };
-
- // for any array of seasons print seasons
- for (unsigned i=0; i<seasons_i18n.size(); ++i) {
- boost::array<std::string,4> seasons = seasons_i18n[i];
- for (unsigned j=0; j<seasons.size(); ++j) {
- std::cout << seasons[j] << " ";
- }
- std::cout << std::endl;
- }
-
- // print first element of first array
- std::cout << "first element of first array: "
- << seasons_i18n[0][0] << std::endl;
-
- // print last element of last array
- std::cout << "last element of last array: "
- << seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]
- << std::endl;
-
- return 0; // makes Visual-C++ compiler happy
-}
-
Deleted: trunk/libs/array/array5.cpp
==============================================================================
--- trunk/libs/array/array5.cpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,72 +0,0 @@
-/* simple example for using class array<>
- * (C) Copyright Nicolai M. Josuttis 2001.
- * 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)
- */
-
-#include <iostream>
-#include <boost/array.hpp>
-
-template <typename T>
-void test_static_size (const T& cont)
-{
- int tmp[T::static_size];
- for (unsigned i=0; i<T::static_size; ++i) {
- tmp[i] = int(cont[i]);
- }
- for (unsigned j=0; j<T::static_size; ++j) {
- std::cout << tmp[j] << ' ';
- }
- std::cout << std::endl;
-}
-
-int main()
-{
- // define special type name
- typedef boost::array<float,6> Array;
-
- // create and initialize an array
- const Array a = { { 42.42 } };
-
- // use some common STL container operations
- std::cout << "static_size: " << a.size() << std::endl;
- std::cout << "size: " << a.size() << std::endl;
- // Can't use std::boolalpha because it isn't portable
- std::cout << "empty: " << (a.empty()? "true" : "false") << std::endl;
- std::cout << "max_size: " << a.max_size() << std::endl;
- std::cout << "front: " << a.front() << std::endl;
- std::cout << "back: " << a.back() << std::endl;
- std::cout << "[0]: " << a[0] << std::endl;
- std::cout << "elems: ";
-
- // iterate through all elements
- for (Array::const_iterator pos=a.begin(); pos<a.end(); ++pos) {
- std::cout << *pos << ' ';
- }
- std::cout << std::endl;
- test_static_size(a);
-
- // check copy constructor and assignment operator
- Array b(a);
- Array c;
- c = a;
- if (a==b && a==c) {
- std::cout << "copy construction and copy assignment are OK"
- << std::endl;
- }
- else {
- std::cout << "copy construction and copy assignment are BROKEN"
- << std::endl;
- }
-
- typedef boost::array<double,6> DArray;
- typedef boost::array<int,6> IArray;
- IArray ia = { { 1, 2, 3, 4, 5, 6 } } ; // extra braces silence GCC warning
- DArray da;
- da = ia;
- da.assign(42);
-
- return 0; // makes Visual-C++ compiler happy
-}
-
Deleted: trunk/libs/array/print.hpp
==============================================================================
--- trunk/libs/array/print.hpp 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
+++ (empty file)
@@ -1,27 +0,0 @@
-/* The following code example is taken from the book
- * "The C++ Standard Library - A Tutorial and Reference"
- * by Nicolai M. Josuttis, Addison-Wesley, 1999
- *
- * (C) Copyright Nicolai M. Josuttis 1999.
- * 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)
- */
-#include <iostream>
-
-/* print_elements()
- * - prints optional C-string optcstr followed by
- * - all elements of the collection coll
- * - separated by spaces
- */
-template <class T>
-inline void print_elements (const T& coll, const char* optcstr="")
-{
- typename T::const_iterator pos;
-
- std::cout << optcstr;
- for (pos=coll.begin(); pos!=coll.end(); ++pos) {
- std::cout << *pos << ' ';
- }
- std::cout << std::endl;
-}
Added: trunk/libs/array/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/array/test/Jamfile.v2 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
@@ -0,0 +1,14 @@
+#~ Copyright Rene Rivera 2008
+#~ 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)
+
+import testing ;
+
+test-suite array :
+ [ run array0.cpp ]
+ [ run array1.cpp ]
+ [ run array2.cpp ]
+ [ run array3.cpp ]
+ [ run array4.cpp ]
+ [ run array5.cpp ]
+ ;
Modified: trunk/status/Jamfile.v2
==============================================================================
--- trunk/status/Jamfile.v2 (original)
+++ trunk/status/Jamfile.v2 2008-04-13 18:12:12 EDT (Sun, 13 Apr 2008)
@@ -19,14 +19,12 @@
import testing ;
-alias test_exec_monitor : ../libs/test/build//boost_test_exec_monitor/<link>static ;
-alias unit_test_framework : ../libs/test/build//boost_unit_test_framework/<link>static ;
-
# Tests from Jamfiles in individual library test subdirectories
# Please keep these in alphabetic order by test-suite name
build-project ../libs/accumulators/test ; # test-suite accumulators
build-project ../libs/algorithm/minmax/test ; # test-suite algorith/minmax
build-project ../libs/algorithm/string/test ; # test-suite algorithm/string
+build-project ../libs/array/test ; # test-suite array
build-project ../libs/asio/test ; # test-suite asio
build-project ../libs/assign/test ; # test-suite assign
build-project ../libs/any/test ; # test-suite any
@@ -79,7 +77,6 @@
build-project ../libs/signals/test ; # test-suite signals
build-project ../libs/smart_ptr/test ; # test-suite smart_ptr
build-project ../libs/spirit/classic/test ; # test-suite classic spirit
-build-project ../libs/spirit/test ; # test-suite spirit_v2
build-project ../libs/statechart/test ; # test-suite statechart
build-project ../libs/static_assert ; # test-suite static_assert
build-project ../libs/system/test ; # test-suite system
@@ -99,6 +96,11 @@
# Tests specified in this Jamfile
+alias test_exec_monitor : ../libs/test/build//boost_test_exec_monitor/<link>static ;
+explicit test_exec_monitor ;
+alias unit_test_framework : ../libs/test/build//boost_unit_test_framework/<link>static ;
+explicit unit_test_framework ;
+
test-suite config
:
# FIXME: Ideally, this should be just an alias to 'main' test suite
@@ -140,15 +142,6 @@
[ compile-fail libs/config/test/threads/test_thread_fail2.cpp ]
;
- test-suite array_suite # !!!
- : [ run libs/array/array0.cpp ]
- [ run libs/array/array1.cpp ]
- [ run libs/array/array2.cpp ]
- [ run libs/array/array3.cpp ]
- [ run libs/array/array4.cpp ]
- [ run libs/array/array5.cpp ]
- ;
-
run libs/crc/crc_test.cpp test_exec_monitor ;
run libs/functional/function_test.cpp ;
@@ -194,13 +187,3 @@
[ run libs/tokenizer/simple_example_4.cpp ]
[ run libs/tokenizer/simple_example_5.cpp ]
;
-
-
-
-
-
-
-
-
-
-
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk