2 // Copyright 2007-2009 Daniel James.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include "../helpers/prefix.hpp"
8 #include <boost/unordered_map.hpp>
9 #include "../helpers/postfix.hpp"
12 #include "../helpers/test.hpp"
17 UNORDERED_AUTO_TEST (at_tests
) {
18 BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "Create Map" << std::endl
;
20 boost::unordered_map
<std::string
, int> x
;
21 boost::unordered_map
<std::string
, int> const& x_const(x
);
23 BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "Check empty container" << std::endl
;
27 BOOST_ERROR("Should have thrown.");
28 } catch (std::out_of_range
) {
33 BOOST_ERROR("Should have thrown.");
34 } catch (std::out_of_range
) {
37 BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "Add elements" << std::endl
;
42 BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "Check existing elements" << std::endl
;
44 BOOST_TEST(x
.at("one") == 1);
45 BOOST_TEST(x
.at("two") == 2);
46 BOOST_TEST(x_const
.at("one") == 1);
47 BOOST_TEST(x_const
.at("two") == 2);
49 BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "Check missing element" << std::endl
;
53 BOOST_ERROR("Should have thrown.");
54 } catch (std::out_of_range
) {
59 BOOST_ERROR("Should have thrown.");
60 } catch (std::out_of_range
) {
63 BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "Finished" << std::endl
;