1/* 2 * Copyright (c) 2014 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetsstrasse 4, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#include <iostream> 11#include <vector> 12#include <unordered_map> 13#include <string> 14 15#include "cxxtest.hpp" 16 17static std::vector<std::string> mapkeys {{"0", "1", "2"}}; 18 19static std::unordered_map<std::string, uint32_t> simple_map 20{{"0", 0}, {"2", 2}, {"1", 1}}; 21 22std::unordered_map<std::string, uint16_t> subscription_cost_to_id 23{{"0", 0}, {"10", 1}, {"20", 2}, {"50", 3}}; 24 25static void stl_unordered_map_test_simple(void) 26{ 27 std::cout << "STL unordered map: simple test" << std::endl; 28 for (auto it = mapkeys.begin(); it != mapkeys.end(); ++it) { 29 std::cout << *it << "->" << simple_map[*it] << std::endl; 30 } 31} 32 33void stl_map_test(void) 34{ 35 stl_unordered_map_test_simple(); 36} 37 38#ifndef BARRELFISH 39int main(void) 40{ 41 stl_map_test(); 42 return 0; 43} 44#endif 45