mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
clang build fixes
This commit is contained in:
parent
09c7fc0fa0
commit
102413aed5
@ -13,14 +13,6 @@
|
|||||||
#include "JSONTest.h"
|
#include "JSONTest.h"
|
||||||
#include "CppUnit/TestCaller.h"
|
#include "CppUnit/TestCaller.h"
|
||||||
#include "CppUnit/TestSuite.h"
|
#include "CppUnit/TestSuite.h"
|
||||||
#include "Poco/JSON/Object.h"
|
|
||||||
#include "Poco/JSON/Parser.h"
|
|
||||||
#include "Poco/JSON/Query.h"
|
|
||||||
#include "Poco/JSON/JSONException.h"
|
|
||||||
#include "Poco/JSON/Stringifier.h"
|
|
||||||
#include "Poco/JSON/ParseHandler.h"
|
|
||||||
#include "Poco/JSON/PrintHandler.h"
|
|
||||||
#include "Poco/JSON/Template.h"
|
|
||||||
#include "Poco/Path.h"
|
#include "Poco/Path.h"
|
||||||
#include "Poco/Environment.h"
|
#include "Poco/Environment.h"
|
||||||
#include "Poco/File.h"
|
#include "Poco/File.h"
|
||||||
|
@ -18,6 +18,15 @@
|
|||||||
|
|
||||||
#include "Poco/JSON/JSON.h"
|
#include "Poco/JSON/JSON.h"
|
||||||
#include "CppUnit/TestCase.h"
|
#include "CppUnit/TestCase.h"
|
||||||
|
#include "Poco/JSON/Object.h"
|
||||||
|
#include "Poco/JSON/Parser.h"
|
||||||
|
#include "Poco/JSON/Query.h"
|
||||||
|
#include "Poco/JSON/JSONException.h"
|
||||||
|
#include "Poco/JSON/Stringifier.h"
|
||||||
|
#include "Poco/JSON/ParseHandler.h"
|
||||||
|
#include "Poco/JSON/PrintHandler.h"
|
||||||
|
#include "Poco/JSON/Template.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
class JSONTest: public CppUnit::TestCase
|
class JSONTest: public CppUnit::TestCase
|
||||||
@ -83,33 +92,33 @@ private:
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "{ \"test\" : " << number << " }";
|
os << "{ \"test\" : " << number << " }";
|
||||||
std::string json = os.str();
|
std::string json = os.str();
|
||||||
Parser parser;
|
Poco::JSON::Parser parser;
|
||||||
Var result;
|
Poco::Dynamic::Var result;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result = parser.parse(json);
|
result = parser.parse(json);
|
||||||
}
|
}
|
||||||
catch (JSONException& jsone)
|
catch (Poco::JSON::JSONException& jsone)
|
||||||
{
|
{
|
||||||
std::cout << jsone.message() << std::endl;
|
std::cout << jsone.message() << std::endl;
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(result.type() == typeid(Object::Ptr));
|
assert(result.type() == typeid(Poco::JSON::Object::Ptr));
|
||||||
|
|
||||||
Object::Ptr object = result.extract<Object::Ptr>();
|
Poco::JSON::Object::Ptr object = result.extract<Poco::JSON::Object::Ptr>();
|
||||||
Var test = object->get("test");
|
Poco::Dynamic::Var test = object->get("test");
|
||||||
assert(test.isNumeric());
|
assert(test.isNumeric());
|
||||||
T value = test;
|
T value = test;
|
||||||
assert(value == number);
|
assert(value == number);
|
||||||
|
|
||||||
DynamicStruct ds = *object;
|
Poco::DynamicStruct ds = *object;
|
||||||
assert(!ds["test"].isEmpty());
|
assert(!ds["test"].isEmpty());
|
||||||
assert(ds["test"].isNumeric());
|
assert(ds["test"].isNumeric());
|
||||||
assert(ds["test"] == number);
|
assert(ds["test"] == number);
|
||||||
|
|
||||||
const DynamicStruct& rds = *object;
|
const Poco::DynamicStruct& rds = *object;
|
||||||
assert(!rds["test"].isEmpty());
|
assert(!rds["test"].isEmpty());
|
||||||
assert(rds["test"].isNumeric());
|
assert(rds["test"].isNumeric());
|
||||||
assert(rds["test"] == number);
|
assert(rds["test"] == number);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user