1 | // |
---|---|
2 | // immer: immutable data structures for C++ |
3 | // Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente |
4 | // |
5 | // This software is distributed under the Boost Software License, Version 1.0. |
6 | // See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt |
7 | // |
8 | |
9 | // Thanks @dgel for reporting this issue |
10 | // https://github.com/arximboldi/immer/issues/56 |
11 | |
12 | #include <immer/map.hpp> |
13 | #include <immer/vector.hpp> |
14 | #include <immer/flex_vector.hpp> |
15 | |
16 | #include <catch.hpp> |
17 | |
18 | TEST_CASE("const map") |
19 | { |
20 | const auto x = immer::map<std::string, int>{} |
21 | .set("A", 1); |
22 | auto it = x.begin(); |
23 | CHECK(it->first == "A"); |
24 | CHECK(it->second == 1); |
25 | } |
26 | |
27 | TEST_CASE("const vector") |
28 | { |
29 | const auto x = immer::vector<std::pair<std::string, int>>{} |
30 | .push_back({"A", 1}); |
31 | auto it = x.begin(); |
32 | CHECK(it->first == "A"); |
33 | CHECK(it->second == 1); |
34 | } |
35 | |
36 | TEST_CASE("const flex vector") |
37 | { |
38 | const auto x = immer::flex_vector<std::pair<std::string, int>>{} |
39 | .push_back({"A", 1}); |
40 | auto it = x.begin(); |
41 | CHECK(it->first == "A"); |
42 | CHECK(it->second == 1); |
43 | } |
44 |