diff --git a/tests/xtd.tunit.unit_tests/src/assert_unit_tests/assert_value.h b/tests/xtd.tunit.unit_tests/src/assert_unit_tests/assert_value.h index 1b3a4afe576..57e510b4168 100644 --- a/tests/xtd.tunit.unit_tests/src/assert_unit_tests/assert_value.h +++ b/tests/xtd.tunit.unit_tests/src/assert_unit_tests/assert_value.h @@ -2,13 +2,14 @@ #include "unit_test_error.h" #include #include +#include #include #include #include namespace assert_unit_tests { template - void assert_value(const std::string& name, const expected_t& expected, const actual_t& actual, const std::string& file, int line_number) { + void assert_value(const std::string& name, const expected_t& expected, const actual_t& actual, const xtd::source_location& location = xtd::source_location::current()) { if (actual == expected) std::cout << xtd::foreground_color(xtd::console_color::dark_green) << " SUCCEED " << xtd::reset_color() << name << std::endl; else { @@ -26,14 +27,11 @@ namespace assert_unit_tests { while (std::getline(f, line)) std::cout << " " << line << std::endl; std::cout << " Stack trace:" << std::endl; - std::cout << " " << file << ":" << line_number << std::endl; + std::cout << " " << location.file_name() << ":" << location.line() << std::endl; throw unit_test_error("assertion failed!"); } } } #define assert_value_(expected, actual) \ - assert_unit_tests::assert_value(name, expected, actual, __FILE__, __LINE__) - -#define assert_value_(expected, actual) \ - assert_unit_tests::assert_value(name, expected, actual, __FILE__, __LINE__) + assert_unit_tests::assert_value(name, expected, actual)