1 /* tests for using class array<> specialization for size 0 2 * (C) Copyright Alisdair Meredith 2006. 3 * Distributed under the Boost Software License, Version 1.0. (See 4 * accompanying file LICENSE_1_0.txt or copy at 5 * http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 8 #include <string> 9 #include <iostream> 10 #include <boost/array.hpp> 11 #include <algorithm> 12 13 #define BOOST_TEST_MAIN 14 #include <boost/test/unit_test.hpp> 15 16 namespace { 17 template< class T > RunTests()18 void RunTests() 19 { 20 typedef boost::array< T, 5 > test_type; 21 typedef T arr[5]; 22 test_type test_case; // = { 1, 1, 2, 3, 5 }; 23 24 arr &aRef = get_c_array ( test_case ); 25 BOOST_CHECK ( &*test_case.begin () == &aRef[0] ); 26 27 const arr &caRef = get_c_array ( test_case ); 28 typename test_type::const_iterator iter = test_case.begin (); 29 BOOST_CHECK ( &*iter == &caRef[0] ); 30 } 31 } 32 BOOST_AUTO_TEST_CASE(test_main)33BOOST_AUTO_TEST_CASE( test_main ) 34 { 35 RunTests< bool >(); 36 RunTests< void * >(); 37 RunTests< long double >(); 38 RunTests< std::string >(); 39 } 40 41