本文整理汇总了C++中Updater::run方法的典型用法代码示例。如果您正苦于以下问题:C++ Updater::run方法的具体用法?C++ Updater::run怎么用?C++ Updater::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testRun
void UpdaterTest::testRun()
{
vector<string> versionStrings;
versionStrings.push_back("800");
versionStrings.push_back("900");
versionStrings.push_back("1000");
versionStrings.push_back("Error, no connection");
versionStrings.push_back("1100");
versionStrings.push_back("1200");
MockUpdateServer *mus = new MockUpdateServer(versionStrings);
Updater *u = new Updater((UpdateServer*)mus, 1100, ".", 0, 0, 0);
u->run();
vector<bool> wasDownloadAttempted = mus->_recordedDownloadAttemptsAfterUpdateChecks;
CPPUNIT_ASSERT_EQUAL((size_t)6, wasDownloadAttempted.size());
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[0]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[1]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[2]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[3]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[4]);
CPPUNIT_ASSERT_EQUAL(true, (bool)wasDownloadAttempted[5]);
delete mus;
delete u;
}
示例2: testRunTiming
void UpdaterTest::testRunTiming()
{
vector<string> versionStrings;
versionStrings.push_back("800");
versionStrings.push_back("900");
versionStrings.push_back("1000");
versionStrings.push_back("Error, no connection");
versionStrings.push_back("1100");
versionStrings.push_back("1200");
MockUpdateServer *mus = new MockUpdateServer(versionStrings);
int currentVersion = 1100;
uint retryTimeAfterFailedUpdateCheck = 50;
uint timeBetweenUpdateChecks = 150;
Updater *u = new Updater((UpdateServer*)mus,
currentVersion,
".",
retryTimeAfterFailedUpdateCheck,
timeBetweenUpdateChecks,
0);
u->run();
vector<bool> wasDownloadAttempted = mus->_recordedDownloadAttemptsAfterUpdateChecks;
CPPUNIT_ASSERT_EQUAL((size_t)6, wasDownloadAttempted.size());
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[0]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[1]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[2]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[3]);
CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[4]);
CPPUNIT_ASSERT_EQUAL(true, (bool)wasDownloadAttempted[5]);
vector<uint> timeBetweenDownloadAttempts = mus->_recordedTimeForEachUpdateCheck;
CPPUNIT_ASSERT_EQUAL((size_t)6, timeBetweenDownloadAttempts.size());
CPPUNIT_ASSERT(timeBetweenDownloadAttempts[0] < 10);
CPPUNIT_ASSERT(145 < timeBetweenDownloadAttempts[1] && timeBetweenDownloadAttempts[1] < 155);
CPPUNIT_ASSERT(145 < timeBetweenDownloadAttempts[2] && timeBetweenDownloadAttempts[2] < 155);
CPPUNIT_ASSERT(145 < timeBetweenDownloadAttempts[3] && timeBetweenDownloadAttempts[3] < 155);
CPPUNIT_ASSERT(45 < timeBetweenDownloadAttempts[4] && timeBetweenDownloadAttempts[4] < 55);
CPPUNIT_ASSERT(145 < timeBetweenDownloadAttempts[5] && timeBetweenDownloadAttempts[5] < 155);
}