Beispiel #1
0
int main()
{
  Test_Result result;
  size_t num_tests = 0;

  for(Test_Suites::iterator it = test_suites().begin(),
      end = test_suites().end();
      it != end;
      ++it)
  {
    it->second.run(result);
    num_tests += it->second.size();
  }

  std::cout << std::endl;

  std::cout << num_tests << " test(s), "
            << assertions << " assertion(s), "
            << result.errors().size() << " error(s), "
            << result.failures().size() << " failure(s)"
            << std::endl;

  if(result.errors().size() > 0)
  {
    std::cout << std::endl << "Errors:" << std::endl;
    for(std::vector<Failure>::const_iterator it = result.errors().begin(),
        end = result.errors().end();
        it != end;
        ++it)
    {
      std::cout << *it << std::endl;
    }
  }

  if(result.failures().size() > 0)
  {
    std::cout << std::endl << "Failures:" << std::endl;
    for(std::vector<Failure>::const_iterator it = result.failures().begin(),
        end = result.failures().end();
        it != end;
        ++it)
    {
      std::cout << *it << std::endl;
    }
  }

  return result.errors().size() + result.failures().size();
}
Beispiel #2
0
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		std::cerr << _T("Fatal Error: MFC initialization failed") << std::endl;
		return 1;
	}
	test_suites();

	return 0;
}
Beispiel #3
0
void new_test_suite(std::string const & name)
{
  test_suites()[name] = Test_Suite(name);
  last_test_suite = &test_suites()[name];
}