mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 03:23:03 +01:00
Make it compile with MSVC6
This commit is contained in:
parent
4760bfc4df
commit
f138cb4f22
@ -23,6 +23,7 @@
|
|||||||
* Contributor(s): ______________________________________.
|
* Contributor(s): ______________________________________.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../../include/firebird.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
@ -110,8 +111,8 @@ void MemoryPool::verify_pool() {
|
|||||||
assert(blk->prev == prev); // Prev is correct ?
|
assert(blk->prev == prev); // Prev is correct ?
|
||||||
BlockInfo temp = {blk, blk->length};
|
BlockInfo temp = {blk, blk->length};
|
||||||
bool foundTree = freeBlocks.locate(temp), foundPending = false;
|
bool foundTree = freeBlocks.locate(temp), foundPending = false;
|
||||||
for (PendingFreeBlock *temp = pendingFree; temp; temp = temp->next)
|
for (PendingFreeBlock *tmp = pendingFree; tmp; tmp = tmp->next)
|
||||||
if (temp == (PendingFreeBlock *)((char*)blk+ALIGN(sizeof(MemoryBlock)))) {
|
if (tmp == (PendingFreeBlock *)((char*)blk+ALIGN(sizeof(MemoryBlock)))) {
|
||||||
assert(!foundPending); // Block may be in pending list only one time
|
assert(!foundPending); // Block may be in pending list only one time
|
||||||
foundPending = true;
|
foundPending = true;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ static void testTree() {
|
|||||||
printf("Fill array with test data (%d items)...", TEST_ITEMS);
|
printf("Fill array with test data (%d items)...", TEST_ITEMS);
|
||||||
Vector<int, TEST_ITEMS> *v = new Vector<int, TEST_ITEMS>();
|
Vector<int, TEST_ITEMS> *v = new Vector<int, TEST_ITEMS>();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i=0;i<TEST_ITEMS;i++) {
|
int i;
|
||||||
|
for (i=0;i<TEST_ITEMS;i++) {
|
||||||
n = n * 45578 - 17651;
|
n = n * 45578 - 17651;
|
||||||
// Fill it with quasi-random values in range 0...TEST_ITEMS-1
|
// Fill it with quasi-random values in range 0...TEST_ITEMS-1
|
||||||
v->add(((i+n) % TEST_ITEMS + TEST_ITEMS)/2);
|
v->add(((i+n) % TEST_ITEMS + TEST_ITEMS)/2);
|
||||||
@ -61,9 +62,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 10, 10> tree10(NULL);
|
DefaultComparator<int>, 10, 10> tree10(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree10.add((*v)[i]);
|
tree10.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree10.locate((*v)[i]))
|
if (tree10.locate((*v)[i]))
|
||||||
tree10.fastRemove();
|
tree10.fastRemove();
|
||||||
}
|
}
|
||||||
@ -72,9 +73,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 50, 50> tree50(NULL);
|
DefaultComparator<int>, 50, 50> tree50(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree50.add((*v)[i]);
|
tree50.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree50.locate((*v)[i]))
|
if (tree50.locate((*v)[i]))
|
||||||
tree50.fastRemove();
|
tree50.fastRemove();
|
||||||
}
|
}
|
||||||
@ -83,9 +84,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 75, 75> tree75(NULL);
|
DefaultComparator<int>, 75, 75> tree75(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree75.add((*v)[i]);
|
tree75.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree75.locate((*v)[i]))
|
if (tree75.locate((*v)[i]))
|
||||||
tree75.fastRemove();
|
tree75.fastRemove();
|
||||||
}
|
}
|
||||||
@ -94,9 +95,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 100, 100> tree100(NULL);
|
DefaultComparator<int>, 100, 100> tree100(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree100.add((*v)[i]);
|
tree100.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree100.locate((*v)[i]))
|
if (tree100.locate((*v)[i]))
|
||||||
tree100.fastRemove();
|
tree100.fastRemove();
|
||||||
}
|
}
|
||||||
@ -105,9 +106,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 200, 200> tree200(NULL);
|
DefaultComparator<int>, 200, 200> tree200(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree200.add((*v)[i]);
|
tree200.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree200.locate((*v)[i]))
|
if (tree200.locate((*v)[i]))
|
||||||
tree200.fastRemove();
|
tree200.fastRemove();
|
||||||
}
|
}
|
||||||
@ -116,9 +117,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 250, 250> tree250(NULL);
|
DefaultComparator<int>, 250, 250> tree250(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree250.add((*v)[i]);
|
tree250.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree250.locate((*v)[i]))
|
if (tree250.locate((*v)[i]))
|
||||||
tree250.fastRemove();
|
tree250.fastRemove();
|
||||||
}
|
}
|
||||||
@ -127,9 +128,9 @@ static void testTree() {
|
|||||||
start();
|
start();
|
||||||
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
BePlusTree<int, int, MallocAllocator, DefaultKeyValue<int>,
|
||||||
DefaultComparator<int>, 500, 500> tree500(NULL);
|
DefaultComparator<int>, 500, 500> tree500(NULL);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
tree500.add((*v)[i]);
|
tree500.add((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++) {
|
for (i=0; i<TEST_ITEMS;i++) {
|
||||||
if (tree500.locate((*v)[i]))
|
if (tree500.locate((*v)[i]))
|
||||||
tree500.fastRemove();
|
tree500.fastRemove();
|
||||||
}
|
}
|
||||||
@ -137,9 +138,9 @@ static void testTree() {
|
|||||||
|
|
||||||
std::set<int> stlTree;
|
std::set<int> stlTree;
|
||||||
start();
|
start();
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
stlTree.insert((*v)[i]);
|
stlTree.insert((*v)[i]);
|
||||||
for (int i=0; i<TEST_ITEMS;i++)
|
for (i=0; i<TEST_ITEMS;i++)
|
||||||
stlTree.erase((*v)[i]);
|
stlTree.erase((*v)[i]);
|
||||||
clock_t d = clock();
|
clock_t d = clock();
|
||||||
printf("Just a reference: add+remove %d elements from STL tree took %d milliseconds. \n",
|
printf("Just a reference: add+remove %d elements from STL tree took %d milliseconds. \n",
|
||||||
@ -173,7 +174,8 @@ static void testAllocatorOverhead() {
|
|||||||
bigItems(&allocator);
|
bigItems(&allocator);
|
||||||
// Allocate small items
|
// Allocate small items
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i=0;i<ALLOC_ITEMS;i++) {
|
int i;
|
||||||
|
for (i=0;i<ALLOC_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, (void*)i};
|
AllocItem temp = {n, (void*)i};
|
||||||
items.add(temp);
|
items.add(temp);
|
||||||
@ -185,7 +187,7 @@ static void testAllocatorOverhead() {
|
|||||||
n++;
|
n++;
|
||||||
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
||||||
// Allocate big items
|
// Allocate big items
|
||||||
for (int i=0;i<BIG_ITEMS;i++) {
|
for (i=0;i<BIG_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, (void*)i};
|
AllocItem temp = {n, (void*)i};
|
||||||
bigItems.add(temp);
|
bigItems.add(temp);
|
||||||
@ -222,7 +224,7 @@ static void testAllocatorMemoryPool() {
|
|||||||
n++;
|
n++;
|
||||||
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
||||||
// Allocate big items
|
// Allocate big items
|
||||||
for (int i=0;i<BIG_ITEMS;i++) {
|
for (i=0;i<BIG_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, pool->alloc((n % BIG_SIZE + BIG_SIZE)/2+1)};
|
AllocItem temp = {n, pool->alloc((n % BIG_SIZE + BIG_SIZE)/2+1)};
|
||||||
bigItems.add(temp);
|
bigItems.add(temp);
|
||||||
@ -259,7 +261,7 @@ static void testAllocatorMalloc() {
|
|||||||
n++;
|
n++;
|
||||||
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
||||||
// Allocate big items
|
// Allocate big items
|
||||||
for (int i=0;i<BIG_ITEMS;i++) {
|
for (i=0;i<BIG_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, malloc((n % BIG_SIZE + BIG_SIZE)/2+1)};
|
AllocItem temp = {n, malloc((n % BIG_SIZE + BIG_SIZE)/2+1)};
|
||||||
bigItems.add(temp);
|
bigItems.add(temp);
|
||||||
@ -284,7 +286,8 @@ static void testAllocatorOldPool() {
|
|||||||
bigItems(&allocator);
|
bigItems(&allocator);
|
||||||
// Allocate small items
|
// Allocate small items
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i=0;i<ALLOC_ITEMS;i++) {
|
int i;
|
||||||
|
for (i=0;i<ALLOC_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, pool->allocate((n % MAX_ITEM_SIZE + MAX_ITEM_SIZE)/2+1,0)};
|
AllocItem temp = {n, pool->allocate((n % MAX_ITEM_SIZE + MAX_ITEM_SIZE)/2+1,0)};
|
||||||
items.add(temp);
|
items.add(temp);
|
||||||
@ -296,7 +299,7 @@ static void testAllocatorOldPool() {
|
|||||||
n++;
|
n++;
|
||||||
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
} while (n < ALLOC_ITEMS/2 && items.getNext());
|
||||||
// Allocate big items
|
// Allocate big items
|
||||||
for (int i=0;i<BIG_ITEMS;i++) {
|
for (i=0;i<BIG_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, pool->allocate((n % BIG_SIZE + BIG_SIZE)/2+1,0)};
|
AllocItem temp = {n, pool->allocate((n % BIG_SIZE + BIG_SIZE)/2+1,0)};
|
||||||
bigItems.add(temp);
|
bigItems.add(temp);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
* Contributor(s): ______________________________________.
|
* Contributor(s): ______________________________________.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../../include/firebird.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -32,12 +33,13 @@ using namespace Firebird;
|
|||||||
void testVector() {
|
void testVector() {
|
||||||
printf("Test Firebird::Vector: ");
|
printf("Test Firebird::Vector: ");
|
||||||
Vector<int,100> v;
|
Vector<int,100> v;
|
||||||
for (int i=0;i<100;i++)
|
int i;
|
||||||
|
for (i=0;i<100;i++)
|
||||||
v.add(i);
|
v.add(i);
|
||||||
for (int i=0;i<50;i++)
|
for (i=0;i<50;i++)
|
||||||
v.remove(0);
|
v.remove(0);
|
||||||
bool passed = true;
|
bool passed = true;
|
||||||
for (int i=50;i<100;i++)
|
for (i=50;i<100;i++)
|
||||||
if (v[i-50] != i) passed = false;
|
if (v[i-50] != i) passed = false;
|
||||||
printf(passed?"PASSED\n":"FAILED\n");
|
printf(passed?"PASSED\n":"FAILED\n");
|
||||||
}
|
}
|
||||||
@ -45,12 +47,13 @@ void testVector() {
|
|||||||
void testSortedVector() {
|
void testSortedVector() {
|
||||||
printf("Test Firebird::SortedVector: ");
|
printf("Test Firebird::SortedVector: ");
|
||||||
SortedVector<int,100> v;
|
SortedVector<int,100> v;
|
||||||
for (int i=0;i<100;i++)
|
int i;
|
||||||
|
for (i=0;i<100;i++)
|
||||||
v.add(99-i);
|
v.add(99-i);
|
||||||
for (int i=0;i<50;i++)
|
for (i=0;i<50;i++)
|
||||||
v.remove(0);
|
v.remove(0);
|
||||||
bool passed = true;
|
bool passed = true;
|
||||||
for (int i=50;i<100;i++)
|
for (i=50;i<100;i++)
|
||||||
if (v[i-50] != i) passed = false;
|
if (v[i-50] != i) passed = false;
|
||||||
printf(passed?"PASSED\n":"FAILED\n");
|
printf(passed?"PASSED\n":"FAILED\n");
|
||||||
}
|
}
|
||||||
@ -66,13 +69,14 @@ struct Test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void testBePlusTree() {
|
void testBePlusTree() {
|
||||||
MallocAllocator temp;
|
MallocAllocator temp;
|
||||||
printf("Test Firebird::BePlusTree\n");
|
printf("Test Firebird::BePlusTree\n");
|
||||||
|
|
||||||
printf("Fill array with test data (%d items)...", TEST_ITEMS);
|
printf("Fill array with test data (%d items)...", TEST_ITEMS);
|
||||||
Vector<int, TEST_ITEMS> v;
|
Vector<int, TEST_ITEMS> v;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i=0;i<TEST_ITEMS;i++) {
|
int i;
|
||||||
|
for (i=0;i<TEST_ITEMS;i++) {
|
||||||
n = n * 45578 - 17651;
|
n = n * 45578 - 17651;
|
||||||
// Fill it with quasi-random values in range 0...TEST_ITEMS-1
|
// Fill it with quasi-random values in range 0...TEST_ITEMS-1
|
||||||
v.add(((i+n) % TEST_ITEMS + TEST_ITEMS)/2);
|
v.add(((i+n) % TEST_ITEMS + TEST_ITEMS)/2);
|
||||||
@ -85,7 +89,7 @@ void testBePlusTree() {
|
|||||||
BePlusTree<Test, int, MallocAllocator, Test,
|
BePlusTree<Test, int, MallocAllocator, Test,
|
||||||
DefaultComparator<int>, 13, 13> tree2(&temp);
|
DefaultComparator<int>, 13, 13> tree2(&temp);
|
||||||
int cnt1 = 0, cnt2 = 0;
|
int cnt1 = 0, cnt2 = 0;
|
||||||
for (int i=0; i < v.getCount(); i++) {
|
for (i=0; i < v.getCount(); i++) {
|
||||||
if (tree1.locate(locEqual, v[i]))
|
if (tree1.locate(locEqual, v[i]))
|
||||||
tree1.current().count++;
|
tree1.current().count++;
|
||||||
else {
|
else {
|
||||||
@ -112,7 +116,7 @@ void testBePlusTree() {
|
|||||||
bool passed = true;
|
bool passed = true;
|
||||||
|
|
||||||
printf("Check that tree(2) contains test data: ");
|
printf("Check that tree(2) contains test data: ");
|
||||||
for (int i=0; i< v.getCount(); i++) {
|
for (i=0; i< v.getCount(); i++) {
|
||||||
if(!tree1.locate(locEqual,v[i]))
|
if(!tree1.locate(locEqual,v[i]))
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
@ -120,7 +124,7 @@ void testBePlusTree() {
|
|||||||
passed = true;
|
passed = true;
|
||||||
|
|
||||||
printf("Check that tree(13) contains test data: ");
|
printf("Check that tree(13) contains test data: ");
|
||||||
for (int i=0; i< v.getCount(); i++) {
|
for (i=0; i< v.getCount(); i++) {
|
||||||
if(!tree2.locate(locEqual,v[i]))
|
if(!tree2.locate(locEqual,v[i]))
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
@ -173,7 +177,7 @@ void testBePlusTree() {
|
|||||||
printf(" DONE\n");
|
printf(" DONE\n");
|
||||||
|
|
||||||
printf("Check that tree(2) contains test data: ");
|
printf("Check that tree(2) contains test data: ");
|
||||||
for (int i=0; i< v.getCount(); i++) {
|
for (i=0; i< v.getCount(); i++) {
|
||||||
if(!tree1.locate(locEqual,v[i]))
|
if(!tree1.locate(locEqual,v[i]))
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
@ -181,7 +185,7 @@ void testBePlusTree() {
|
|||||||
passed = true;
|
passed = true;
|
||||||
|
|
||||||
printf("Check that tree(13) contains test data: ");
|
printf("Check that tree(13) contains test data: ");
|
||||||
for (int i=0; i < v.getCount(); i++) {
|
for (i=0; i < v.getCount(); i++) {
|
||||||
if(!tree2.locate(locEqual,v[i]))
|
if(!tree2.locate(locEqual,v[i]))
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
@ -215,7 +219,7 @@ void testBePlusTree() {
|
|||||||
passed = true;
|
passed = true;
|
||||||
|
|
||||||
printf("Remove the rest of data from the trees: ");
|
printf("Remove the rest of data from the trees: ");
|
||||||
for (int i=0;i < v.getCount(); i++) {
|
for (i=0;i < v.getCount(); i++) {
|
||||||
if (!tree1.locate(locEqual, v[i]))
|
if (!tree1.locate(locEqual, v[i]))
|
||||||
assert(false);
|
assert(false);
|
||||||
if (tree1.current().count > 1)
|
if (tree1.current().count > 1)
|
||||||
@ -241,7 +245,6 @@ void testBePlusTree() {
|
|||||||
if (tree2.getLast())
|
if (tree2.getLast())
|
||||||
passed = false;
|
passed = false;
|
||||||
printf(passed?"PASSED\n":"FAILED\n");
|
printf(passed?"PASSED\n":"FAILED\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ALLOC_ITEMS 1000000
|
#define ALLOC_ITEMS 1000000
|
||||||
@ -266,8 +269,9 @@ void testAllocator() {
|
|||||||
bigItems(&allocator);
|
bigItems(&allocator);
|
||||||
printf("Allocate %d items: ", ALLOC_ITEMS);
|
printf("Allocate %d items: ", ALLOC_ITEMS);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
int i;
|
||||||
pool->verify_pool();
|
pool->verify_pool();
|
||||||
for (int i=0;i<ALLOC_ITEMS;i++) {
|
for (i=0;i<ALLOC_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, pool->alloc((n % MAX_ITEM_SIZE + MAX_ITEM_SIZE)/2+1)};
|
AllocItem temp = {n, pool->alloc((n % MAX_ITEM_SIZE + MAX_ITEM_SIZE)/2+1)};
|
||||||
items.add(temp);
|
items.add(temp);
|
||||||
@ -287,7 +291,7 @@ void testAllocator() {
|
|||||||
printf("Allocate %d big items: ", BIG_ITEMS);
|
printf("Allocate %d big items: ", BIG_ITEMS);
|
||||||
n = 0;
|
n = 0;
|
||||||
pool->verify_pool();
|
pool->verify_pool();
|
||||||
for (int i=0;i<BIG_ITEMS;i++) {
|
for (i=0;i<BIG_ITEMS;i++) {
|
||||||
n = n * 47163 - 57412;
|
n = n * 47163 - 57412;
|
||||||
AllocItem temp = {n, pool->alloc((n % BIG_SIZE + BIG_SIZE)/2+1)};
|
AllocItem temp = {n, pool->alloc((n % BIG_SIZE + BIG_SIZE)/2+1)};
|
||||||
bigItems.add(temp);
|
bigItems.add(temp);
|
||||||
@ -313,7 +317,7 @@ void testAllocator() {
|
|||||||
MemoryPool::deletePool(pool);
|
MemoryPool::deletePool(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
void main() {
|
||||||
testVector();
|
testVector();
|
||||||
testSortedVector();
|
testSortedVector();
|
||||||
testBePlusTree();
|
testBePlusTree();
|
||||||
|
Loading…
Reference in New Issue
Block a user