/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #undef test struct Buffer { Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;} ~Buffer(){ delete [] buffer;} Uint32 m_sz; Uint32 m_len; Uint32 * buffer; }; inline void require(bool b){ if(!b) abort(); } #define relSz(x) ((x + SectionSegment::DataLength - 1) / SectionSegment::DataLength) void release(SectionSegmentPool & thePool, SegmentedSectionPtr & ptr){ const Uint32 sz = relSz(ptr.sz); thePool.releaseList(sz, ptr.i, ptr.p->m_lastSegment); } void compare(SimplePropertiesSectionReader & db, Buffer & buf){ { bool fail = false; db.reset(); for(Uint32 i = 0; i 0){ Uint32 size = sz*((10 + (rand() % (10 * sz)) + sz - 1)/sz); Buffer buf(size); SectionSegmentPool thePool; thePool.setSize(size); for(Uint32 i = 0; i