mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-11-15 00:07:08 +01:00
Update POCO library.
This commit is contained in:
1 parent
8d15f4b6e9
commit
233fc103f9
2521 files changed
+257092
-72789
No files matched your search
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/ObjectPool.h"
|
||||
#include "Poco/MongoDB/Array.h"
|
||||
#include "Poco/MongoDB/InsertRequest.h"
|
||||
#include "Poco/MongoDB/QueryRequest.h"
|
||||
#include "Poco/MongoDB/DeleteRequest.h"
|
||||
@@ -77,6 +78,41 @@ void MongoDBTest::testInsertRequest()
|
||||
_mongo->sendRequest(request);
|
||||
}
|
||||
|
||||
void MongoDBTest::testArray()
|
||||
{
|
||||
Poco::MongoDB::Array::Ptr arr = new Poco::MongoDB::Array();
|
||||
|
||||
arr->add(std::string("First"));
|
||||
|
||||
Poco::DateTime birthdate;
|
||||
birthdate.assign(1969, 3, 9);
|
||||
arr->add(birthdate.timestamp());
|
||||
|
||||
arr->add(static_cast<Poco::Int32>(1993));
|
||||
arr->add(false);
|
||||
|
||||
// Document-style interface
|
||||
arr->add("4", "12.4");
|
||||
|
||||
assertEqual(arr->size(), 5);
|
||||
assertTrue(arr->exists("0"));
|
||||
assertTrue(arr->exists("1"));
|
||||
assertTrue(arr->exists("2"));
|
||||
assertTrue(arr->exists("3"));
|
||||
assertFalse(arr->exists("4"));
|
||||
|
||||
assertEqual(arr->get<std::string>(0), "First");
|
||||
assertEqual(arr->get<Poco::Timestamp>(1).raw(), birthdate.timestamp().raw());
|
||||
assertEqual(arr->get<Poco::Int32>(2), 1993);
|
||||
assertEqual(arr->get<bool>(3), false);
|
||||
assertEqual(arr->get<std::string>(4), "12.4");
|
||||
|
||||
// Document-style interface
|
||||
assertEqual(arr->get<Poco::Int32>("2"), 1993);
|
||||
assertEqual(arr->get<std::string>("4"), "12.4");
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MongoDBTest::testQueryRequest()
|
||||
{
|
||||
@@ -472,6 +508,7 @@ CppUnit::Test* MongoDBTest::suite()
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("MongoDBTest");
|
||||
CppUnit_addTest(pSuite, MongoDBTest, testBuildInfo);
|
||||
CppUnit_addTest(pSuite, MongoDBTest, testInsertRequest);
|
||||
CppUnit_addTest(pSuite, MongoDBTest, testArray);
|
||||
CppUnit_addTest(pSuite, MongoDBTest, testQueryRequest);
|
||||
CppUnit_addTest(pSuite, MongoDBTest, testDBQueryRequest);
|
||||
CppUnit_addTest(pSuite, MongoDBTest, testCountCommand);
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
virtual ~MongoDBTest();
|
||||
|
||||
void testInsertRequest();
|
||||
void testArray();
|
||||
void testQueryRequest();
|
||||
void testDBQueryRequest();
|
||||
void testCountCommand();
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ int _tmain(int argc, wchar_t* argv[])
|
||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
||||
args.push_back(std::string(buffer));
|
||||
}
|
||||
CppUnit::TestRunner runner;
|
||||
CppUnit::TestRunner runner;
|
||||
runner.addTest("MongoDBTestSuite", MongoDBTestSuite::suite());
|
||||
return runner.run(args) ? 0 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user