diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | c2a1af049e9deca890e9923abe64fe6c59060348 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/deprecated/enum_codegen | |
parent | 1f553f46fb4f3c5eec631352cdd900a0709016af (diff) | |
download | ydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/deprecated/enum_codegen')
-rw-r--r-- | library/cpp/deprecated/enum_codegen/enum_codegen.h | 16 | ||||
-rw-r--r-- | library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp | 56 |
2 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/deprecated/enum_codegen/enum_codegen.h b/library/cpp/deprecated/enum_codegen/enum_codegen.h index 49f723354d..dfb04ecac2 100644 --- a/library/cpp/deprecated/enum_codegen/enum_codegen.h +++ b/library/cpp/deprecated/enum_codegen/enum_codegen.h @@ -1,10 +1,10 @@ -#pragma once - -/// see enum_codegen_ut.cpp for examples - -#define ENUM_VALUE_GEN(name, value, ...) name = value, -#define ENUM_VALUE_GEN_NO_VALUE(name, ...) name, - +#pragma once + +/// see enum_codegen_ut.cpp for examples + +#define ENUM_VALUE_GEN(name, value, ...) name = value, +#define ENUM_VALUE_GEN_NO_VALUE(name, ...) name, + #define ENUM_TO_STRING_IMPL_ITEM(name, ...) \ case name: \ return #name; @@ -12,7 +12,7 @@ case name: \ os << #name; \ break; - + #define ENUM_TO_STRING(type, MAP) \ static inline const char* ToCString(type value) { \ switch (value) { \ diff --git a/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp b/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp index 5a25265f2e..f8f1c9b6df 100644 --- a/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp +++ b/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp @@ -1,40 +1,40 @@ #include <library/cpp/testing/unittest/registar.h> - -#include "enum_codegen.h" - + +#include "enum_codegen.h" + #include <util/string/builder.h> -#define COLOR_MAP(XX) \ +#define COLOR_MAP(XX) \ XX(RED) \ XX(GREEN) \ - XX(BLUE) - -enum EColor { - COLOR_MAP(ENUM_VALUE_GEN_NO_VALUE) -}; - -ENUM_TO_STRING(EColor, COLOR_MAP) - -#define MULTIPLIER_MAP(XX) \ + XX(BLUE) + +enum EColor { + COLOR_MAP(ENUM_VALUE_GEN_NO_VALUE) +}; + +ENUM_TO_STRING(EColor, COLOR_MAP) + +#define MULTIPLIER_MAP(XX) \ XX(GB, 9) \ XX(MB, 6) \ - XX(KB, 3) - -enum EMultiplier { - MULTIPLIER_MAP(ENUM_VALUE_GEN) -}; - -ENUM_TO_STRING(EMultiplier, MULTIPLIER_MAP) - + XX(KB, 3) + +enum EMultiplier { + MULTIPLIER_MAP(ENUM_VALUE_GEN) +}; + +ENUM_TO_STRING(EMultiplier, MULTIPLIER_MAP) + Y_UNIT_TEST_SUITE(EnumCodegen) { Y_UNIT_TEST(GenWithValue) { - UNIT_ASSERT_VALUES_EQUAL(6, MB); - } - + UNIT_ASSERT_VALUES_EQUAL(6, MB); + } + Y_UNIT_TEST(ToCString) { - UNIT_ASSERT_VALUES_EQUAL("RED", ToCString(RED)); - UNIT_ASSERT_VALUES_EQUAL("BLUE", ToCString(BLUE)); + UNIT_ASSERT_VALUES_EQUAL("RED", ToCString(RED)); + UNIT_ASSERT_VALUES_EQUAL("BLUE", ToCString(BLUE)); UNIT_ASSERT_VALUES_EQUAL("GREEN", (TStringBuilder() << GREEN)); UNIT_ASSERT_VALUES_EQUAL("GB", ToCString(GB)); - } -} + } +} |