test(buffer): add missing tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
a46b313c1c
commit
57b6148bbb
1 changed files with 15 additions and 0 deletions
|
@ -44,8 +44,23 @@ static void tst1() {
|
||||||
lean_assert(b1.back() == 10);
|
lean_assert(b1.back() == 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tst2() {
|
||||||
|
buffer<int> b1;
|
||||||
|
buffer<int> b2;
|
||||||
|
b1.push_back(1); b1.push_back(2); b1.push_back(3);
|
||||||
|
b2 = b1;
|
||||||
|
lean_assert(b1.size() == 3);
|
||||||
|
b2.resize(2);
|
||||||
|
lean_assert(b2.size() == 2);
|
||||||
|
b2.resize(10, 0);
|
||||||
|
lean_assert(b2.size() == 10);
|
||||||
|
b2.resize(1);
|
||||||
|
lean_assert(b2.size() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
loop<buffer<int>>(100);
|
loop<buffer<int>>(100);
|
||||||
tst1();
|
tst1();
|
||||||
|
tst2();
|
||||||
return has_violations() ? 1 : 0;
|
return has_violations() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue