mirror of
https://github.com/google/pebble.git
synced 2025-08-17 11:56:33 -04:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
17
third_party/nanopb/tests/regression/issue_494/SConscript
vendored
Normal file
17
third_party/nanopb/tests/regression/issue_494/SConscript
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Regression test for #494:
|
||||
# Using sizeof on anonymous union not allowed in C++, in message_size oneof sizing fallback
|
||||
|
||||
Import('env')
|
||||
import os, sys
|
||||
|
||||
# The build rules here are a bit tricky to make the normal dependency
|
||||
# resolution intentionally fail. This causes the generator to use the fallback
|
||||
# define which had the problem with C++.
|
||||
env.Command("oneof.pb", "oneof.proto", "$PROTOC $PROTOCFLAGS -I$BUILDDIR/regression/issue_494 -o$TARGETS $SOURCES")
|
||||
env.Command(["oneof.pb.c", "oneof.pb.h"], "oneof.pb", env['NANOPB_GENERATOR'] + " -D$BUILDDIR/regression/issue_494 $SOURCES")
|
||||
env.NanopbProto("submessage.proto")
|
||||
env.Depends("oneof.pb", "submessage.proto")
|
||||
|
||||
test = env.Program(["oneof_size.cc"])
|
||||
env.Depends(test, "oneof.pb.h")
|
||||
env.RunTest(test)
|
13
third_party/nanopb/tests/regression/issue_494/oneof.proto
vendored
Normal file
13
third_party/nanopb/tests/regression/issue_494/oneof.proto
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "submessage.proto";
|
||||
|
||||
message MyMessage
|
||||
{
|
||||
oneof foo
|
||||
{
|
||||
SubMessage1 msg1 = 1;
|
||||
SubMessage2 msg2 = 2;
|
||||
SubMessage3 msg3 = 3;
|
||||
}
|
||||
}
|
19
third_party/nanopb/tests/regression/issue_494/oneof_size.cc
vendored
Normal file
19
third_party/nanopb/tests/regression/issue_494/oneof_size.cc
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "oneof.pb.h"
|
||||
#include "unittests.h"
|
||||
|
||||
extern "C" int main()
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
// Expected maximum encoded size:
|
||||
// 1 byte for MyMessage.foo tag
|
||||
// 1-5 bytes for MyMessage.foo submsg length
|
||||
// 1 byte for SubMessage3.foo tag
|
||||
// 5 bytes for SubMessage3.foo value
|
||||
// 1 byte for SubMessage3.bar tag
|
||||
// 5 bytes for SubMessage3.bar value
|
||||
printf("Size: %d\n", (int)MyMessage_size);
|
||||
TEST(MyMessage_size == 18);
|
||||
|
||||
return status;
|
||||
}
|
17
third_party/nanopb/tests/regression/issue_494/submessage.proto
vendored
Normal file
17
third_party/nanopb/tests/regression/issue_494/submessage.proto
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
syntax = "proto3";
|
||||
|
||||
message SubMessage1
|
||||
{
|
||||
uint32 foo = 1;
|
||||
}
|
||||
|
||||
message SubMessage2
|
||||
{
|
||||
uint32 foo = 1;
|
||||
}
|
||||
|
||||
message SubMessage3
|
||||
{
|
||||
uint32 foo = 1;
|
||||
uint32 bar = 2;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue