t/issue220/: Add test case for #220

This commit is contained in:
Robert Edmonds 2017-02-25 14:35:07 -05:00
parent 9c4c8f6366
commit d89895de3c
4 changed files with 50 additions and 0 deletions

View File

@ -178,6 +178,22 @@ t/test-full.pb.cc t/test-full.pb.h: @PROTOC@ $(top_srcdir)/t/test-full.proto
t/generated-code2/test-full-cxx-output.inc: t/generated-code2/cxx-generate-packed-data$(EXEEXT)
$(AM_V_GEN)$(top_builddir)/t/generated-code2/cxx-generate-packed-data$(EXEEXT) > $(top_builddir)/t/generated-code2/test-full-cxx-output.inc
check_PROGRAMS += \
t/issue220/issue220
TESTS += \
t/issue220/issue220
t_issue220_issue220_SOURCES = \
t/issue220/issue220.c \
t/issue220/issue220.pb-c.c
t_issue220_issue220_LDADD = \
protobuf-c/libprotobuf-c.la
t/issue220/issue220.pb-c.c t/issue220/issue220.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue220/issue220.proto
$(AM_V_GEN)@PROTOC@ --plugin=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue220/issue220.proto
BUILT_SOURCES += \
t/issue220/issue220.pb-c.c t/issue220/issue220.pb-c.h
EXTRA_DIST += \
t/issue220/issue220.proto
BUILT_SOURCES += \
t/test.pb-c.c t/test.pb-c.h \
t/test-full.pb-c.c t/test-full.pb-c.h \

1
t/issue220/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
issue220

13
t/issue220/issue220.c Normal file
View File

@ -0,0 +1,13 @@
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
#include "t/issue220/issue220.pb-c.h"
int main(void)
{
assert(_MESSAGE_TYPE1__FLAG_IS_INT_SIZE == INT_MAX);
assert(_MESSAGE_TYPE2__ANOTHER_FLAG_IS_INT_SIZE == INT_MAX);
assert(_TOP_LEVEL_IS_INT_SIZE == INT_MAX);
return EXIT_SUCCESS;
}

20
t/issue220/issue220.proto Normal file
View File

@ -0,0 +1,20 @@
message TopLevel {
oneof submessages {
MessageType1 type1 = 1;
MessageType2 type2 = 2;
}
}
message MessageType1 {
enum Flag {
OK = 1;
}
optional Flag flag = 1;
}
message MessageType2 {
enum AnotherFlag {
OK = 1;
}
optional AnotherFlag flag = 1;
}