00001
00002 #include "stdafx.h"
00003
00004 #include <iostream>
00005 #include <map>
00006 #include <cassert>
00007 using namespace std;
00008
00009 #include "uniqueIdAllocator.h"
00010
00011
00012 int _tmain(int argc, _TCHAR* argv[]) {
00013 cout <<"UniqueIdAllocator Test"<<endl;
00014 UniqueIdAllocator b=UniqueIdAllocator(2, 9);
00015 b.output(cout, true);
00016 b.allocate(); b.output(cout, true);
00017 b.allocate(); b.output(cout, true);
00018 b.allocate(); b.output(cout, true);
00019 b.allocate(); b.output(cout, true);
00020 b.allocate(); b.output(cout, true);
00021 b.allocate(); b.output(cout, true);
00022 b.free(2); b.output(cout, true);
00023 b.free(3); b.output(cout, true);
00024 b.free(4); b.output(cout, true);
00025 b.free(5); b.output(cout, true);
00026 b.allocate(); b.output(cout, true);
00027 b.allocate(); b.output(cout, true);
00028 b.allocate(); b.output(cout, true);
00029 b.free(3); b.output(cout, true);
00030 b.free(2); b.output(cout, true);
00031
00032 b.allocate(); b.output(cout, true);
00033 b.allocate(); b.output(cout, true);
00034 b.allocate(); b.output(cout, true);
00035 b.allocate(); b.output(cout, true);
00036 b.allocate(); b.output(cout, true);
00037 b.allocate(); b.output(cout, true);
00038 b.allocate(); b.output(cout, true);
00039
00040 b.free(4); b.output(cout, true);
00041 b.free(3); b.output(cout, true);
00042
00043 b.allocate(); b.output(cout, true);
00044
00045 return 0;
00046 }