[test-map] Test moving values
This commit is contained in:
parent
a9c6a20b19
commit
e74b372b59
|
@ -184,6 +184,15 @@ main (int argc, char **argv)
|
|||
|
||||
m1 << hb_pair_t<vector_t, vector_t> {vector_t {2}, vector_t ()};
|
||||
|
||||
assert (m1.get (vector_t ()) == vector_t {1});
|
||||
assert (m1.get (vector_t {1}) == vector_t {2});
|
||||
}
|
||||
|
||||
/* Test moving values */
|
||||
{
|
||||
using vector_t = hb_vector_t<unsigned>;
|
||||
|
||||
hb_hashmap_t<vector_t, vector_t> m1;
|
||||
vector_t v {3};
|
||||
assert (v.length == 1);
|
||||
m1 << hb_pair_t<vector_t, vector_t> {vector_t {3}, v};
|
||||
|
@ -191,8 +200,12 @@ main (int argc, char **argv)
|
|||
m1 << hb_pair_t<vector_t, vector_t&&> {vector_t {4}, std::move (v)};
|
||||
assert (v.length == 0);
|
||||
|
||||
assert (m1.get (vector_t ()) == vector_t {1});
|
||||
assert (m1.get (vector_t {1}) == vector_t {2});
|
||||
hb_hashmap_t<vector_t, vector_t> m2;
|
||||
vector_t v2 {3};
|
||||
m2.set (vector_t {4}, v2);
|
||||
assert (v2.length == 1);
|
||||
m2.set (vector_t {5}, std::move (v2));
|
||||
assert (v2.length == 0);
|
||||
}
|
||||
|
||||
/* Test hb::shared_ptr. */
|
||||
|
|
Loading…
Reference in New Issue