forked from Z3Prover/z3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuffer.cpp
48 lines (36 loc) · 886 Bytes
/
buffer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
buffer.cpp
Abstract:
Test buffers.
Author:
Leonardo de Moura (leonardo) 2011-03-03.
Revision History:
--*/
#include "util/ptr_scoped_buffer.h"
typedef std::pair<int, int> point;
template class ptr_scoped_buffer<point>;
static void tst1() {
ptr_scoped_buffer<point> b;
ENSURE(b.empty());
b.push_back(alloc(point, 10, 20));
ENSURE(!b.empty());
point * p1 = alloc(point, 30, 20);
b.push_back(p1);
ENSURE(b.get(1) == p1);
b.push_back(alloc(point, 40, 20));
ENSURE(b.size() == 3);
b.pop_back();
ENSURE(b.get(0) != p1);
ENSURE(b.get(1) == p1);
point * p2 = alloc(point, 30, 20);
ENSURE(b.get(0) != p2);
b.set(0, p2);
ENSURE(b.get(0) == p2);
ENSURE(b.size() == 2);
b.push_back(alloc(point, 40, 40));
}
void tst_buffer() {
tst1();
}