本文整理汇总了C++中Tester::validate方法的典型用法代码示例。如果您正苦于以下问题:C++ Tester::validate方法的具体用法?C++ Tester::validate怎么用?C++ Tester::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tester
的用法示例。
在下文中一共展示了Tester::validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
std::random_device randomDevice; // used for seeding
std::default_random_engine generator(randomDevice());
std::uniform_int_distribution<unsigned> distribution(0,RandomSpread);
Tester tester;
if (argc < 0) tester.dump(); // force this to be used
auto next = [&] { return distribution(generator); };
llvm::SmallString<128> key;
while (true) {
auto operation = next();
// Add elements to key.
if (operation <= .15 * RandomSpread) {
unsigned n = next() % 1 ? 5 : 7;
for (unsigned i = 0; i != n; ++i)
key.push_back('a' + (next() % 26));
// Remove elements from key.
} else if (operation <= .3 * RandomSpread) {
unsigned n = next() % 1 ? 5 : 7;
for (unsigned i = 0; i != n; ++i)
if (!key.empty()) key.pop_back();
// Insert.
} else if (operation <= .7 * RandomSpread) {
unsigned value = next();
llvm::outs() << " tester.insert(\"" << key << "\", " << value << ");\n";
tester.insert(key, value);
// Find.
} else if (operation <= .98 * RandomSpread) {
llvm::outs() << " tester.find(\"" << key << "\");\n";
tester.find(key);
// Clear.
} else {
llvm::outs() << " tester.clear();\n";
tester.clear();
}
llvm::outs() << " tester.validate();\n";
tester.validate();
}
}