本文整理汇总了C++中TestData::end方法的典型用法代码示例。如果您正苦于以下问题:C++ TestData::end方法的具体用法?C++ TestData::end怎么用?C++ TestData::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestData
的用法示例。
在下文中一共展示了TestData::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputTestData
static void OutputTestData(const TestData &v)
{
for (TestData::const_iterator i = v.begin(); i != v.end(); ++i)
{
cerr << i->first << ": " << i->second << endl;
}
}
示例2: DataExists
bool DataExists(const TestData &data, const char *name)
{
TestData::const_iterator i = data.find(name);
return (i != data.end());
}
示例3: TestBtreeIteratorString
void TestBtreeIteratorString()
{
SmiKey leftBoundary("c");
SmiKey leftBoundaryE("e");
SmiKey rightBoundary("f");
SmiKey farLeftBoundary("_");
SmiKey farRightBoundary("zzz");
TestData::iterator beginIter;
TestData::iterator endIter;
EnterTestFun();
SmiKeyedFile* file = new SmiKeyedFile(SmiKey::String, false);
tassert(file != 0);
tassert(file->Create());
PrefetchingIterator* piter;
string str;
TestData testData;
TestData::iterator iter;
GenerateTestData(testData);
for(iter = testData.begin(); iter != testData.end(); ++iter)
{
SmiKey key(iter->first);
SmiRecord record;
string s = iter->second;
tassert(file->InsertRecord(key, record));
tassert(record.Write(s.c_str(), s.size()) == s.size());
}
piter = file->SelectAllPrefetched();
tassert(piter != 0);
AssertIteratorsEqualString(piter, testData.begin(), testData.end());
delete piter;
endIter = testData.lower_bound("ff");
piter = file->SelectLeftRangePrefetched(rightBoundary);
tassert(piter != 0);
AssertIteratorsEqualString(piter, testData.begin(), endIter);
delete piter;
beginIter = testData.find("c");
piter = file->SelectRightRangePrefetched(leftBoundary);
tassert(piter != 0);
AssertIteratorsEqualString(piter, beginIter, testData.end());
delete piter;
beginIter = testData.find("e");
piter = file->SelectRightRangePrefetched(leftBoundaryE);
tassert(piter != 0);
AssertIteratorsEqualString(piter, beginIter, testData.end());
delete piter;
beginIter = testData.find("c");
endIter = testData.lower_bound("ff");
piter = file->SelectRangePrefetched(leftBoundary, rightBoundary);
tassert(piter != 0);
AssertIteratorsEqualString(piter, beginIter, endIter);
delete piter;
piter = file->SelectRangePrefetched(farLeftBoundary, farRightBoundary);
tassert(piter != 0);
AssertIteratorsEqualString(piter, testData.begin(), testData.end());
delete piter;
beginIter = testData.find("c");
piter = file->SelectRangePrefetched(leftBoundary, farRightBoundary);
tassert(piter != 0);
AssertIteratorsEqualString(piter, beginIter, testData.end());
delete piter;
endIter = testData.lower_bound("ff");
piter = file->SelectRangePrefetched(farLeftBoundary, rightBoundary);
tassert(piter != 0);
AssertIteratorsEqualString(piter, testData.begin(), endIter);
delete piter;
piter = file->SelectRangePrefetched(SmiKey("__"), SmiKey("_____"));
tassert(piter != 0);
tassert(!piter->Next());
delete piter;
piter = file->SelectRangePrefetched(SmiKey("yyy"), SmiKey("zzz"));
tassert(piter != 0);
tassert(!piter->Next());
delete piter;
tassert(file->Close());
tassert(file->Drop());
delete file;
file = 0;
/* Test wether iterator also works correctly for empty files */
file = new SmiKeyedFile(SmiKey::String, false);
tassert(file != 0);
//.........这里部分代码省略.........
示例4: TestRecnoIterator
void TestRecnoIterator()
{
EnterTestFun();
SmiRecordFile* file = new SmiRecordFile(false);
tassert(file != 0);
tassert(file->Create());
PrefetchingIterator* piter;
SmiRecordId id;
string str;
set<SmiRecordId> createdIds;
TestData testData;
TestData::iterator iter;
GenerateTestData(testData);
for(iter = testData.begin(); iter != testData.end(); ++iter)
{
SmiRecord record;
string s = iter->second;
tassert(file->AppendRecord(id, record));
tassert(record.Write(s.c_str(), s.size()) == s.size());
createdIds.insert(id);
}
tassert(createdIds.size() == testData.size());
piter = file->SelectAllPrefetched();
tassert(piter != 0);
AssertIteratorsEqualRecno(piter, testData.begin(), testData.end(), createdIds);
delete piter;
tassert(file->DeleteRecord(*(createdIds.begin())));
createdIds.erase(createdIds.begin());
testData.erase(testData.begin());
piter = file->SelectAllPrefetched();
tassert(piter != 0);
AssertIteratorsEqualRecno(piter, testData.begin(), testData.end(), createdIds);
delete piter;
tassert(file->Close());
tassert(file->Drop());
delete file;
file = 0;
/* Test wether iterator also works correctly for empty files */
file = new SmiRecordFile(false);
tassert(file != 0);
tassert(file->Create());
piter = file->SelectAllPrefetched();
tassert(piter != 0);
tassert(!piter->Next());
delete piter;
tassert(file->Close());
tassert(file->Drop());
delete file;
ExitTestFun(__PRETTY_FUNCTION__);
}