diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/unittest/test.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/unittest/test.h b/src/unittest/test.h index e1f1721f9..47a441e02 100644 --- a/src/unittest/test.h +++ b/src/unittest/test.h @@ -32,18 +32,22 @@ class TestFailedException : public std::exception { }; // Runs a unit test and reports results -#define TEST(fxn, ...) do { \ - u32 t1 = porting::getTime(PRECISION_MILLI); \ - try { \ - fxn(__VA_ARGS__); \ - dstream << "[PASS] "; \ - } catch (...) { \ - dstream << "[FAIL] "; \ - num_tests_failed++; \ - } \ - num_tests_run++; \ - u32 tdiff = porting::getTime(PRECISION_MILLI) - t1; \ - dstream << #fxn << " - " << tdiff << "ms" << std::endl; \ +#define TEST(fxn, ...) do { \ + u32 t1 = porting::getTime(PRECISION_MILLI); \ + try { \ + fxn(__VA_ARGS__); \ + dstream << "[PASS] "; \ + } catch (TestFailedException &e) { \ + dstream << "[FAIL] "; \ + num_tests_failed++; \ + } catch (std::exception &e) { \ + dstream << "Caught unhandled exception: " << e.what() << std::endl; \/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Less |
