Skip to content

Commit

Permalink
Update the cpp17 test expected output for stringified enums
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrh1 committed Oct 27, 2024
1 parent 4405b95 commit f5e544a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions tests/cpp17/stringify_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@ std::optional<std::string> StringifyFlatbufferValue(T &&val,
return detail::StringifyArithmeticType(static_cast<int>(val));
}

// Is it an enum? If so, print it like an int, since Flatbuffers doesn't yet
// have type-based reflection for enums, so we can't print the enum's name :(
// Is it an enum? If so, print the enum's name without quotes.
else if constexpr (std::is_enum_v<decayed>) {
return StringifyFlatbufferValue(
static_cast<std::underlying_type_t<decayed>>(val), indent);
return GetEnumName(val);
}

// Is it an int, double, float, uint32_t, etc.?
Expand Down
16 changes: 8 additions & 8 deletions tests/cpp17/test_cpp17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void StringifyAnyFlatbuffersTypeTest() {
y = 2.2
z = 3.3
test1 = 6.6
test2 = 2
test2 = Green
test3 = MyGame.Example.Test{
a = 11
b = 90
Expand All @@ -126,8 +126,8 @@ void StringifyAnyFlatbuffersTypeTest() {
6,
7
]
color = 8
test_type = 0
color = Blue
test_type = NONE
testbool = 1
testhashs32_fnv1 = 4
testhashu32_fnv1 = 5
Expand All @@ -143,11 +143,11 @@ void StringifyAnyFlatbuffersTypeTest() {
single_weak_reference = 15
co_owning_reference = 16
non_owning_reference = 17
any_unique_type = 0
any_ambiguous_type = 0
signed_enum = -1
long_enum_non_enum_default = 0
long_enum_normal_default = 2
any_unique_type = NONE
any_ambiguous_type = NONE
signed_enum = None
long_enum_non_enum_default =
long_enum_normal_default = LongOne
nan_default = nan
inf_default = inf
positive_inf_default = inf
Expand Down

0 comments on commit f5e544a

Please sign in to comment.