Ejemplo n.º 1
0
bool FUTestBed::RunTestbed(FUTestSuite* headTestSuite)
{
	if (headTestSuite == NULL) return false;

	testPassed = testFailed = 0;

	RunTestSuite(headTestSuite);

	if (isVerbose)
	{
		fileOut.WriteLine("---------------------------------");
		fileOut.WriteLine("Tests passed: %u.", (uint32) testPassed);
		fileOut.WriteLine("Tests failed: %u.", (uint32) testFailed);
		fileOut.WriteLine("");
		fileOut.Flush();

#ifdef _WIN32
		char sz[1024];
		snprintf(sz, 1024, "Testbed score: [%zu/%zu]", testPassed, testFailed + testPassed);
		sz[1023] = 0;

		size_t returnCode = IDOK;
		returnCode = MessageBox(NULL, TO_FSTRING(sz).c_str(), FC("Testbed"), MB_OKCANCEL);
		if (returnCode == IDCANCEL)
		{
			const fm::string filenameUtf8 = FUStringConversion::ToString(filename);
			snprintf(sz, 1024, "write %s ", filenameUtf8.c_str());
			sz[1023] = 0;
			system(sz);
			return false;
		}
#endif
	}
	return true;
}
Ejemplo n.º 2
0
	PassIf(IsEquivalent(e, "CCC"));
	PassIf(a.length() == 5);
	PassIf(a.substr(0, 4) == c.substr(0, 4));
	FailIf(a == c);
	PassIf(a < c);

	e.append("4");
	b.append(a);
	PassIf(IsEquivalent(e, "CCC4"));
	PassIf(IsEquivalent(b, "TEST1TEST1"));
	PassIf(b.find("TEST1", 0) == 0);
	PassIf(b.find("TEST1", 2) == 5);
	PassIf(b.find("TEST1", 5) == 5);
	PassIf(b.find("TEST1", 7) == fm::string::npos);
	FailIf(c.find("TEST1") != fm::string::npos);
	PassIf(IsEquivalent(a.c_str(), "TEST1"));
	PassIf(d.find_first_of("RST") == 2);
	PassIf(c.find_last_of("T") == 3);

	e.erase(3, 4);
	a.erase(0, fm::string::npos);
	b.clear();
	PassIf(IsEquivalent(e, "CCC"));
	PassIf(e.find_first_of("TEST1ORANYTHINGELSETHATDOESNOTHAVE_?_") == fm::string::npos);
	PassIf(a.length() == 0);
	PassIf(IsEquivalent(a, ""));
	PassIf(a.empty());
	PassIf(a == b);
	PassIf(a.empty());
	PassIf(IsEquivalent(a.c_str(), b)); // c_str() will ensure that the vector<char> is NULL-terminated.
	PassIf(a.empty());
Ejemplo n.º 3
0
	void AddNodeSid(xmlNode* node, fm::string& subId)
	{
		subId = AddNodeSid(node, subId.c_str());
	}