本文整理汇总了C++中TestRunner::ungroup方法的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner::ungroup方法的具体用法?C++ TestRunner::ungroup怎么用?C++ TestRunner::ungroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestRunner
的用法示例。
在下文中一共展示了TestRunner::ungroup方法的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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例12: interactiveCustomCatalogTests
//.........这里部分代码省略.........
"%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);
while(true)
{
tr.test("get server info");
{
Url serverUrl;
serverUrl.format("%s/api/3.0/catalog/server?nodeuser=%" PRIu64,
messenger->getSelfUrl(true).c_str(), TEST_USER_ID);
DynamicObject in;
messenger->get(&serverUrl, in, node.getDefaultUserId());
dumpDynamicObject(in);
}
tr.passIfNoException();
printf(
"\nSleeping to allow listing updater to run. Hit CTRL+C to quit.\n");
Thread::sleep(30*1000);
}
tr.ungroup();
}
示例13: customCatalogTests
//.........这里部分代码省略.........
out["description"] = "Payee scheme description 2";
Payee p1 = out["payees"]->append();
Payee p2 = out["payees"]->append();
p1["id"] = 900;
p1["amountType"] = PAYEE_AMOUNT_TYPE_FLATFEE;
p1["amount"] = "0.15";
p1["description"] = "test-services-customcatalog test payee 1 (updated)";
p2["id"] = 900;
p2["amountType"] = PAYEE_AMOUNT_TYPE_PTOTAL;
p2["percentage"] = "0.14";
p2["description"] = "test-services-customcatalog test payee 2 (updated)";
// update a pre-existing payee scheme
assertNoException(
messenger->post(
&payeeSchemeIdUrl, &out, &in, node.getDefaultUserId()));
// ensure that the payee scheme was updated
assert(in["payeeSchemeId"]->getUInt32() == 2);
if(in->hasMember("payeeSchemeId"))
{
psId = in["payeeSchemeId"]->getUInt32();
}
}
tr.passIfNoException();
tr.test("add ware with 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["payeeSchemeId"] = psId;
// add the ware to the custom catalog
messenger->post(&waresUrl, &out, &in, node.getDefaultUserId());
}
tr.passIfNoException();
tr.test("remove associated payee scheme (invalid)");
{
messenger->deleteResource(
&payeeSchemeIdUrl, NULL, node.getDefaultUserId());
}
tr.passIfException();
tr.test("remove ware associated w/ payee scheme (valid)");
{
messenger->deleteResource(
&wareUrl, NULL, node.getDefaultUserId());
}
tr.passIfNoException();
tr.test("remove payee scheme (valid)");
{
messenger->deleteResource(
&payeeSchemeIdUrl, NULL, node.getDefaultUserId());
}
tr.passIfNoException();
tr.test("create ware w/ invalid payee scheme (invalid)");
{
DynamicObject in;
DynamicObject out;
// create the outgoing ware object
FileInfo fi;
fi["id"] = TEST_FILE_ID_2;
PayeeScheme ps;
ps["id"] = psId;
out["id"] = TEST_WARE_ID_2;
out["mediaId"] = 2;
out["description"] = "This ware was added by test-services-customcatalog";
out["fileInfo"] = fi;
out["payeeScheme"] = ps;
// add the ware to the custom catalog
messenger->post(&waresUrl, &out, &in, node.getDefaultUserId());
}
tr.passIfException();
tr.test("remove ware (invalid)");
{
// remove a ware that doesn't exist
messenger->deleteResource(&wareUrl, NULL, node.getDefaultUserId());
}
tr.passIfException();
tr.ungroup();
}
示例14: userUpdateTest
//.........这里部分代码省略.........
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;
user["emailCode"] = "1234567";
user["password"] = "password";
user["confirm"] = "password";
messenger->postSecureToBitmunk(&url, &user, &in, node.getDefaultUserId());
assertNoException();
printf("\nUser Password:\n");
dumpDynamicObject(in, false);
}
tr.passIfNoException();
*/
/*
tr.test("put identity (valid)");
{
// create url for obtaining users
Url url("/api/3.0/users/identity/900");
// post identity form
DynamicObject form;
form["signedStatement"]["statement"] =
"This is the statement that must be signed.";
form["signedStatement"]["signature"] =
"/DEV USER/";
// create identity
Identity& identity = form["identity"];
identity["userId"] = 900;
identity["firstName"] = "DEV";
identity["lastName"] = "USER";
Address& address = identity["address"];
address["street"] = "1700 Kraft Dr. Suite 2408";
address["locality"] = "Blacksburg";
address["region"] = "Virginia";
address["postalCode"] = "24060";
address["countryCode"] = "US";
Identity in;
messenger->putSecureToBitmunk(&url, form, &in, node.getDefaultUserId());
assertNoException();
printf("\nIdentity:\n");
dumpDynamicObject(in, false);
}
tr.passIfNoException();
*/
/*
tr.test("put identity (invalid)");
{
// create url for obtaining users
Url url("/api/3.0/users/identity/69776");
// post identity form
DynamicObject form;
form["signedStatement"]["statement"] =
"This is the statement that must be signed.";
form["signedStatement"]["signature"] =
"/Dev User/";
// create identity
Identity& identity = form["identity"];
identity["userId"] = 900;
identity["firstName"] = "Dev";
identity["lastName"] = "User";
Address& address = identity["address"];
address["street"] = "1700 Kraft Dr. Suite 2408";
address["locality"] = "Blacksburg";
address["region"] = "Virginia";
address["postalCode"] = "24060";
address["countryCode"] = "US";
Identity in;
messenger->putSecureToBitmunk(&url, form, &in, node.getDefaultUserId());
assertException();
printf("\nException:\n");
dumpException();
Exception::clearLast();
}
tr.passIfNoException();
*/
tr.ungroup();
}
示例15: mediaGetTest
//.........这里部分代码省略.........
// 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");
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("media list");
{
// create url for searching media
Url url("/api/3.0/media?owner=1&list=1");
// get results
DynamicObject results;
assertNoException(
messenger->getFromBitmunk(&url, results));
printf("\nMedia list %s\n", results["name"]->getString());
printf("\"%s\"\n", results["description"]->getString());
dumpDynamicObject(results, false);
}
tr.passIfNoException();
tr.ungroup();
}