-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from GobySoft/4.0-fix-resolution-exception-reg…
…ression Fix regression enforcing min/max to be a multiple of the resolution when this wasn't enforced previously for the precision
- Loading branch information
Showing
3 changed files
with
126 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,134 @@ | ||
@PROTOBUF_SYNTAX_VERSION@ | ||
|
||
import "dccl/option_extensions.proto"; | ||
package dccl.test; | ||
|
||
message NumericMsg | ||
{ | ||
option (dccl.msg).id = 10; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [(dccl.field).max = 180, | ||
(dccl.field).min = -180, | ||
(dccl.field).precision = 12, | ||
(dccl.field).in_head=true]; | ||
|
||
optional double b = 2 [(dccl.field).max = 18, | ||
(dccl.field).min = -18, | ||
(dccl.field).resolution = 0.0001]; | ||
|
||
// max is 2^64 rounded to 1e5 | ||
required uint64 u1 = 3 [(dccl.field).max = 18446744073709500000, | ||
(dccl.field).min = 0, | ||
(dccl.field).precision = -5]; | ||
|
||
// max is 2^64 rounded to 1e5 | ||
required uint64 u2 = 4 [(dccl.field).max = 18446744073709500000, | ||
(dccl.field).min = 0, | ||
(dccl.field).resolution = 100000]; | ||
|
||
// resolution != 10^N | ||
required double u3 = 5 [(dccl.field).max = 15.5, | ||
(dccl.field).min = 5.5, | ||
(dccl.field).resolution = 0.5]; | ||
|
||
// resolution default | ||
required double u4 = 6 [(dccl.field).max = 20.0, | ||
(dccl.field).min = 0.0]; | ||
|
||
// weird resolution | ||
required double u5 = 7 [(dccl.field).max = 3.6, | ||
(dccl.field).min = 1.44, | ||
(dccl.field).resolution = 0.12]; | ||
|
||
|
||
option (dccl.msg).id = 10; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [ | ||
(dccl.field).max = 180, | ||
(dccl.field).min = -180, | ||
(dccl.field).precision = 12, | ||
(dccl.field).in_head = true | ||
]; | ||
|
||
optional double b = 2 [ | ||
(dccl.field).max = 18, | ||
(dccl.field).min = -18, | ||
(dccl.field).resolution = 0.0001 | ||
]; | ||
|
||
// max is 2^64 rounded to 1e5 | ||
required uint64 u1 = 3 [ | ||
(dccl.field).max = 18446744073709500000, | ||
(dccl.field).min = 0, | ||
(dccl.field).precision = -5 | ||
]; | ||
|
||
// max is 2^64 rounded to 1e5 | ||
required uint64 u2 = 4 [ | ||
(dccl.field).max = 18446744073709500000, | ||
(dccl.field).min = 0, | ||
(dccl.field).resolution = 100000 | ||
]; | ||
|
||
// resolution != 10^N | ||
required double u3 = 5 [ | ||
(dccl.field).max = 15.5, | ||
(dccl.field).min = 5.5, | ||
(dccl.field).resolution = 0.5 | ||
]; | ||
|
||
// resolution default | ||
required double u4 = 6 [(dccl.field).max = 20.0, (dccl.field).min = 0.0]; | ||
|
||
// weird resolution | ||
required double u5 = 7 [ | ||
(dccl.field).max = 3.6, | ||
(dccl.field).min = 1.44, | ||
(dccl.field).resolution = 0.12 | ||
]; | ||
|
||
// old precision field did not require min and max to be a multiple of resolution | ||
required int32 u6 = 8 [ | ||
(dccl.field).min = 0, | ||
(dccl.field).max = 25599, | ||
(dccl.field).precision = -2 | ||
]; | ||
} | ||
|
||
message NegativeResolutionNumericMsg // Invalid resolution | ||
message NegativeResolutionNumericMsg // Invalid resolution | ||
{ | ||
option (dccl.msg).id = 10; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [(dccl.field).min = -20, | ||
(dccl.field).max = 20, | ||
(dccl.field).resolution = -0.5]; | ||
|
||
optional int32 b = 2 [(dccl.field).min = -500000, | ||
(dccl.field).max = 500000, | ||
(dccl.field).precision = -3]; | ||
option (dccl.msg).id = 10; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [ | ||
(dccl.field).min = -20, | ||
(dccl.field).max = 20, | ||
(dccl.field).resolution = -0.5 | ||
]; | ||
|
||
optional int32 b = 2 [ | ||
(dccl.field).min = -500000, | ||
(dccl.field).max = 500000, | ||
(dccl.field).precision = -3 | ||
]; | ||
} | ||
|
||
|
||
message BothResolutionAndPrecisionSetNumericMsg | ||
{ | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [(dccl.field).max = 180, | ||
(dccl.field).min = -180, | ||
(dccl.field).precision = 1, | ||
(dccl.field).resolution = 0.1]; | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [ | ||
(dccl.field).max = 180, | ||
(dccl.field).min = -180, | ||
(dccl.field).precision = 1, | ||
(dccl.field).resolution = 0.1 | ||
]; | ||
} | ||
|
||
message TooBigNumericMsg | ||
{ | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [(dccl.field).max = 180, | ||
(dccl.field).min = -180, | ||
(dccl.field).resolution = 1e-15]; | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
optional double a = 1 [ | ||
(dccl.field).max = 180, | ||
(dccl.field).min = -180, | ||
(dccl.field).resolution = 1e-15 | ||
]; | ||
} | ||
|
||
message MinNotMultipleOfResolution | ||
{ | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
required double a = 1 [(dccl.field).max = 3.6, | ||
(dccl.field).min = 1.5, | ||
(dccl.field).resolution = 0.2]; | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
required double a = 1 [ | ||
(dccl.field).max = 3.6, | ||
(dccl.field).min = 1.5, | ||
(dccl.field).resolution = 0.2 | ||
]; | ||
} | ||
|
||
message MaxNotMultipleOfResolution | ||
{ | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
required double a = 1 [(dccl.field).max = 3.5, | ||
(dccl.field).min = 1.4, | ||
(dccl.field).resolution = 0.2]; | ||
option (dccl.msg).id = 11; | ||
option (dccl.msg).max_bytes = 32; | ||
option (dccl.msg).codec_version = 4; | ||
|
||
required double a = 1 [ | ||
(dccl.field).max = 3.5, | ||
(dccl.field).min = 1.4, | ||
(dccl.field).resolution = 0.2 | ||
]; | ||
} |