aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-04-16 21:36:37 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-04-16 21:45:42 +0300
commit3ea83364cefbeccd47cda1bc6ea58966cd308c94 (patch)
tree315f7e0fb38c45dd788a5bfc025e316806a6df7a /tools
parent6a420b1b5db93711a8e95b08776247cedaa0259f (diff)
downloadydb-3ea83364cefbeccd47cda1bc6ea58966cd308c94.tar.gz
Intermediate changes
Diffstat (limited to 'tools')
-rw-r--r--tools/enum_parser/parse_enum/ut/enums.cpp8
-rw-r--r--tools/enum_parser/parse_enum/ut/enums_with_header.h15
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/enum_parser/parse_enum/ut/enums.cpp b/tools/enum_parser/parse_enum/ut/enums.cpp
index 92e5470680..3a9df14f5e 100644
--- a/tools/enum_parser/parse_enum/ut/enums.cpp
+++ b/tools/enum_parser/parse_enum/ut/enums.cpp
@@ -8,6 +8,7 @@
#include <util/generic/serialized_enum.h>
#include <library/cpp/testing/unittest/registar.h>
+#include <util/generic/algorithm.h>
#include <util/generic/ptr.h>
#include <util/generic/singleton.h>
@@ -197,4 +198,11 @@ Y_UNIT_TEST_SUITE(TEnumGeneratorTest) {
Y_UNIT_TEST(EnumSerializerDestructionPriority) {
Singleton<TEnumSerializationInitializerHolder>()->Init();
}
+
+ Y_UNIT_TEST(ValuesSortTest) {
+ const auto& allValues = GetEnumAllValues<ENontrivialValues>();
+ UNIT_ASSERT_VALUES_EQUAL(allValues.size(), 4u);
+ UNIT_ASSERT(IsSorted(allValues.begin(), allValues.end()));
+ }
+
};
diff --git a/tools/enum_parser/parse_enum/ut/enums_with_header.h b/tools/enum_parser/parse_enum/ut/enums_with_header.h
index 26fe5565a9..91edf61532 100644
--- a/tools/enum_parser/parse_enum/ut/enums_with_header.h
+++ b/tools/enum_parser/parse_enum/ut/enums_with_header.h
@@ -6,3 +6,18 @@ enum EWithHeader {
HThree,
};
+
+constexpr unsigned EvalValue(unsigned r, unsigned d) {
+ while (r >= 50) {
+ r *= d;
+ }
+ return r;
+}
+
+// enumeration with values that depend on the preprocessor, architecture and constexpr function evaluation
+enum class ENontrivialValues {
+ A = __LINE__,
+ B = EvalValue(1522858842, 13),
+ C,
+ D = sizeof(int*[A][C]),
+};