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)
10 #include <boost/array.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
19 typedef boost::array< T, 5 > test_type;
21 test_type test_case; // = { 1, 1, 2, 3, 5 };
23 arr &aRef = get_c_array ( test_case );
24 BOOST_TEST ( &*test_case.begin () == &aRef[0] );
26 const arr &caRef = get_c_array ( test_case );
27 typename test_type::const_iterator iter = test_case.begin ();
28 BOOST_TEST ( &*iter == &caRef[0] );
30 // Confirm at() throws the std lib defined exception
32 test_case.at( test_case.size());
35 catch ( const std::out_of_range & ) {}
38 test_case.at( test_case.size() + 1);
41 catch ( const std::out_of_range & ) {}
44 test_case.at( test_case.size() + 100);
47 catch ( const std::out_of_range & ) {}
55 RunTests< long double >();
56 RunTests< std::string >();
58 return boost::report_errors();