mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
other components
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
e9eab22e5c
commit
68269c43a6
250 changed files with 70871 additions and 0 deletions
49
test/vector.cpp
Normal file
49
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