mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@11031 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
dfd6f87f9e
commit
960cb18f60
1 changed files with 49 additions and 10 deletions
|
|
@ -6,19 +6,58 @@ CONSOLE_APP_MAIN
|
|||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
Bits h;
|
||||
Vector<bool> v;
|
||||
|
||||
for(int i = 0; i < 100000; i++) {
|
||||
int pos = Random(120000);
|
||||
bool b = Random() & 1;
|
||||
{
|
||||
Bits h;
|
||||
Vector<bool> v;
|
||||
|
||||
v.At(pos, false) = b;
|
||||
h.Set(pos, b);
|
||||
SeedRandom();
|
||||
|
||||
for(int i = 0; i < 100000; i++) {
|
||||
int pos = Random(120000);
|
||||
bool b = Random() & 1;
|
||||
|
||||
v.At(pos, false) = b;
|
||||
h.Set(pos, b);
|
||||
}
|
||||
|
||||
for(int i = 0; i < v.GetCount(); i++)
|
||||
ASSERT(h.Get(i) == v[i]);
|
||||
}
|
||||
|
||||
for(int i = 0; i < v.GetCount(); i++)
|
||||
ASSERT(h.Get(i) == v[i]);
|
||||
{
|
||||
Bits r;
|
||||
dword *h = r.CreateRaw(2);
|
||||
*h = 0x4444;
|
||||
|
||||
ASSERT(r.Get(0) == 0);
|
||||
ASSERT(r.Get(1) == 0);
|
||||
ASSERT(r.Get(2) == 1);
|
||||
ASSERT(r.Get(3) == 0);
|
||||
ASSERT(r.Get(4) == 0);
|
||||
ASSERT(r.Get(5) == 0);
|
||||
ASSERT(r.Get(6) == 1);
|
||||
|
||||
r.Set(31, 1);
|
||||
ASSERT(*h == 0x80004444);
|
||||
|
||||
int n;
|
||||
const dword *x = r.Raw(n);
|
||||
|
||||
DUMP(n);
|
||||
ASSERT(n >= 2);
|
||||
ASSERT(*x == 0x80004444);
|
||||
|
||||
r.Set(1000, 1);
|
||||
r.Raw(n);
|
||||
DUMP(n);
|
||||
r.Set(2000, 1);
|
||||
r.Raw(n);
|
||||
DUMP(n);
|
||||
r.Set(2000, 0);
|
||||
r.Shrink();
|
||||
ASSERT(*r.Raw(n) == 0x80004444);
|
||||
DUMP(n);
|
||||
}
|
||||
|
||||
LOG("--------- OK");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue