[vector] Add tests for move constructor/assignment
This commit is contained in:
parent
7fa580bc4f
commit
e61234c5f7
|
@ -61,8 +61,12 @@ main (int argc, char **argv)
|
|||
|
||||
/* Test move constructor. */
|
||||
{
|
||||
hb_vector_t<int> v {hb_vector_t<int> {1, 2}};
|
||||
hb_vector_t<int> V {hb_vector_t<int> {1, 2}};
|
||||
hb_vector_t<int> s {1, 2};
|
||||
hb_sorted_vector_t<int> S {1, 2};
|
||||
hb_vector_t<int> v (std::move (s));
|
||||
hb_sorted_vector_t<int> V (std::move (S));
|
||||
assert (s.length == 0);
|
||||
assert (S.length == 0);
|
||||
assert (v.length == 2);
|
||||
assert (v[0] == 1);
|
||||
assert (v[1] == 2);
|
||||
|
@ -70,11 +74,16 @@ main (int argc, char **argv)
|
|||
|
||||
/* Test move assignment. */
|
||||
{
|
||||
hb_vector_t<int> s {1, 2};
|
||||
hb_sorted_vector_t<int> S {1, 2};
|
||||
hb_vector_t<int> v;
|
||||
hb_sorted_vector_t<int> V;
|
||||
v = hb_vector_t<int> {1, 2};
|
||||
V = hb_sorted_vector_t<int> {1, 2};
|
||||
v = std::move (s);
|
||||
V = std::move (S);
|
||||
assert (s.length == 0);
|
||||
assert (S.length == 0);
|
||||
assert (v.length == 2);
|
||||
assert (V.length == 2);
|
||||
assert (v[0] == 1);
|
||||
assert (v[1] == 2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue