PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/unordered/test/unordered/at_tests.cpp

http://hadesmem.googlecode.com/
C++ | 34 lines | 21 code | 10 blank | 3 comment | 2 complexity | 90c7237079e89c29cc4256402d00b90a MD5 | raw file
 1
 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)
 5
 6#include "../helpers/prefix.hpp"
 7
 8#include <boost/unordered_map.hpp>
 9#include "../helpers/test.hpp"
10#include <string>
11
12namespace at_tests {
13
14UNORDERED_AUTO_TEST(at_tests) {
15    boost::unordered_map<std::string, int> x;
16    typedef boost::unordered_map<std::string, int>::iterator iterator;
17
18    x["one"] = 1;
19    x["two"] = 2;
20
21    BOOST_TEST(x.at("one") == 1);
22    BOOST_TEST(x.at("two") == 2);
23
24    try {
25        x.at("three");
26        BOOST_ERROR("Should have thrown.");
27    }
28    catch(std::out_of_range) {
29    }
30}
31
32}
33
34RUN_TESTS()