mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 10:55:50 +00:00
checkpoint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
142bf71b35
commit
9359ab7ce5
124 changed files with 2 additions and 0 deletions
49
src/test/vector.cpp
Normal file
49
src/test/vector.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
tst_vector.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Test my vector template.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2006-09-11.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"vector.h"
|
||||
|
||||
static void tst1() {
|
||||
vector<int> v1;
|
||||
SASSERT(v1.empty());
|
||||
for (unsigned i = 0; i < 1000; i++) {
|
||||
v1.push_back(i + 3);
|
||||
SASSERT(v1[i] == i + 3);
|
||||
SASSERT(v1.capacity() >= v1.size());
|
||||
SASSERT(!v1.empty());
|
||||
}
|
||||
for (unsigned i = 0; i < 1000; i++) {
|
||||
SASSERT(v1[i] == i + 3);
|
||||
}
|
||||
vector<int>::iterator it = v1.begin();
|
||||
vector<int>::iterator end = v1.end();
|
||||
for (int i = 0; it != end; ++it, ++i) {
|
||||
SASSERT(*it == i + 3);
|
||||
}
|
||||
for (unsigned i = 0; i < 1000; i++) {
|
||||
SASSERT(v1.back() == 1000 - i - 1 + 3);
|
||||
SASSERT(v1.size() == 1000 - i);
|
||||
v1.pop_back();
|
||||
}
|
||||
SASSERT(v1.empty());
|
||||
SASSERT(v1.size() == 0);
|
||||
}
|
||||
|
||||
void tst_vector() {
|
||||
tst1();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue