mirror of
https://github.com/Z3Prover/z3
synced 2025-06-09 15:43:25 +00:00
update parameter checking for doubles, and fix error reporting
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
f3a04734d9
commit
d77d6c6648
1 changed files with 4 additions and 4 deletions
|
@ -233,22 +233,22 @@ public:
|
||||||
void validate_type(symbol const& name, char const* value, param_descrs const& d) {
|
void validate_type(symbol const& name, char const* value, param_descrs const& d) {
|
||||||
param_kind k = d.get_kind(name);
|
param_kind k = d.get_kind(name);
|
||||||
std::stringstream strm;
|
std::stringstream strm;
|
||||||
|
char const* _value = value;
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case CPK_UINT:
|
case CPK_UINT:
|
||||||
for (; *value; ++value) {
|
for (; *value; ++value) {
|
||||||
if (!('0' <= *value && *value <= '9')) {
|
if (!('0' <= *value && *value <= '9')) {
|
||||||
strm << "Expected values for parameter " << name
|
strm << "Expected values for parameter " << name
|
||||||
<< " is an unsigned integer. It was given argument '" << value << "'";
|
<< " is an unsigned integer. It was given argument '" << _value << "'";
|
||||||
throw default_exception(strm.str());
|
throw default_exception(strm.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CPK_DOUBLE:
|
case CPK_DOUBLE:
|
||||||
for (; *value; ++value) {
|
for (; *value; ++value) {
|
||||||
if (!('0' <= *value && *value <= '9') && *value != '.' && *value != '-') {
|
if (!('0' <= *value && *value <= '9') && *value != '.' && *value != '-' && *value != '/') {
|
||||||
strm << "Expected values for parameter " << name
|
strm << "Expected values for parameter " << name
|
||||||
<< " is a double. It was given argument '" << value << "'";
|
<< " is a double. It was given argument '" << _value << "'";
|
||||||
throw default_exception(strm.str());
|
throw default_exception(strm.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue