当前位置: 首页>>代码示例>>C++>>正文


C++ TestRunner::getVerbosityLevel方法代码示例

本文整理汇总了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();
}
开发者ID:bsletten,项目名称:monarch,代码行数:63,代码来源:test-ws.cpp

示例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();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:43,代码来源:test-config.cpp


注:本文中的TestRunner::getVerbosityLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。