aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/va_args_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/generic/va_args_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/va_args_ut.cpp')
-rw-r--r--util/generic/va_args_ut.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/util/generic/va_args_ut.cpp b/util/generic/va_args_ut.cpp
index a9c96a0f55..4044bb9a63 100644
--- a/util/generic/va_args_ut.cpp
+++ b/util/generic/va_args_ut.cpp
@@ -13,8 +13,8 @@ Y_UNIT_TEST_SUITE(TMacroVarargMapTest) {
#define ID(x) x
static const int SUM = Y_MAP_ARGS_WITH_LAST(ADD, ID, 1, 2, 3, 4 + 5);
UNIT_ASSERT_VALUES_EQUAL(SUM, 1 + 2 + 3 + 4 + 5);
-#undef ADD
-#undef ID
+#undef ADD
+#undef ID
}
Y_UNIT_TEST(TestMapArgsN) {
@@ -42,65 +42,65 @@ Y_UNIT_TEST_SUITE(TMacroVarargMapTest) {
}
}
-Y_UNIT_TEST_SUITE(TestVaArgs) {
- Y_UNIT_TEST(Count) {
+Y_UNIT_TEST_SUITE(TestVaArgs) {
+ Y_UNIT_TEST(Count) {
// UNIT_ASSERT((Y_COUNT_ARGS() == 0)); // FIXME: make this case work after __VA_OPT__ (c++20)
UNIT_ASSERT((Y_COUNT_ARGS(1) == 1));
- UNIT_ASSERT((Y_COUNT_ARGS(1, 2) == 2));
- UNIT_ASSERT((Y_COUNT_ARGS(1, 2, 3) == 3));
- UNIT_ASSERT((Y_COUNT_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0) == 20));
- }
+ UNIT_ASSERT((Y_COUNT_ARGS(1, 2) == 2));
+ UNIT_ASSERT((Y_COUNT_ARGS(1, 2, 3) == 3));
+ UNIT_ASSERT((Y_COUNT_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0) == 20));
+ }
- Y_UNIT_TEST(GetElem) {
- UNIT_ASSERT((Y_GET_ARG(0, 1) == 1));
- UNIT_ASSERT((Y_GET_ARG(0, 0, 1, 2, 3, 4, 5) == 0));
- UNIT_ASSERT((Y_GET_ARG(1, 0, 1, 2, 3, 4, 5) == 1));
- UNIT_ASSERT((Y_GET_ARG(2, 0, 1, 2, 3, 4, 5) == 2));
- UNIT_ASSERT((Y_GET_ARG(3, 0, 1, 2, 3, 4, 5) == 3));
- UNIT_ASSERT((Y_GET_ARG(4, 0, 1, 2, 3, 4, 5) == 4));
- UNIT_ASSERT((Y_GET_ARG(5, 0, 1, 2, 3, 4, 5) == 5));
- }
+ Y_UNIT_TEST(GetElem) {
+ UNIT_ASSERT((Y_GET_ARG(0, 1) == 1));
+ UNIT_ASSERT((Y_GET_ARG(0, 0, 1, 2, 3, 4, 5) == 0));
+ UNIT_ASSERT((Y_GET_ARG(1, 0, 1, 2, 3, 4, 5) == 1));
+ UNIT_ASSERT((Y_GET_ARG(2, 0, 1, 2, 3, 4, 5) == 2));
+ UNIT_ASSERT((Y_GET_ARG(3, 0, 1, 2, 3, 4, 5) == 3));
+ UNIT_ASSERT((Y_GET_ARG(4, 0, 1, 2, 3, 4, 5) == 4));
+ UNIT_ASSERT((Y_GET_ARG(5, 0, 1, 2, 3, 4, 5) == 5));
+ }
- Y_UNIT_TEST(MapArgs) {
+ Y_UNIT_TEST(MapArgs) {
#define MAP(x) x + /* NOLINT */
- // UNIT_ASSERT((Y_MAP_ARGS(MAP) 0 == 0)); // FIXME: make this case work after __VA_OPT__ (c++20)
- UNIT_ASSERT((Y_MAP_ARGS(MAP, 1, 2, 3, 4) 0 == 10));
+ // UNIT_ASSERT((Y_MAP_ARGS(MAP) 0 == 0)); // FIXME: make this case work after __VA_OPT__ (c++20)
+ UNIT_ASSERT((Y_MAP_ARGS(MAP, 1, 2, 3, 4) 0 == 10));
#undef MAP
- }
+ }
- Y_UNIT_TEST(MapArgsWithLast) {
+ Y_UNIT_TEST(MapArgsWithLast) {
#define MAP(x) x + /* NOLINT */
#define MAP_LAST(x) x
- UNIT_ASSERT((Y_MAP_ARGS_WITH_LAST(MAP, MAP_LAST, 1, 2, 3, 4) == 10));
+ UNIT_ASSERT((Y_MAP_ARGS_WITH_LAST(MAP, MAP_LAST, 1, 2, 3, 4) == 10));
#undef MAP_LAST
#undef MAP
- }
+ }
- Y_UNIT_TEST(AllButLast) {
- const char array[] = {Y_ALL_BUT_LAST(1, 2, 3, 4, 5)};
- UNIT_ASSERT((sizeof(array) == 4));
- UNIT_ASSERT((array[0] == 1));
- UNIT_ASSERT((array[1] == 2));
- UNIT_ASSERT((array[2] == 3));
- UNIT_ASSERT((array[3] == 4));
- }
+ Y_UNIT_TEST(AllButLast) {
+ const char array[] = {Y_ALL_BUT_LAST(1, 2, 3, 4, 5)};
+ UNIT_ASSERT((sizeof(array) == 4));
+ UNIT_ASSERT((array[0] == 1));
+ UNIT_ASSERT((array[1] == 2));
+ UNIT_ASSERT((array[2] == 3));
+ UNIT_ASSERT((array[3] == 4));
+ }
- Y_UNIT_TEST(Last) {
- UNIT_ASSERT((Y_LAST(1) == 1));
- UNIT_ASSERT((Y_LAST(1, 2, 3) == 3));
- }
+ Y_UNIT_TEST(Last) {
+ UNIT_ASSERT((Y_LAST(1) == 1));
+ UNIT_ASSERT((Y_LAST(1, 2, 3) == 3));
+ }
- Y_UNIT_TEST(ImplDispatcher) {
+ Y_UNIT_TEST(ImplDispatcher) {
#define I1(x) (x)
#define I2(x, y) ((x) + (y))
#define I3(x, y, z) ((x) + (y) + (z))
#define I(...) Y_PASS_VA_ARGS(Y_MACRO_IMPL_DISPATCHER_3(__VA_ARGS__, I3, I2, I1)(__VA_ARGS__))
- UNIT_ASSERT((I(1) == 1));
- UNIT_ASSERT((I(1, 2) == 3));
- UNIT_ASSERT((I(1, 2, 3) == 6));
+ UNIT_ASSERT((I(1) == 1));
+ UNIT_ASSERT((I(1, 2) == 3));
+ UNIT_ASSERT((I(1, 2, 3) == 6));
#undef I
#undef I3
#undef I2
#undef I1
- }
-};
+ }
+};