Files
Petteri Aimonen b34a649c52 Separate enum_intsize option (#961)
Setting enum data type size is only supported on C23 and C++11 compilers.
The previous implementation caused ABI incompatibility when using the
option in mixed C/C++ projects. After this commit such cases will be
indicated by a compiler error.
2024-09-03 12:10:22 +03:00

23 lines
726 B
Python

# Test that different sizes of enum fields are properly encoded and decoded.
Import('env')
env.NanopbProto('packed_enum')
p = env.Program(["packed_enum_unittests.c",
"packed_enum.pb.c",
"$COMMON/pb_encode.o",
"$COMMON/pb_decode.o",
"$COMMON/pb_common.o"])
env.RunTest(p)
# Enum size specification is supported by C++11 and newer
env2 = env.Clone()
env2.Append(CXXFLAGS = "-std=c++11")
env2.NanopbProtoCpp('enum_intsize')
p2 = env2.Program(["enum_intsize_unittests.cc",
"enum_intsize.pb.cpp",
"$COMMON/pb_encode.o",
"$COMMON/pb_decode.o",
"$COMMON/pb_common.o"])
env2.RunTest(p2)