aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing
diff options
context:
space:
mode:
authorAlexey Salmin <alexey.salmin@gmail.com>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commit71af077a5dfe7e9f932a508422c2dac81a57ebc0 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/testing
parent3c5b1607b38f637d2f3313791ed25c2e080d2647 (diff)
downloadydb-71af077a5dfe7e9f932a508422c2dac81a57ebc0.tar.gz
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing')
-rw-r--r--library/cpp/testing/unittest/registar.h26
-rw-r--r--library/cpp/testing/unittest/registar_ut.cpp216
2 files changed, 121 insertions, 121 deletions
diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h
index c2f0d6b1aa..44517a0092 100644
--- a/library/cpp/testing/unittest/registar.h
+++ b/library/cpp/testing/unittest/registar.h
@@ -506,36 +506,36 @@ public: \
UNIT_FAIL_IMPL("less-than assertion failed", Sprintf("%s < %s %s", #A, #B, (::TStringBuilder() << C).data())); \
} \
} while (false)
-
-#define UNIT_ASSERT_LT(A, B) UNIT_ASSERT_LT_C(A, B, "")
-
+
+#define UNIT_ASSERT_LT(A, B) UNIT_ASSERT_LT_C(A, B, "")
+
#define UNIT_ASSERT_LE_C(A, B, C) \
do { \
if (!((A) <= (B))) { \
UNIT_FAIL_IMPL("less-or-equal assertion failed", Sprintf("%s <= %s %s", #A, #B, (::TStringBuilder() << C).data())); \
} \
} while (false)
-
-#define UNIT_ASSERT_LE(A, B) UNIT_ASSERT_LE_C(A, B, "")
-
+
+#define UNIT_ASSERT_LE(A, B) UNIT_ASSERT_LE_C(A, B, "")
+
#define UNIT_ASSERT_GT_C(A, B, C) \
do { \
if (!((A) > (B))) { \
UNIT_FAIL_IMPL("greater-than assertion failed", Sprintf("%s > %s %s", #A, #B, (::TStringBuilder() << C).data())); \
} \
} while (false)
-
-#define UNIT_ASSERT_GT(A, B) UNIT_ASSERT_GT_C(A, B, "")
-
-#define UNIT_ASSERT_GE_C(A, B, C) \
+
+#define UNIT_ASSERT_GT(A, B) UNIT_ASSERT_GT_C(A, B, "")
+
+#define UNIT_ASSERT_GE_C(A, B, C) \
do { \
if (!((A) >= (B))) { \
UNIT_FAIL_IMPL("greater-or-equal assertion failed", Sprintf("%s >= %s %s", #A, #B, (::TStringBuilder() << C).data())); \
} \
} while (false)
-
-#define UNIT_ASSERT_GE(A, B) UNIT_ASSERT_GE_C(A, B, "")
-
+
+#define UNIT_ASSERT_GE(A, B) UNIT_ASSERT_GE_C(A, B, "")
+
#define UNIT_CHECK_GENERATED_EXCEPTION_C(A, E, C) \
do { \
try { \
diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp
index 0426f366f2..1f36d53abb 100644
--- a/library/cpp/testing/unittest/registar_ut.cpp
+++ b/library/cpp/testing/unittest/registar_ut.cpp
@@ -127,114 +127,114 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) {
UNIT_ASSERT_UNEQUAL(33, 50);
}
- Y_UNIT_TEST(LessThan) {
- auto lt = [](auto v1, auto v2) {
- UNIT_ASSERT_LT(v1, v2);
- };
-
- // less than
- UNIT_ASSERT_LT(TStringBuf("1"), "2");
- UNIT_ASSERT_LT("2", TString("3"));
- UNIT_ASSERT_LT("abc", TString("azz"));
- UNIT_ASSERT_LT(2, 4);
- UNIT_ASSERT_LT(42ul, static_cast<unsigned short>(48));
-
- // equals
- UNIT_ASSERT_TEST_FAILS(lt(TStringBuf("2"), "2"));
- UNIT_ASSERT_TEST_FAILS(lt("2", TString("2")));
- UNIT_ASSERT_TEST_FAILS(lt("abc", TString("abc")));
- UNIT_ASSERT_TEST_FAILS(lt(2, 2));
- UNIT_ASSERT_TEST_FAILS(lt(42ul, static_cast<unsigned short>(42)));
-
- // greater than
- UNIT_ASSERT_TEST_FAILS(lt(TStringBuf("2"), "1"));
- UNIT_ASSERT_TEST_FAILS(lt("3", TString("2")));
- UNIT_ASSERT_TEST_FAILS(lt("azz", TString("abc")));
- UNIT_ASSERT_TEST_FAILS(lt(5, 2));
- UNIT_ASSERT_TEST_FAILS(lt(100ul, static_cast<unsigned short>(42)));
- }
-
- Y_UNIT_TEST(LessOrEqual) {
- auto le = [](auto v1, auto v2) {
- UNIT_ASSERT_LE(v1, v2);
- };
-
- // less than
- UNIT_ASSERT_LE(TStringBuf("1"), "2");
- UNIT_ASSERT_LE("2", TString("3"));
- UNIT_ASSERT_LE("abc", TString("azz"));
- UNIT_ASSERT_LE(2, 4);
- UNIT_ASSERT_LE(42ul, static_cast<unsigned short>(48));
-
- // equals
- UNIT_ASSERT_LE(TStringBuf("2"), "2");
- UNIT_ASSERT_LE("2", TString("2"));
- UNIT_ASSERT_LE("abc", TString("abc"));
- UNIT_ASSERT_LE(2, 2);
- UNIT_ASSERT_LE(42ul, static_cast<unsigned short>(42));
-
- // greater than
- UNIT_ASSERT_TEST_FAILS(le(TStringBuf("2"), "1"));
- UNIT_ASSERT_TEST_FAILS(le("3", TString("2")));
- UNIT_ASSERT_TEST_FAILS(le("azz", TString("abc")));
- UNIT_ASSERT_TEST_FAILS(le(5, 2));
- UNIT_ASSERT_TEST_FAILS(le(100ul, static_cast<unsigned short>(42)));
- }
-
- Y_UNIT_TEST(GreaterThan) {
- auto gt = [](auto v1, auto v2) {
- UNIT_ASSERT_GT(v1, v2);
- };
-
- // less than
- UNIT_ASSERT_TEST_FAILS(gt(TStringBuf("1"), "2"));
- UNIT_ASSERT_TEST_FAILS(gt("2", TString("3")));
- UNIT_ASSERT_TEST_FAILS(gt("abc", TString("azz")));
- UNIT_ASSERT_TEST_FAILS(gt(2, 4));
- UNIT_ASSERT_TEST_FAILS(gt(42ul, static_cast<unsigned short>(48)));
-
- // equals
- UNIT_ASSERT_TEST_FAILS(gt(TStringBuf("2"), "2"));
- UNIT_ASSERT_TEST_FAILS(gt("2", TString("2")));
- UNIT_ASSERT_TEST_FAILS(gt("abc", TString("abc")));
- UNIT_ASSERT_TEST_FAILS(gt(2, 2));
- UNIT_ASSERT_TEST_FAILS(gt(42ul, static_cast<unsigned short>(42)));
-
- // greater than
- UNIT_ASSERT_GT(TStringBuf("2"), "1");
- UNIT_ASSERT_GT("3", TString("2"));
- UNIT_ASSERT_GT("azz", TString("abc"));
- UNIT_ASSERT_GT(5, 2);
- UNIT_ASSERT_GT(100ul, static_cast<unsigned short>(42));
- }
-
- Y_UNIT_TEST(GreaterOrEqual) {
- auto ge = [](auto v1, auto v2) {
- UNIT_ASSERT_GE(v1, v2);
- };
-
- // less than
- UNIT_ASSERT_TEST_FAILS(ge(TStringBuf("1"), "2"));
- UNIT_ASSERT_TEST_FAILS(ge("2", TString("3")));
- UNIT_ASSERT_TEST_FAILS(ge("abc", TString("azz")));
- UNIT_ASSERT_TEST_FAILS(ge(2, 4));
- UNIT_ASSERT_TEST_FAILS(ge(42ul, static_cast<unsigned short>(48)));
-
- // equals
- UNIT_ASSERT_GE(TStringBuf("2"), "2");
- UNIT_ASSERT_GE("2", TString("2"));
- UNIT_ASSERT_GE("abc", TString("abc"));
- UNIT_ASSERT_GE(2, 2);
- UNIT_ASSERT_GE(42ul, static_cast<unsigned short>(42));
-
- // greater than
- UNIT_ASSERT_GE(TStringBuf("2"), "1");
- UNIT_ASSERT_GE("3", TString("2"));
- UNIT_ASSERT_GE("azz", TString("abc"));
- UNIT_ASSERT_GE(5, 2);
- UNIT_ASSERT_GE(100ul, static_cast<unsigned short>(42));
- }
-
+ Y_UNIT_TEST(LessThan) {
+ auto lt = [](auto v1, auto v2) {
+ UNIT_ASSERT_LT(v1, v2);
+ };
+
+ // less than
+ UNIT_ASSERT_LT(TStringBuf("1"), "2");
+ UNIT_ASSERT_LT("2", TString("3"));
+ UNIT_ASSERT_LT("abc", TString("azz"));
+ UNIT_ASSERT_LT(2, 4);
+ UNIT_ASSERT_LT(42ul, static_cast<unsigned short>(48));
+
+ // equals
+ UNIT_ASSERT_TEST_FAILS(lt(TStringBuf("2"), "2"));
+ UNIT_ASSERT_TEST_FAILS(lt("2", TString("2")));
+ UNIT_ASSERT_TEST_FAILS(lt("abc", TString("abc")));
+ UNIT_ASSERT_TEST_FAILS(lt(2, 2));
+ UNIT_ASSERT_TEST_FAILS(lt(42ul, static_cast<unsigned short>(42)));
+
+ // greater than
+ UNIT_ASSERT_TEST_FAILS(lt(TStringBuf("2"), "1"));
+ UNIT_ASSERT_TEST_FAILS(lt("3", TString("2")));
+ UNIT_ASSERT_TEST_FAILS(lt("azz", TString("abc")));
+ UNIT_ASSERT_TEST_FAILS(lt(5, 2));
+ UNIT_ASSERT_TEST_FAILS(lt(100ul, static_cast<unsigned short>(42)));
+ }
+
+ Y_UNIT_TEST(LessOrEqual) {
+ auto le = [](auto v1, auto v2) {
+ UNIT_ASSERT_LE(v1, v2);
+ };
+
+ // less than
+ UNIT_ASSERT_LE(TStringBuf("1"), "2");
+ UNIT_ASSERT_LE("2", TString("3"));
+ UNIT_ASSERT_LE("abc", TString("azz"));
+ UNIT_ASSERT_LE(2, 4);
+ UNIT_ASSERT_LE(42ul, static_cast<unsigned short>(48));
+
+ // equals
+ UNIT_ASSERT_LE(TStringBuf("2"), "2");
+ UNIT_ASSERT_LE("2", TString("2"));
+ UNIT_ASSERT_LE("abc", TString("abc"));
+ UNIT_ASSERT_LE(2, 2);
+ UNIT_ASSERT_LE(42ul, static_cast<unsigned short>(42));
+
+ // greater than
+ UNIT_ASSERT_TEST_FAILS(le(TStringBuf("2"), "1"));
+ UNIT_ASSERT_TEST_FAILS(le("3", TString("2")));
+ UNIT_ASSERT_TEST_FAILS(le("azz", TString("abc")));
+ UNIT_ASSERT_TEST_FAILS(le(5, 2));
+ UNIT_ASSERT_TEST_FAILS(le(100ul, static_cast<unsigned short>(42)));
+ }
+
+ Y_UNIT_TEST(GreaterThan) {
+ auto gt = [](auto v1, auto v2) {
+ UNIT_ASSERT_GT(v1, v2);
+ };
+
+ // less than
+ UNIT_ASSERT_TEST_FAILS(gt(TStringBuf("1"), "2"));
+ UNIT_ASSERT_TEST_FAILS(gt("2", TString("3")));
+ UNIT_ASSERT_TEST_FAILS(gt("abc", TString("azz")));
+ UNIT_ASSERT_TEST_FAILS(gt(2, 4));
+ UNIT_ASSERT_TEST_FAILS(gt(42ul, static_cast<unsigned short>(48)));
+
+ // equals
+ UNIT_ASSERT_TEST_FAILS(gt(TStringBuf("2"), "2"));
+ UNIT_ASSERT_TEST_FAILS(gt("2", TString("2")));
+ UNIT_ASSERT_TEST_FAILS(gt("abc", TString("abc")));
+ UNIT_ASSERT_TEST_FAILS(gt(2, 2));
+ UNIT_ASSERT_TEST_FAILS(gt(42ul, static_cast<unsigned short>(42)));
+
+ // greater than
+ UNIT_ASSERT_GT(TStringBuf("2"), "1");
+ UNIT_ASSERT_GT("3", TString("2"));
+ UNIT_ASSERT_GT("azz", TString("abc"));
+ UNIT_ASSERT_GT(5, 2);
+ UNIT_ASSERT_GT(100ul, static_cast<unsigned short>(42));
+ }
+
+ Y_UNIT_TEST(GreaterOrEqual) {
+ auto ge = [](auto v1, auto v2) {
+ UNIT_ASSERT_GE(v1, v2);
+ };
+
+ // less than
+ UNIT_ASSERT_TEST_FAILS(ge(TStringBuf("1"), "2"));
+ UNIT_ASSERT_TEST_FAILS(ge("2", TString("3")));
+ UNIT_ASSERT_TEST_FAILS(ge("abc", TString("azz")));
+ UNIT_ASSERT_TEST_FAILS(ge(2, 4));
+ UNIT_ASSERT_TEST_FAILS(ge(42ul, static_cast<unsigned short>(48)));
+
+ // equals
+ UNIT_ASSERT_GE(TStringBuf("2"), "2");
+ UNIT_ASSERT_GE("2", TString("2"));
+ UNIT_ASSERT_GE("abc", TString("abc"));
+ UNIT_ASSERT_GE(2, 2);
+ UNIT_ASSERT_GE(42ul, static_cast<unsigned short>(42));
+
+ // greater than
+ UNIT_ASSERT_GE(TStringBuf("2"), "1");
+ UNIT_ASSERT_GE("3", TString("2"));
+ UNIT_ASSERT_GE("azz", TString("abc"));
+ UNIT_ASSERT_GE(5, 2);
+ UNIT_ASSERT_GE(100ul, static_cast<unsigned short>(42));
+ }
+
Y_UNIT_TEST(ValuesEqual) {
auto valuesEqual = [](auto v1, auto v2) {
UNIT_ASSERT_VALUES_EQUAL(v1, v2);