MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

util/generic/serialized_enum_ut.cpp:11–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10Y_UNIT_TEST_SUITE(TestSerializedEnum) {
11 Y_UNIT_TEST(RepresentationTypes) {
12 using namespace NEnumSerializationRuntime::NDetail;
13
14 static_assert(TIsPromotable<int, int>::value, "int -> int");
15 static_assert(TIsPromotable<char, int>::value, "char -> int");
16 static_assert(TIsPromotable<unsigned short, unsigned long>::value, "unsigned short -> unsigned long");
17 static_assert(TIsPromotable<i64, long long>::value, "i64 -> long long");
18 static_assert(!TIsPromotable<ui64, ui8>::value, "ui64 -> ui8");
19 static_assert(!TIsPromotable<i64, short>::value, "i64 -> short");
20
21 enum EEmpty {
22 };
23 UNIT_ASSERT_C((TTypeList<int, unsigned>::THave<typename TSelectEnumRepresentationType<EEmpty>::TType>::value), "empty enum using signed or unsigned integer underlying type");
24
25 using TRepresentationTypeList = TTypeList<int, unsigned, long long, unsigned long long>;
26
27 enum class ERegular {
28 One = 1,
29 Two = 2,
30 Five = 5,
31 };
32 UNIT_ASSERT(TRepresentationTypeList::THave<typename TSelectEnumRepresentationType<ERegular>::TType>::value);
33
34 enum class ESmall: unsigned char {
35 Six = 6,
36 };
37 UNIT_ASSERT(TRepresentationTypeList::THave<typename TSelectEnumRepresentationType<ESmall>::TType>::value);
38
39 enum class EHugeUnsigned: ui64 {
40 Value = 0,
41 };
42 UNIT_ASSERT(TRepresentationTypeList::THave<typename TSelectEnumRepresentationType<EHugeUnsigned>::TType>::value);
43
44 enum class EHugeSigned: i64 {
45 Value = -2,
46 };
47 UNIT_ASSERT(TRepresentationTypeList::THave<typename TSelectEnumRepresentationType<EHugeSigned>::TType>::value);
48 }
49
50 Y_UNIT_TEST(MappedArrayView) {
51 enum class ETestEnum: signed char {

Callers

nothing calls this directly

Calls 7

sizeMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
atMethod · 0.45
MaterializeMethod · 0.45
endMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected