mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 21:50:47 +01:00
an attempt to reproduce GH #491
This commit is contained in:
@@ -165,37 +165,10 @@ void JSONTest::testFalseProperty()
|
||||
|
||||
void JSONTest::testNumberProperty()
|
||||
{
|
||||
std::string json = "{ \"test\" : 1969 }";
|
||||
Parser parser;
|
||||
Var result;
|
||||
|
||||
try
|
||||
{
|
||||
result = parser.parse(json);
|
||||
}
|
||||
catch(JSONException& jsone)
|
||||
{
|
||||
std::cout << jsone.message() << std::endl;
|
||||
assert(false);
|
||||
}
|
||||
|
||||
assert(result.type() == typeid(Object::Ptr));
|
||||
|
||||
Object::Ptr object = result.extract<Object::Ptr>();
|
||||
Var test = object->get("test");
|
||||
assert(test.isInteger());
|
||||
int value = test;
|
||||
assert(value == 1969);
|
||||
|
||||
DynamicStruct ds = *object;
|
||||
assert (!ds["test"].isEmpty());
|
||||
assert (ds["test"].isNumeric());
|
||||
assert (ds["test"] == 1969);
|
||||
|
||||
const DynamicStruct& rds = *object;
|
||||
assert (!rds["test"].isEmpty());
|
||||
assert (rds["test"].isNumeric());
|
||||
assert (rds["test"] == 1969);
|
||||
testNumber(1969);
|
||||
testNumber(-1969);
|
||||
testNumber(1969.5);
|
||||
testNumber(-1969.5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user