| 1 | #include "cpp/pgen2.h"
|
| 2 |
|
| 3 | #include "mycpp/runtime.h"
|
| 4 | #include "vendor/greatest.h"
|
| 5 |
|
| 6 | TEST allocator_test() {
|
| 7 | for (int i = 0; i < 6000; i += 100) {
|
| 8 | pnode::PNodeAllocator p;
|
| 9 | log("Testing i = %d\n", i);
|
| 10 | for (int j = 0; j < i; ++j) {
|
| 11 | p.NewPNode(1, nullptr);
|
| 12 | }
|
| 13 | // TODO: it woudl be nicer to reuse the std::deque
|
| 14 | p.Clear();
|
| 15 | }
|
| 16 | PASS();
|
| 17 | }
|
| 18 |
|
| 19 | GREATEST_MAIN_DEFS();
|
| 20 |
|
| 21 | int main(int argc, char** argv) {
|
| 22 | gHeap.Init();
|
| 23 |
|
| 24 | GREATEST_MAIN_BEGIN();
|
| 25 |
|
| 26 | RUN_TEST(allocator_test);
|
| 27 |
|
| 28 | gHeap.CleanProcessExit();
|
| 29 |
|
| 30 | GREATEST_MAIN_END();
|
| 31 | return 0;
|
| 32 | }
|