本文整理汇总了C++中TestRunner::getVerbosityLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner::getVerbosityLevel方法的具体用法?C++ TestRunner::getVerbosityLevel怎么用?C++ TestRunner::getVerbosityLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestRunner
的用法示例。
在下文中一共展示了TestRunner::getVerbosityLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _checkUrlText
/**
* Check a GET to a url returns a certain code and data.
*/
static void _checkUrlText(
TestRunner& tr, Url* url, int code, const char* expected, int length)
{
// create client
HttpClient client;
// connect
assertNoException(client.connect(url));
if(tr.getVerbosityLevel() > 1)
{
printf("Connected to: %s\n", url->toString().c_str());
InternetAddress address(url->getHost().c_str(), url->getPort());
printf("%s\n", address.toString().c_str());
}
// do get
HttpResponse* response = client.get(url);
assert(response != NULL);
if(tr.getVerbosityLevel() > 1)
{
printf("Response header:\n%s\n",
response->getHeader()->toString().c_str());
}
if(response->getHeader()->getStatusCode() != code)
{
printf("Expecting response status code: %d, got %d\n",
response->getHeader()->getStatusCode(), code);
}
assert(response->getHeader()->getStatusCode() == code);
// receive content
HttpTrailer trailer;
ByteBuffer b;
ByteArrayOutputStream baos(&b);
assertNoException(client.receiveContent(&baos, &trailer));
// put data in strings for strcmp since it may not be NULL terminated
string strexpected;
strexpected.assign(expected, length);
string strdata;
strdata.assign(b.data(), b.length());
if(tr.getVerbosityLevel() > 1)
{
printf("Response content (%d bytes):\n%s\n", b.length(), strdata.c_str());
printf("Response trailers:\n%s\n", trailer.toString().c_str());
}
// check content
assertStrCmp(strdata.c_str(), strexpected.c_str());
assert(b.length() == length);
client.disconnect();
assertNoExceptionSet();
}
示例2: runConfigTest
static void runConfigTest(Node& node, TestRunner& tr)
{
tr.group("config");
tr.test("user configs");
{
/*{
printf("config debug:\n");
Config c = node.getConfigManager()->getDebugInfo();
JsonWriter::writeToStdOut(c, false, false);
assertNoException();
}*/
UserId userId;
bool loggedin = node.login("devuser", "password", &userId);
assertNoExceptionSet();
assert(loggedin);
{
Config c = node.getConfigManager()->getUserConfig(userId, true);
assert(!c.isNull());
if(tr.getVerbosityLevel() > 1)
{
printf("raw user %" PRIu64 " config:\n", userId);
JsonWriter::writeToStdOut(c, false, false);
assertNoExceptionSet();
}
}
{
Config c = node.getConfigManager()->getUserConfig(userId);
assert(!c.isNull());
if(tr.getVerbosityLevel() > 1)
{
printf("user %" PRIu64 " config:\n", userId);
JsonWriter::writeToStdOut(c, false, false);
assertNoExceptionSet();
}
}
node.logout(userId);
assertNoExceptionSet();
}
tr.passIfNoException();
tr.ungroup();
}