Commit 581e2cb1 authored by Robert Edmonds's avatar Robert Edmonds Committed by GitHub

Merge pull request #254 from protobuf-c/test/220

Add test case for #220
parents 9c4c8f63 d89895de
......@@ -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 \
......
#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;
}
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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment