2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
5// Toby Schneider <toby@gobysoft.org>
8// This file is part of the Dynamic Compact Control Language Library
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.
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.
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/>.
24import "dccl/option_extensions.proto";
27// Tests for min_length with VarBytesCodec (bytes fields and v4 strings)
36 // required bytes with min_length=4, max_length=10
37 required bytes req_bytes = 1
38 [(dccl.field) = { min_length: 4 max_length: 10 codec: "dccl.var_bytes" }];
39 // optional bytes with min_length=2, max_length=8
40 optional bytes opt_bytes = 2
41 [(dccl.field) = { min_length: 2 max_length: 8 codec: "dccl.var_bytes" }];
43 // v4 string field uses VarBytesCodec — min_length savings apply
44 optional string str_field = 3
45 [(dccl.field) = { min_length: 3 max_length: 10 }];
48// min_length == max_length (fixed-size bytes)
57 required bytes fixed_bytes = 1
58 [(dccl.field) = { min_length: 5 max_length: 5 codec: "dccl.var_bytes" }];
61// Invalid: min_length > max_length — should fail to load
62message InvalidMinLengthMsg
70 required bytes bad_bytes = 1
71 [(dccl.field) = { min_length: 10 max_length: 5 codec: "dccl.var_bytes" }];