DCCL v4
Loading...
Searching...
No Matches
test.proto
1// Copyright 2023:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6//
7//
8// This file is part of the Dynamic Compact Control Language Library
9// ("DCCL").
10//
11// DCCL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 2.1 of the License, or
14// (at your option) any later version.
15//
16// DCCL is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public License
22// along with DCCL. If not, see <http://www.gnu.org/licenses/>.
23syntax = "proto2";
24
25import "dccl/option_extensions.proto";
26
27package dccl.test;
28
29message TestMsg
30{
31 option (dccl.msg) = {
32 id: 1
33 max_bytes: 32
34 codec_version: 4
35 };
36
37 repeated int32 a = 1 [
38 (dccl.field) = { min: -100 max: 100 max_repeat: 5 }
39 ]; // default min repeat (0)
40 repeated int32 b = 2 [
41 (dccl.field) = { min: -100 max: 100 min_repeat: 2 max_repeat: 3 }
42 ]; // min repeat and max repeat different
43 repeated int32 c = 3 [
44 (dccl.field) = { min: -100 max: 100 min_repeat: 3 max_repeat: 3 }
45 ]; // min repeat and max repeat the same
46}
47
48message InvalidTestMsgMissingMaxRepeat
49{
50 option (dccl.msg) = {
51 id: 2
52 max_bytes: 32
53 codec_version: 4
54 };
55
56 repeated int32 a = 1 [(dccl.field) = { min: -100 max: 100 }];
57}
58
59message InvalidTestMsgMaxRepeatLessThanOne
60{
61 option (dccl.msg) = {
62 id: 2
63 max_bytes: 32
64 codec_version: 4
65 };
66
67 repeated int32 a = 1 [(dccl.field) = { min: -100 max: 100 max_repeat: 0 }];
68}
69
70message InvalidTestMsgMaxRepeatLessThanMinRepeat
71{
72 option (dccl.msg) = {
73 id: 2
74 max_bytes: 32
75 codec_version: 4
76 };
77
78 repeated int32 a = 1
79 [(dccl.field) = { min: -100 max: 100 min_repeat: 5 max_repeat: 3 }];
80}