void tst_QMallocPool::testShared()
{
    const unsigned int poolLength = 1024 * 1024;
    char *poolBase = new char[poolLength];
    for (unsigned int i = 0; i < poolLength; ++i)
        poolBase[i] = 'X';

    QMallocPool pool(poolBase, poolLength, QMallocPool::NewShared);
    QMallocPool pool2(poolBase, poolLength, QMallocPool::Shared);

    QVERIFY(pool.isValid());
    QVERIFY(pool2.isValid());

    void *alloc;

    // test malloc
    alloc = pool.malloc(1024);
    QVERIFY(alloc != 0);
    QVERIFY(pool.size_of(alloc) >= 1024);
    QVERIFY(pool.size_of(alloc) == pool2.size_of(alloc));
    pool.free(alloc);

    // test malloc of poolLength, should fail.
    alloc = pool.malloc(poolLength);
    QVERIFY(alloc == 0);

    // test malloc of poolLength + 1, should fail.
    alloc = pool.malloc(poolLength + 1);
    QVERIFY(alloc == 0);

    // test calloc
    alloc = pool.calloc(1024, sizeof(char));
    QVERIFY(alloc != 0);
    QVERIFY(pool.size_of(alloc) >= 1024);
    QVERIFY(pool.size_of(alloc) == pool2.size_of(alloc));
    for (int i = 0; i < 1024; ++i)
        QVERIFY(reinterpret_cast<char *>(alloc)[i] == '\0');
    pool.free(alloc);

    // test realloc
    alloc = pool.malloc(1024);
    QVERIFY(alloc != 0);
    QVERIFY(pool.size_of(alloc) >= 1024);
    QVERIFY(pool.size_of(alloc) == pool2.size_of(alloc));
    alloc = pool.realloc(alloc, 2048);
    QVERIFY(alloc != 0);
    QVERIFY(pool.size_of(alloc) >= 2048);
    QVERIFY(pool.size_of(alloc) == pool2.size_of(alloc));
    pool.free(alloc);

    delete[] poolBase;
}
TEST(BufferPool, NoOp) {
  memt::BufferPool pool1(0);
  memt::BufferPool pool2(1);
  memt::BufferPool pool3(100);
}