lookup service
[ghsmtp.git] / iobuffer-test.cpp
blob14343dee9131704f6c535f6ae38ae3df77fc128d
1 #include "iobuffer.hpp"
3 #include <glog/logging.h>
5 int main()
7 iobuffer<char> v;
9 // fill v with values [0..9]
10 v.resize(10);
11 for (size_t i = 0; i < 10; ++i)
12 *(v.data() + i) = i;
14 // chop off the end of v, which now should be [0..4], but
15 // the other 5 values should remain in memory
16 v.resize(5);
18 // grow back to 10
19 v.resize(10);
21 // verify the values are unchanged
22 CHECK_EQ(v.size(), 10);
23 for (size_t i = 0; i < 10; ++i) {
24 CHECK_EQ(*(v.data() + i), i);