test PRDR split result
[ghsmtp.git] / default_init_allocator-test.cpp
blob257b06cf4921b8b5979a263fb842841704bed9cb
1 #include "default_init_allocator.hpp"
3 #include <iostream>
4 #include <vector>
6 #include <glog/logging.h>
8 int main()
10 std::vector<int, default_init_allocator<int>> v;
12 // fill v with values [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
13 v.resize(10);
14 for (size_t i = 0; i < 10; ++i)
15 v[i] = i;
17 // chop off the end of v, which now should be [1, 2, 3, 4, 5], but
18 // the other 5 values should remain in memory
19 v.resize(5);
21 // grow back to 10
22 v.resize(10);
24 for (size_t i = 0; i < v.size(); ++i) {
25 CHECK_EQ(v[i], i);