예제 #1
0
파일: main.cpp 프로젝트: lvous/hadesmem
int main(int, char** argv)
{
#ifdef __BORLANDC__
	_control87(MCW_EM | PC_53, MCW_EM | MCW_PC);
#endif

	// setup temp path as the executable folder
	std::string temp = argv[0];
	std::string::size_type slash = temp.find_last_of("\\/");
	temp.erase((slash != std::string::npos) ? slash + 1 : 0);

	test_runner::_temp_path = temp.c_str();
	
	replace_memory_management();

	unsigned int total = 0;
	unsigned int passed = 0;

	test_runner* test = 0; // gcc3 "variable might be used uninitialized in this function" bug workaround

	for (test = test_runner::_tests; test; test = test->_next)
	{
		total++;
		passed += run_test(test);
	}

	unsigned int failed = total - passed;

	if (failed != 0)
		printf("FAILURE: %u out of %u tests failed.\n", failed, total);
	else
		printf("Success: %u tests passed.\n", total);

	return failed;
}
예제 #2
0
파일: main.cpp 프로젝트: mloy/pugixml
int main(int, char** argv)
{
#ifdef __BORLANDC__
	_control87(MCW_EM | PC_53, MCW_EM | MCW_PC);
#endif

	// setup temp path as the executable folder
	std::string temp = argv[0];
	std::string::size_type slash = temp.find_last_of("\\/");
	temp.erase((slash != std::string::npos) ? slash + 1 : 0);

	test_runner::_temp_path = temp.c_str();

	replace_memory_management();

	unsigned int total = 0;
	unsigned int passed = 0;

	test_runner* test = 0; // gcc3 "variable might be used uninitialized in this function" bug workaround

	for (test = test_runner::_tests; test; test = test->_next)
	{
		total++;
		passed += run_test(test, test->_name, custom_allocate);

		if (g_memory_fail_triggered)
		{
			// run tests that trigger memory failures twice - with an allocator that returns NULL and with an allocator that throws
		#ifndef PUGIXML_NO_EXCEPTIONS
			total++;
			passed += run_test(test, (test->_name + std::string(" (throw)")).c_str(), custom_allocate_throw);
		#endif
		}
	}

	unsigned int failed = total - passed;

	if (failed != 0)
		printf("FAILURE: %u out of %u tests failed.\n", failed, total);
	else
		printf("Success: %u tests passed.\n", total);

	return failed;
}