mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-28 23:03:00 +08:00
6db04f4320
git-svn-id: http://pugixml.googlecode.com/svn/trunk@140 99668b35-9821-0410-8761-19e4c4f06640
44 lines
819 B
C++
44 lines
819 B
C++
#include "test.hpp"
|
|
|
|
#include <exception>
|
|
#include <stdio.h>
|
|
|
|
test_runner* test_runner::_tests = 0;
|
|
|
|
int main()
|
|
{
|
|
unsigned int total = 0;
|
|
unsigned int passed = 0;
|
|
|
|
for (test_runner* test = test_runner::_tests; test; test = test->_next)
|
|
{
|
|
try
|
|
{
|
|
total++;
|
|
test->run();
|
|
passed++;
|
|
}
|
|
catch (const std::exception& e)
|
|
{
|
|
printf("Test %s failed: exception %s\n", test->_name, e.what());
|
|
}
|
|
catch (const char* e)
|
|
{
|
|
printf("Test %s failed: %s\n", test->_name, e);
|
|
}
|
|
catch (...)
|
|
{
|
|
printf("Test %s failed for unknown reason\n", test->_name);
|
|
}
|
|
}
|
|
|
|
unsigned int failed = total - passed;
|
|
|
|
if (failed != 0)
|
|
printf("FAILURE: %u out of %u tests failed.\n", failed, total);
|
|
else
|
|
printf("Success: %d tests passed.\n", total);
|
|
|
|
return failed;
|
|
}
|