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


C++ Updater::run方法代码示例

本文整理汇总了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;

}
开发者ID:DX94,项目名称:BumpTop,代码行数:28,代码来源:BT_UpdaterTest.cpp

示例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);

}
开发者ID:DX94,项目名称:BumpTop,代码行数:43,代码来源:BT_UpdaterTest.cpp


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