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


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

本文整理汇总了C++中TestRunner::group方法的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner::group方法的具体用法?C++ TestRunner::group怎么用?C++ TestRunner::group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestRunner的用法示例。


在下文中一共展示了TestRunner::group方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runFiberYieldTest

static void runFiberYieldTest(TestRunner& tr)
{
   tr.group("Fiber Yield");

   tr.test("10 yielding fibers/10 iterations");
   {
      Kernel k;
      k.getEngine()->start();

      FiberScheduler fs;

      // queue up some fibers prior to starting
      for(int i = 0; i < 10; ++i)
      {
         fs.addFiber(new TestFiber(10));
      }

      uint64_t startTime = Timer::startTiming();
      fs.start(&k, 1);

      fs.waitForLastFiberExit(true);
      printf("time=%g secs... ", Timer::getSeconds(startTime));

      k.getEngine()->stop();
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:bsletten,项目名称:monarch,代码行数:29,代码来源:test-fiber-yield.cpp

示例2: userAddTest

static void userAddTest(Node& node, TestRunner& tr)
{
   tr.group("user add");

   Messenger* messenger = node.getMessenger();

   tr.test("add (valid)");
   {
      Url url("/api/3.0/users");

      // password update
      User user;
      user["email"] = "[email protected]";
      user["username"] = "testuser1";
      user["password"] = "password";
      user["confirm"] = "password";
      user["tosAgree"] = "agree";

      assertNoException(
         messenger->postSecureToBitmunk(
            &url, &user, NULL, node.getDefaultUserId()));

      printf("\nUser added.\n");
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:28,代码来源:test-node-services.cpp

示例3: accountGetTest

static void accountGetTest(Node& node, TestRunner& tr)
{
   tr.group("accounts");

   Messenger* messenger = node.getMessenger();

   tr.test("get");
   {
      Url url("/api/3.0/accounts/?owner=900");

      // get all accounts
      User user;
      messenger->getSecureFromBitmunk(&url, user, node.getDefaultUserId());
      printf("\nAccounts:\n");
      dumpDynamicObject(user);
   }
   tr.passIfNoException();

   tr.ungroup();

   tr.group("account");

   tr.test("get");
   {
      // create url for obtaining users
      Url url("/api/3.0/accounts/9000");

      // get account
      Account account;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, account, node.getDefaultUserId()));

      printf("\nAccount:\n");
      dumpDynamicObject(account, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:40,代码来源:test-node-services.cpp

示例4: contributorGetTest

static void contributorGetTest(Node& node, TestRunner& tr)
{
   tr.group("contributors");

   Messenger* messenger = node.getMessenger();

   tr.test("id");
   {
      Url url("/api/3.0/contributors/1");

      // get contributor
      DynamicObject contributor;
      assertNoException(
         messenger->getFromBitmunk(&url, contributor));

      printf("\nContributor:\n");
      dumpDynamicObject(contributor, false);
   }
   tr.passIfNoException();

   tr.test("owner");
   {
      Url url("/api/3.0/contributors/?owner=900");

      // get contributor
      DynamicObject contributors;
      assertNoException(
         messenger->getFromBitmunk(&url, contributors));

      printf("\nContributors:\n");
      dumpDynamicObject(contributors, false);
   }
   tr.passIfNoException();

   tr.test("media");
   {
      Url url("/api/3.0/contributors/?media=1");

      // get contributor
      DynamicObject contributors;
      assertNoException(
         messenger->getFromBitmunk(&url, contributors));

      printf("\nContributors:\n");
      dumpDynamicObject(contributors, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:50,代码来源:test-node-services.cpp

示例5: pingPerfTest

static void pingPerfTest(Node& node, TestRunner& tr)
{
   tr.group("ping perf");

   Messenger* messenger = node.getMessenger();

   // number of loops for each test
   Config cfg = tr.getApp()->getConfig();
   //node.getConfigManager()->getConfig(
   //   tester->getApp()->getMetaConfig()["groups"]["main"]->getString());
   int n = cfg->hasMember("loops") ? cfg["loops"]->getInt32() : 50;

   tr.test("insecure get");
   {
      Url url("/api/3.0/system/test/ping");

      DynamicObject dummy;
      uint64_t startTime = Timer::startTiming();
      for(int i = 0; i < n; ++i)
      {
         messenger->getFromBitmunk(&url, dummy);
      }
      double dt = Timer::getSeconds(startTime);
      printf("t=%g ms, r=%g ms, r/s=%g",  dt * 1000.0, dt/n * 1000.0, n/dt);
   }
   tr.passIfNoException();

   tr.test("secure get");
   {
      Url url("/api/3.0/system/test/ping");

      DynamicObject dummy;
      uint64_t startTime = Timer::startTiming();
      for(int i = 0; i < n; ++i)
      {
         messenger->getSecureFromBitmunk(&url, dummy, node.getDefaultUserId());
      }
      double dt = Timer::getSeconds(startTime);
      printf("t=%g ms, r=%g ms, r/s=%g",  dt * 1000.0, dt/n * 1000.0, n/dt);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:44,代码来源:test-node-services.cpp

示例6: 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

示例7: accountGetPerfTest

static void accountGetPerfTest(Node& node, TestRunner& tr)
{
   tr.group("accounts perf");

   Messenger* messenger = node.getMessenger();

   // number of loops
   int n = 25;

   tr.test("insecure get");
   {
      Url url("/api/3.0/accounts/?owner=900");

      uint64_t startTime = Timer::startTiming();
      for(int i = 0; i < n; ++i)
      {
         User user;
         messenger->getFromBitmunk(&url, user);
      }
      double dt = Timer::getSeconds(startTime);
      printf("t=%g ms, r=%g ms, r/s=%g",  dt * 1000.0, dt/n * 1000.0, n/dt);
   }
   tr.passIfNoException();

   tr.test("secure get");
   {
      Url url("/api/3.0/accounts/?owner=900");

      uint64_t startTime = Timer::startTiming();
      for(int i = 0; i < n; ++i)
      {
         User user;
         messenger->getFromBitmunk(&url, user, node.getDefaultUserId());
      }
      double dt = Timer::getSeconds(startTime);
      printf("t=%g ms, r=%g ms, r/s=%g",  dt * 1000.0, dt/n * 1000.0, n/dt);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:41,代码来源:test-node-services.cpp

示例8: reviewGetTest

static void reviewGetTest(Node& node, TestRunner& tr)
{
   tr.group("reviews");

   Messenger* messenger = node.getMessenger();

   tr.test("user get");
   {
      // create url for obtaining user reviews
      Url url("/api/3.0/reviews/user/900");

      // get account
      DynamicObject reviews;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, reviews, node.getDefaultUserId()));

      printf("\nReviews:\n");
      dumpDynamicObject(reviews, false);
   }
   tr.passIfNoException();

   tr.test("media get");
   {
      // create url for obtaining media reviews
      Url url("/api/3.0/reviews/media/1");

      // get account
      DynamicObject reviews;
      assertNoException(
         messenger->getSecureFromBitmunk(
            &url, reviews, node.getDefaultUserId()));

      printf("\nReviews:\n");
      dumpDynamicObject(reviews, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:40,代码来源:test-node-services.cpp

示例9: permissionGetTest

static void permissionGetTest(Node& node, TestRunner& tr)
{
   tr.group("permissions");

   Messenger* messenger = node.getMessenger();

   tr.test("group get");
   {
      // create url for obtaining permission group information
      Url url("/api/3.0/permissions/100");

      // get permission group
      PermissionGroup group;
      assertNoException(
         messenger->getFromBitmunk(&url, group));

      printf("\nGroup:\n");
      dumpDynamicObject(group, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:23,代码来源:test-node-services.cpp

示例10: acquireLicenseTest

static void acquireLicenseTest(Node& node, TestRunner& tr)
{
   tr.group("media license");

   Messenger* messenger = node.getMessenger();

   tr.test("acquire signed media");
   {
      // create url for obtaining media license
      Url url("/api/3.0/sva/contracts/media/2");

      // get signed media
      Media media;
      assertNoException(
         messenger->postSecureToBitmunk(
            &url, NULL, &media, node.getDefaultUserId()));

      printf("\nSigned Media:\n");
      dumpDynamicObject(media, false);
   }
   tr.passIfNoException();

   tr.ungroup();
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:24,代码来源:test-node-services.cpp

示例11: runDynoIterTest

static void runDynoIterTest(TestRunner& tr)
{
   tr.group("DynamicObject iter perf");

   bool all = false;
   Config cfg = tr.getApp()->getConfig();
   if(cfg->hasMember("all"))
   {
      all = cfg["all"]->getBoolean();
   }
   if(all)
   {
      //runDynoIterTest1(tr, "array s:10M  i:1    ", 10000000, 1);
      runDynoIterTest1(tr, "array s:1M   i:1    ", 1000000,  1);
      runDynoIterTest1(tr, "array s:1M   i:2    ", 1000000,  2);
      runDynoIterTest1(tr, "array s:1M   i:5    ", 1000000,  5);
      runDynoIterTest1(tr, "array s:1M   i:10   ", 1000000, 10);
   }
   runDynoIterTest1(tr, "array s:100K i:100  ", 100000, 100);
   runDynoIterTest1(tr, "array s:10K  i:1K   ", 10000, 1000);
   runDynoIterTest1(tr, "array s:1K   i:10K  ", 1000, 10000);
   runDynoIterTest1(tr, "array s:100  i:100K ", 100, 100000);
   runDynoIterTest1(tr, "array s:10   i:1M   ", 10, 1000000);
   if(all)
   {
      runDynoIterTest1(tr, "array s:5    i:1M   ", 5,  1000000);
      runDynoIterTest1(tr, "array s:2    i:1M   ", 2,  1000000);
      runDynoIterTest1(tr, "array s:1    i:1M   ", 1,  1000000);
      runDynoIterTest1(tr, "array s:0    i:1M   ", 0,  1000000);
      //runDynoIterTest1(tr, "array s:5    i:2M   ", 5,  2000000);
      //runDynoIterTest1(tr, "array s:2    i:5M   ", 2,  5000000);
      //runDynoIterTest1(tr, "array s:1    i:10M  ", 1, 10000000);
   }

   tr.ungroup();
}
开发者ID:zengyuxing007,项目名称:monarch,代码行数:36,代码来源:test-dyno-perf.cpp

示例12: interactiveCustomCatalogTests

static void interactiveCustomCatalogTests(Node& node, TestRunner& tr)
{
   Messenger* messenger = node.getMessenger();

   tr.group("customcatalog+listing updater");

   // generate the ware URLs that will be used throughout the test.
   Url waresUrl;
   waresUrl.format("%s/api/3.0/catalog/wares?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_USER_ID);
   Url wareUrl;
   wareUrl.format("%s/api/3.0/catalog/wares/%s?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_WARE_ID_2, TEST_USER_ID);

   // generate the files URL that will be used to prime the medialibrary
   Url filesUrl;
   filesUrl.format("%s/api/3.2/medialibrary/files?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_USER_ID);
   Url removeUrl;
   removeUrl.format(
      "%s/api/3.2/medialibrary/files/%s?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_FILE_ID_2, TEST_USER_ID);

   // remove any previous files from the media library
   messenger->deleteResource(&removeUrl, NULL, node.getDefaultUserId());
   // pass even if there is an exception - this is meant to just clear any
   // previous entries in the medialibrary database if they existed.
   Exception::clear();

   tr.test("add file to medialibrary (valid)");
   {
      DynamicObject in;
      DynamicObject out;

      // create a FileInfo object
      string normalizedPath;
      File::normalizePath(
         (sTestDataDir + TEST_FILENAME_2).c_str(), normalizedPath);
      out["path"] = normalizedPath.c_str();
      out["mediaId"] = 2;

      // prepare event waiter
      EventWaiter ew(node.getEventController());
      ew.start("bitmunk.medialibrary.File.updated");
      ew.start("bitmunk.medialibrary.File.exception");

      // add the file to the media library
      assertNoException(
         messenger->post(&filesUrl, &out, &in, node.getDefaultUserId()));

      // wait for file ID set event
      assert(ew.waitForEvent(5*1000));

      // ensure it has an exception
      Event e = ew.popEvent();
      //dumpDynamicObject(e);
      if(e["details"]->hasMember("exception"))
      {
         ExceptionRef ex = Exception::convertToException(
            e["details"]["exception"]);
         Exception::set(ex);
      }
   }
   tr.passIfNoException();

   tr.test("add ware without payee-scheme (valid)");
   {
      DynamicObject in;
      DynamicObject out;

      // create the outgoing ware object
      FileInfo fi;
      fi["id"] = TEST_FILE_ID_2;

      out["id"] = TEST_WARE_ID_2;
      out["mediaId"] = 2;
      out["description"] = "This ware was added by test-services-customcatalog";
      out["fileInfo"] = fi;
      out["payees"]->setType(Array);
      Payee p1 = out["payees"]->append();
      Payee p2 = out["payees"]->append();

      p1["id"] = 900;
      p1["amountType"] = PAYEE_AMOUNT_TYPE_FLATFEE;
      p1["amount"] = "0.10";
      p1["description"] = "This payee is for media ID 2";

      p2["id"] = 900;
      p2["amountType"] = PAYEE_AMOUNT_TYPE_PTOTAL;
      p2["percentage"] = "0.10";
      p2["description"] = "This payee is for media ID 2";

      // add the ware to the custom catalog
      messenger->post(&waresUrl, &out, &in, node.getDefaultUserId());
   }
   tr.passIfNoException();

   printf("\nWaiting for server info to update...\n");
   Thread::sleep(2*1000);

//.........这里部分代码省略.........
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:101,代码来源:test-services-customcatalog.cpp

示例13: customCatalogTests

static void customCatalogTests(Node& node, TestRunner& tr)
{
   resetTestEnvironment(node);

   Messenger* messenger = node.getMessenger();

   // generate the ware URLs that will be used throughout the test.
   Url waresUrl;
   waresUrl.format(
      "%s/api/3.0/catalog/wares?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_USER_ID);
   Url waresNonDefaultListUrl;
   waresNonDefaultListUrl.format(
      "%s/api/3.0/catalog/wares?nodeuser=%" PRIu64 "&id=%s&default=false",
      messenger->getSelfUrl(true).c_str(), TEST_USER_ID, TEST_WARE_ID_2);
   Url wareUrl;
   wareUrl.format(
      "%s/api/3.0/catalog/wares/%s?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_WARE_ID_2, TEST_USER_ID);

   // generate the files URL that will be used to prime the medialibrary
   Url filesUrl;
   filesUrl.format("%s/api/3.2/medialibrary/files?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_USER_ID);
   Url removeUrl;
   removeUrl.format(
      "%s/api/3.2/medialibrary/files/%s?nodeuser=%" PRIu64,
      messenger->getSelfUrl(true).c_str(), TEST_FILE_ID_2, TEST_USER_ID);

   // Create basic and detailed test ware with id=2
   Ware basicWare2;
   Ware detailedWare2;
   {
      basicWare2["id"] = TEST_WARE_ID_2;
      basicWare2["description"] =
         "This ware was added by test-services-customcatalog";

      detailedWare2 = basicWare2.clone();
      detailedWare2["mediaId"] = 2;
      detailedWare2["fileInfos"]->setType(Array);
      FileInfo fi = detailedWare2["fileInfos"]->append();
      fi["id"] = TEST_FILE_ID_2;
      fi["mediaId"] = 2;
      File file((sTestDataDir + TEST_FILENAME_2).c_str());
      fi["extension"] = file->getExtension() + 1;
      fi["contentType"] = "audio/mpeg";
      fi["contentSize"] = TEST_CONTENT_SIZE_2;
      fi["size"] = (uint64_t)file->getLength();
      fi["path"] = file->getAbsolutePath();

      detailedWare2["payees"]->setType(Array);
      Payee p1 = detailedWare2["payees"]->append();
      Payee p2 = detailedWare2["payees"]->append();

      p1["id"] = 900;
      p1["amountType"] = PAYEE_AMOUNT_TYPE_FLATFEE;
      p1["amount"] = "0.10";
      p1["description"] = "This payee is for media ID 2";

      p2["id"] = 900;
      p2["amountType"] = PAYEE_AMOUNT_TYPE_PTOTAL;
      p2["percentage"] = "0.10";
      p2["description"] = "This payee is for media ID 2";
   }

   // remove any previous files from the media library
   messenger->deleteResource(&removeUrl, NULL, node.getDefaultUserId());
   // pass even if there is an exception - this is meant to just clear any
   // previous entries in the medialibrary database if they existed.
   Exception::clear();

   tr.group("customcatalog");

   tr.test("add file to medialibrary (valid)");
   {
      DynamicObject in;
      DynamicObject out;

      // create a FileInfo object
      string normalizedPath;
      File::normalizePath(
         (sTestDataDir + TEST_FILENAME_2).c_str(), normalizedPath);
      out["path"] = normalizedPath.c_str();
      out["mediaId"] = 2;

      // prepare event waiter
      EventWaiter ew(node.getEventController());
      ew.start("bitmunk.medialibrary.File.updated");
      ew.start("bitmunk.medialibrary.File.exception");

      // add the file to the media library
      assertNoException(
         messenger->post(&filesUrl, &out, &in, node.getDefaultUserId()));

      // wait for file ID set event
      assert(ew.waitForEvent(5*1000));

      // ensure it has an exception
      Event e = ew.popEvent();
      //dumpDynamicObject(e);
//.........这里部分代码省略.........
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:101,代码来源:test-services-customcatalog.cpp

示例14: userUpdateTest

static void userUpdateTest(Node& node, TestRunner& tr)
{
   tr.group("user update");

   /*
   Messenger* messenger = node.getMessenger();

   tr.test("password (valid)");
   {
      Url url("/api/3.0/users/password");

      // password update
      User user;
      user["id"] = 70238;
      user["oldPassword"] = "password";
      user["password"] = "omgpants";
      user["confirm"] = "omgpants";

      // change password
      messenger->postSecureToBitmunk(
         &url, &user, NULL, BM_USER_ID(user["id"]));
      assertNoException();

      printf("\nUser password updated 1st time.\n");

      user["oldPassword"] = "omgpants";
      user["password"] = "password";
      user["confirm"] = "password";

      // change password back
      messenger->postSecureToBitmunk(
         &url, &user, NULL, BM_USER_ID(user["id"]));
      assertNoException();

      printf("User password updated 2nd time.\n");
   }
   tr.passIfNoException();
   */

   /*
   tr.test("password code");
   {
      Url url("/api/3.0/users/password/69766");

      messenger->deleteSecureFromBitmunk(
         &url, NULL, node.getDefaultUserId());
      assertNoException();

      printf("\nPassword reset code emailed.\n");
   }
   tr.passIfNoException();
   */

   /*
   tr.test("post email code");
   {
      Url url("/api/3.0/users/emailcode");

      // output
      User user;
      user["email"] = "[email protected]";

      messenger->postToBitmunk(&url, &user);
      assertNoException();

      printf("\nCode emailed.\n");
   }
   tr.passIfNoException();
   */

   /*
   tr.test("put email code");
   {
      Url url("/api/3.0/users/emailcode/900");

      // output
      User user;
      user["emailCode"] = "1234567";

      printf("user id=%" PRIu64 "\n", node.getDefaultUserId());

      messenger->putSecureToBitmunk(&url, user, NULL, node.getDefaultUserId());
      assertNoException();

      printf("\nEmail verified.\n");
   }
   tr.passIfNoException();
   */

   /*
   tr.test("password - email code (valid)");
   {
      Url url("/api/3.0/users/password");

      // input
      DynamicObject in;

      // password update
      User user;
      user["id"] = 900;
//.........这里部分代码省略.........
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:101,代码来源:test-node-services.cpp

示例15: mediaGetTest

static void mediaGetTest(Node& node, TestRunner& tr)
{
   tr.group("media");

   Messenger* messenger = node.getMessenger();

   tr.test("get");
   {
      // create url for obtaining media
      Url url("/api/3.0/media/2");

      // get media
      Media media;
      assertNoException(
         messenger->getFromBitmunk(&url, media));

      printf("\nMedia:\n");
      dumpDynamicObject(media, false);
   }
   tr.passIfNoException();

   tr.test("invalid get");
   {
      // create url for obtaining media
      Url url("/api/3.0/media/invalidMediaId");

      // get media
      Media media;
      messenger->getFromBitmunk(&url, media);
   }
   tr.passIfException();

   tr.test("all");
   {
      // create url for getting media
      Url url("/api/3.0/media/?start=0&num=5");

      // get results
      DynamicObject results;
      //assertNoException(
      //   messenger->getFromBitmunk(&url, results));

      printf("\nDISABLED FOR PERFORMANCE\n");
      /*
      printf("\nGetting 5 media starting at #0\n(of %" PRIu32 " found)\n",
         results["total"]->getUInt32());
      dumpDynamicObject(results, false);
      */
   }
   tr.passIfNoException();

   tr.test("owned");
   {
      // create url for searching media
      Url url("/api/3.0/media?owner=900");

      // get results
      DynamicObject results;
      assertNoException(
         messenger->getFromBitmunk(&url, results));

      printf("\nMedia owned by user 900\n");
      printf("Results %" PRIu32 "-%" PRIu32 " of %" PRIu32 "\n",
         results["start"]->getUInt32(),
         results["start"]->getUInt32() + results["num"]->getUInt32(),
         results["total"]->getUInt32());
      dumpDynamicObject(results, false);
   }
   tr.passIfNoException();

   tr.test("search");
   {
      // create url for searching media
      Url url("/api/3.0/media/?query=test&start=0&num=10");

      // get results
      DynamicObject results;
      assertNoException(
         messenger->getFromBitmunk(&url, results));

      printf("\nSearching media & contributors for 'test'\n");
      printf("Results %" PRIu32 "-%" PRIu32 " of %" PRIu32 "\n",
         results["start"]->getUInt32(),
         results["start"]->getUInt32() + results["num"]->getUInt32(),
         results["total"]->getUInt32());
      dumpDynamicObject(results, false);
   }
   tr.passIfNoException();

   tr.test("genre media");
   {
      // create url for searching media
      Url url("/api/3.0/media?type=audio&genre=165&start=4&num=5");

      // get results
      DynamicObject results;
      assertNoException(
         messenger->getFromBitmunk(&url, results));

      printf("\nAudio from genre 165\n");
//.........这里部分代码省略.........
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:101,代码来源:test-node-services.cpp


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