aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing
diff options
context:
space:
mode:
authorIvan Komarov <Ivan.Komarov@dfyz.info>2022-02-10 16:46:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:49 +0300
commit59aca5c5180c31691884667783dc966eb99d743a (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/testing
parent4de97ab2fe437cbe83e4c63234e809ddd5ac34f2 (diff)
downloadydb-59aca5c5180c31691884667783dc966eb99d743a.tar.gz
Restoring authorship annotation for Ivan Komarov <Ivan.Komarov@dfyz.info>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing')
-rw-r--r--library/cpp/testing/unittest/gtest.h2
-rw-r--r--library/cpp/testing/unittest/registar.h44
-rw-r--r--library/cpp/testing/unittest/registar_ut.cpp10
3 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/testing/unittest/gtest.h b/library/cpp/testing/unittest/gtest.h
index 3818b2096d..b6768b1bf0 100644
--- a/library/cpp/testing/unittest/gtest.h
+++ b/library/cpp/testing/unittest/gtest.h
@@ -80,7 +80,7 @@ namespace testing {
#define EXPECT_NE(A, B) UNIT_ASSERT_UNEQUAL(A, B)
#define EXPECT_LE(A, B) UNIT_ASSERT((A) <= (B))
#define EXPECT_LT(A, B) UNIT_ASSERT((A) < (B))
-#define EXPECT_GE(A, B) UNIT_ASSERT((A) >= (B))
+#define EXPECT_GE(A, B) UNIT_ASSERT((A) >= (B))
#define EXPECT_GT(A, B) UNIT_ASSERT((A) > (B))
#define EXPECT_NO_THROW(A) UNIT_ASSERT_NO_EXCEPTION(A)
#define EXPECT_THROW(A, B) UNIT_ASSERT_EXCEPTION(A, B)
diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h
index 4965e0bbb7..44517a0092 100644
--- a/library/cpp/testing/unittest/registar.h
+++ b/library/cpp/testing/unittest/registar.h
@@ -383,9 +383,9 @@ public: \
} while (false)
//doubles
-// UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED* macros do not handle NaNs correctly (see IGNIETFERRO-1419) and are for backward compatibility
-// only. Consider switching to regular UNIT_ASSERT_DOUBLES_EQUAL* macros if you're still using the deprecated version.
-#define UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED_C(E, A, D, C) \
+// UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED* macros do not handle NaNs correctly (see IGNIETFERRO-1419) and are for backward compatibility
+// only. Consider switching to regular UNIT_ASSERT_DOUBLES_EQUAL* macros if you're still using the deprecated version.
+#define UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED_C(E, A, D, C) \
do { \
if (std::abs((E) - (A)) > (D)) { \
const auto _es = ToString((long double)(E)); \
@@ -396,32 +396,32 @@ public: \
} \
} while (false)
-#define UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED(E, A, D) UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED_C(E, A, D, "")
-
-#define UNIT_ASSERT_DOUBLES_EQUAL_C(E, A, D, C) \
- do { \
- const auto _ed = (E); \
- const auto _ad = (A); \
- const auto _dd = (D); \
+#define UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED(E, A, D) UNIT_ASSERT_DOUBLES_EQUAL_DEPRECATED_C(E, A, D, "")
+
+#define UNIT_ASSERT_DOUBLES_EQUAL_C(E, A, D, C) \
+ do { \
+ const auto _ed = (E); \
+ const auto _ad = (A); \
+ const auto _dd = (D); \
if (std::isnan((long double)_ed) && !std::isnan((long double)_ad)) { \
const auto _as = ToString((long double)_ad); \
auto&& failMsg = Sprintf("expected NaN, got %s %s", _as.data(), (::TStringBuilder() << C).data()); \
- UNIT_FAIL_IMPL("assertion failure", failMsg); \
- } \
+ UNIT_FAIL_IMPL("assertion failure", failMsg); \
+ } \
if (!std::isnan((long double)_ed) && std::isnan((long double)_ad)) { \
const auto _es = ToString((long double)_ed); \
auto&& failMsg = Sprintf("expected %s, got NaN %s", _es.data(), (::TStringBuilder() << C).data()); \
- UNIT_FAIL_IMPL("assertion failure", failMsg); \
- } \
- if (std::abs((_ed) - (_ad)) > (_dd)) { \
- const auto _es = ToString((long double)_ed); \
- const auto _as = ToString((long double)_ad); \
- const auto _ds = ToString((long double)_dd); \
+ UNIT_FAIL_IMPL("assertion failure", failMsg); \
+ } \
+ if (std::abs((_ed) - (_ad)) > (_dd)) { \
+ const auto _es = ToString((long double)_ed); \
+ const auto _as = ToString((long double)_ad); \
+ const auto _ds = ToString((long double)_dd); \
auto&& failMsg = Sprintf("std::abs(%s - %s) > %s %s", _es.data(), _as.data(), _ds.data(), (::TStringBuilder() << C).data()); \
- UNIT_FAIL_IMPL("assertion failure", failMsg); \
- } \
- } while (false)
-
+ UNIT_FAIL_IMPL("assertion failure", failMsg); \
+ } \
+ } while (false)
+
#define UNIT_ASSERT_DOUBLES_EQUAL(E, A, D) UNIT_ASSERT_DOUBLES_EQUAL_C(E, A, D, "")
//strings
diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp
index 5db231c49d..1f36d53abb 100644
--- a/library/cpp/testing/unittest/registar_ut.cpp
+++ b/library/cpp/testing/unittest/registar_ut.cpp
@@ -28,11 +28,11 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) {
UNIT_ASSERT_DOUBLES_EQUAL(0.0, 0.01, 0.1);
UNIT_ASSERT_DOUBLES_EQUAL(0.01, 0.0, 0.1);
-
- constexpr auto nan = std::numeric_limits<double>::quiet_NaN();
- UNIT_ASSERT_TEST_FAILS(doublesEqual(nan, 0.5, 0.1));
- UNIT_ASSERT_TEST_FAILS(doublesEqual(0.5, nan, 0.1));
- UNIT_ASSERT_DOUBLES_EQUAL(nan, nan, 0.1);
+
+ constexpr auto nan = std::numeric_limits<double>::quiet_NaN();
+ UNIT_ASSERT_TEST_FAILS(doublesEqual(nan, 0.5, 0.1));
+ UNIT_ASSERT_TEST_FAILS(doublesEqual(0.5, nan, 0.1));
+ UNIT_ASSERT_DOUBLES_EQUAL(nan, nan, 0.1);
}
Y_UNIT_TEST(StringsEqual) {