json: fix negative max
This commit is contained in:
parent
a786c0381b
commit
931b543607
2 changed files with 13 additions and 1 deletions
|
@ -333,7 +333,7 @@ static void _generate_min_max_int(int min_value, int max_value, std::stringstrea
|
|||
_generate_min_max_int(0, max_value, out, decimals_left, /* top_level= */ true);
|
||||
} else {
|
||||
out << "\"-\" (";
|
||||
_generate_min_max_int(std::numeric_limits<int>::min(), -max_value, out, decimals_left, /* top_level= */ false);
|
||||
_generate_min_max_int(-max_value, std::numeric_limits<int>::max(), out, decimals_left, /* top_level= */ false);
|
||||
out << ")";
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -180,6 +180,18 @@ static void test_all(const std::string & lang, std::function<void(const TestCase
|
|||
})""",
|
||||
R"""(
|
||||
root ::= ("-" [0-5] | [0] | [1-9] [0-9]{0,15}) space
|
||||
)"""
|
||||
});
|
||||
|
||||
test({
|
||||
SUCCESS,
|
||||
"max -5",
|
||||
R"""({
|
||||
"type": "integer",
|
||||
"maximum": -5
|
||||
})""",
|
||||
R"""(
|
||||
root ::= ("-" ([0-4] [0-9]{1,15} | [5-9] [0-9]{0,15})) space
|
||||
space ::= " "?
|
||||
)"""
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue