#define CBTREEDB_SELF_VERIFY
#include "stx-cbtreedb.h"
#include <iostream>
#include <sstream>
#include <assert.h>
template class stx::CBTreeDB<>;
template class stx::CBTreeDB< uint32_t, std::greater<uint32_t> >;
template class stx::CBTreeDB< uint64_t, std::greater<uint64_t> >;
struct key_struct
{
uint8_t i8;
uint32_t i32;
}
__attribute__((packed));
struct key_struct_less
{
inline bool operator()(const key_struct& a, const key_struct& b)
{
return a.i8 < b.i8;
}
};
template class stx::CBTreeDB< key_struct, key_struct_less >;
int main()
{
{
typedef stx::CBTreeDB<> cbtreedb;
assert(cbtreedb::BTreePageSize == 1024);
assert(cbtreedb::LeafNodeNumKeys == 126);
assert(cbtreedb::LeafNodeFiller == 0);
assert(cbtreedb::InnerNodeNumKeys == 254);
assert(cbtreedb::InnerNodeFiller == 0);
}
{
typedef stx::CBTreeDB<uint64_t> cbtreedb;
assert(cbtreedb::BTreePageSize == 1024);
assert(cbtreedb::LeafNodeNumKeys == 84);
assert(cbtreedb::LeafNodeFiller == 0);
assert(cbtreedb::InnerNodeNumKeys == 127);
assert(cbtreedb::InnerNodeFiller == 0);
}
{
typedef stx::CBTreeDB<uint64_t, std::less<uint64_t>, 2048> cbtreedb;
assert(cbtreedb::BTreePageSize == 2048);
assert(cbtreedb::LeafNodeNumKeys == 169);
assert(cbtreedb::LeafNodeFiller == 4);
assert(cbtreedb::InnerNodeNumKeys == 255);
assert(cbtreedb::InnerNodeFiller == 0);
}
return 0;
}