| 52 | } |
| 53 | |
| 54 | void deque_test::test_constructors_and_assignment() |
| 55 | { |
| 56 | auto check1 = {0, 0, 0, 0, 0}; |
| 57 | std::deque<int> d1(5U); |
| 58 | test_eq( |
| 59 | "size construction", |
| 60 | check1.begin(), check1.end(), |
| 61 | d1.begin(), d1.end() |
| 62 | ); |
| 63 | |
| 64 | auto check2 = {1, 1, 1, 1, 1}; |
| 65 | std::deque<int> d2(5U, 1); |
| 66 | test_eq( |
| 67 | "value construction", |
| 68 | check2.begin(), check2.end(), |
| 69 | d2.begin(), d2.end() |
| 70 | ); |
| 71 | |
| 72 | auto check3 = {1, 2, 3, 4, 5}; |
| 73 | std::deque<int> d3{check3.begin(), check3.end()}; |
| 74 | test_eq( |
| 75 | "iterator range construction", |
| 76 | check3.begin(), check3.end(), |
| 77 | d3.begin(), d3.end() |
| 78 | ); |
| 79 | |
| 80 | std::deque<int> d4{d3}; |
| 81 | test_eq( |
| 82 | "copy construction", |
| 83 | check3.begin(), check3.end(), |
| 84 | d4.begin(), d4.end() |
| 85 | ); |
| 86 | |
| 87 | std::deque<int> d5{std::move(d4)}; |
| 88 | test_eq( |
| 89 | "move construction", |
| 90 | check3.begin(), check3.end(), |
| 91 | d5.begin(), d5.end() |
| 92 | ); |
| 93 | test_eq("move construction - origin empty", d4.empty(), true); |
| 94 | |
| 95 | std::deque<int> d6{check3}; |
| 96 | test_eq( |
| 97 | "inializer list construction", |
| 98 | check3.begin(), check3.end(), |
| 99 | d6.begin(), d6.end() |
| 100 | ); |
| 101 | |
| 102 | d4 = d6; |
| 103 | test_eq( |
| 104 | "copy assignment", |
| 105 | check3.begin(), check3.end(), |
| 106 | d4.begin(), d4.end() |
| 107 | ); |
| 108 | |
| 109 | d6 = std::move(d4); |
| 110 | test_eq( |
| 111 | "move assignment", |