diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-26 20:37:52 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-26 20:37:52 +0100 |
commit | 33b40f71fcea36987cc30b0f57f85aff1b8e54ff (patch) | |
tree | 5ab5819337f8ab441b31bc5f144e1b62a4856257 | |
parent | bc078da645412c6b36ef59e635d6c35d11088c96 (diff) |
Use emplace instead of push_back
-rw-r--r-- | uunit.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -90,7 +90,7 @@ public: result.id = test_num; result.func = test.name; result.failure_type = "Assertion"; - failed_tests.push_back(result); + failed_tests.emplace_back(result); continue; } catch(...) @@ -114,13 +114,13 @@ public: result.msg = "Uncaught exception without std::exception type"; } result.failure_type = "Exception"; - failed_tests.push_back(result); + failed_tests.emplace_back(result); continue; } status_cb(test.name, test.file, true); test_result result{test.name, {}, {}, {}, {}, {}}; result.id = test_num; - successful_tests.push_back(result); + successful_tests.emplace_back(result); } } @@ -249,7 +249,7 @@ protected: template<typename O, typename F> void registerTest(O* obj, const F& fn, const char* name, const char* file) { - tests.push_back({std::bind(fn, obj), name, file}); + tests.emplace_back(std::bind(fn, obj), name, file); } #define uUNIT_TEST(func) \ registerTest(this, &func, #func, __FILE__) |