mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
commit
d4f0ab93c8
@ -283,7 +283,7 @@ class MyDto : public oatpp::DTO {
|
||||
auto entry = oatpp::Enum<MyEnum>::getEntryByUnderlyingValue(123);
|
||||
auto entry = oatpp::Enum<MyEnum>::getEntryByIndex(0);
|
||||
...
|
||||
OATPP_LOGD("Entry", "%d, %s, %d, %d, %s", entry.index, entry.name, entry.value, entry.description);
|
||||
OATPP_LOGD("Entry", "%d, %s, %d, %d, %s", entry.index, entry.name, entry.value, entry.description)
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ Log all "Set-Cookie" headers:
|
||||
|
||||
for(auto it = itlow; it != itup; it ++) {
|
||||
oatpp::String value = it->second.toString();
|
||||
OATPP_LOGD("Header", "Set-Cookie: %s", value->c_str());
|
||||
OATPP_LOGD("Header", "Set-Cookie: %s", value->c_str())
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -68,7 +68,7 @@ Now it's much easier to use `oatpp::String` since `oatpp::String` is now wrapper
|
||||
|
||||
oatpp::String s3 = s1 + " " + s2; // concat oatpp::String with const char* and std::string directly
|
||||
|
||||
OATPP_LOGD("TEST", "str='%s'", s3->c_str()); // prints 'Hello World'
|
||||
OATPP_LOGD("TEST", "str='%s'", s3->c_str()) // prints 'Hello World'
|
||||
}
|
||||
|
||||
{
|
||||
@ -125,7 +125,7 @@ Now you can control if solidus is escaped or not.
|
||||
oatpp::parser::json::mapping::ObjectMapper mapper;
|
||||
// mapper.getSerializer()->getConfig()->escapeFlags = 0; // by default FLAG_ESCAPE_SOLIDUS is ON
|
||||
auto res = mapper.writeToString(oatpp::String("https://oatpp.io/"));
|
||||
OATPP_LOGD("TEST", "res='%s'", res->c_str());
|
||||
OATPP_LOGD("TEST", "res='%s'", res->c_str())
|
||||
```
|
||||
|
||||
Output:
|
||||
@ -140,7 +140,7 @@ res='"https:\/\/oatpp.io\/"' # by default, solidus is escaped
|
||||
oatpp::parser::json::mapping::ObjectMapper mapper;
|
||||
mapper.getSerializer()->getConfig()->escapeFlags = 0;
|
||||
auto res = mapper.writeToString(oatpp::String("https://oatpp.io/"));
|
||||
OATPP_LOGD("TEST", "res='%s'", res->c_str());
|
||||
OATPP_LOGD("TEST", "res='%s'", res->c_str())
|
||||
```
|
||||
|
||||
Output:
|
||||
@ -172,7 +172,7 @@ Log all "Set-Cookie" headers:
|
||||
|
||||
for(auto it = bucketBegin; it != bucketEnd; it ++) {
|
||||
oatpp::String value = it->second.toString();
|
||||
OATPP_LOGD("Header", "Set-Cookie: %s", value->c_str());
|
||||
OATPP_LOGD("Header", "Set-Cookie: %s", value->c_str())
|
||||
}
|
||||
```
|
||||
|
||||
@ -190,7 +190,7 @@ Log all entries of "userId" query parameter:
|
||||
|
||||
for(auto it = bucketBegin; it != bucketEnd; it ++) {
|
||||
oatpp::String value = it->second.toString();
|
||||
OATPP_LOGD("QueryParameter", "userId: %s", value->c_str());
|
||||
OATPP_LOGD("QueryParameter", "userId: %s", value->c_str())
|
||||
}
|
||||
```
|
||||
|
||||
@ -270,7 +270,7 @@ ENDPOINT("POST", "payload", postPayload,
|
||||
if(r->payloadType == ClassType::CLASS_TYPE_B) {
|
||||
auto payload = r->payload.retrieve<oatpp::Object<ClassB>>();
|
||||
for(auto& value : *payload->values) {
|
||||
OATPP_LOGD("VALUE", "%s", value->c_str());
|
||||
OATPP_LOGD("VALUE", "%s", value->c_str())
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ ENDPOINT("POST", "upload", upload,
|
||||
/* list all parts and locations to corresponding temporary files */
|
||||
auto parts = multipart.getAllParts();
|
||||
for(auto& p : parts) {
|
||||
OATPP_LOGD("part", "name=%s, location=%s", p->getName()->c_str(), p->getPayload()->getLocation()->c_str());
|
||||
OATPP_LOGD("part", "name=%s, location=%s", p->getName()->c_str(), p->getPayload()->getLocation()->c_str())
|
||||
}
|
||||
|
||||
/* return 200 */
|
||||
|
@ -23,7 +23,7 @@ oatpp::encoding::Url::Config config;
|
||||
auto encoded = oatpp::encoding::Url::encode(data, config);
|
||||
auto decoded = oatpp::encoding::Url::decode(encoded);
|
||||
|
||||
OATPP_ASSERT(decoded == data);
|
||||
OATPP_ASSERT(decoded == data)
|
||||
```
|
||||
**Note**: Oat++ does NOT automatically decode URL and its parameters on endpoint hit.
|
||||
|
||||
|
@ -104,6 +104,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
add_compiler_flags(4.6 "-Wextra")
|
||||
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compiler_flags(10 "-Weverything")
|
||||
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
|
||||
#
|
||||
# Preserve debug information flags
|
||||
@ -112,6 +116,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
add_compiler_flags(4.6 "-g3")
|
||||
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compiler_flags(10 "-g3")
|
||||
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
|
||||
#
|
||||
# C/C++ Warning Flags
|
||||
@ -273,6 +281,40 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
add_compiler_flags(9.1 "-Wno-pessimizing-move")
|
||||
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compiler_flags(14 "-Wno-c++14-attribute-extensions")
|
||||
add_compiler_flags(10 "-Wno-c++14-extensions")
|
||||
add_compiler_flags(10 "-Wno-c++98-compat")
|
||||
add_compiler_flags(10 "-Wno-c++98-compat-pedantic")
|
||||
add_compiler_flags(10 "-Wno-covered-switch-default")
|
||||
add_compiler_flags(10 "-Wno-delete-non-abstract-non-virtual-dtor")
|
||||
add_compiler_flags(10 "-Wno-deprecated-copy-dtor")
|
||||
add_compiler_flags(14 "-Wno-deprecated-copy-with-user-provided-dtor")
|
||||
add_compiler_flags(10 "-Wno-documentation")
|
||||
add_compiler_flags(10 "-Wno-documentation-unknown-command")
|
||||
add_compiler_flags(10 "-Wno-exit-time-destructors")
|
||||
add_compiler_flags(10 "-Wno-format-nonliteral")
|
||||
add_compiler_flags(10 "-Wno-global-constructors")
|
||||
add_compiler_flags(10 "-Wno-gnu-zero-variadic-macro-arguments")
|
||||
add_compiler_flags(10 "-Wno-implicit-int-conversion")
|
||||
add_compiler_flags(10 "-Wno-non-virtual-dtor")
|
||||
add_compiler_flags(10 "-Wno-padded")
|
||||
add_compiler_flags(10 "-Wno-pessimizing-move")
|
||||
add_compiler_flags(99 "-Wno-return-std-move-in-c++11")
|
||||
add_compiler_flags(10 "-Wno-reserved-id-macro")
|
||||
add_compiler_flags(14 "-Wno-reserved-identifier")
|
||||
add_compiler_flags(10 "-Wno-string-conversion")
|
||||
add_compiler_flags(14 "-Wno-suggest-destructor-override")
|
||||
add_compiler_flags(10 "-Wno-unknown-warning-option")
|
||||
add_compiler_flags(10 "-Wno-unneeded-member-function")
|
||||
add_compiler_flags(10 "-Wno-unreachable-code-return")
|
||||
add_compiler_flags(10 "-Wno-unsafe-buffer-usage")
|
||||
add_compiler_flags(10 "-Wno-unused-member-function")
|
||||
add_compiler_flags(10 "-Wno-unused-parameter")
|
||||
add_compiler_flags(10 "-Wno-unused-template")
|
||||
add_compiler_flags(10 "-Wno-weak-vtables")
|
||||
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
|
||||
#
|
||||
# Sanitize flags
|
||||
|
@ -33,7 +33,7 @@ PerformanceChecker::PerformanceChecker(const char* tag)
|
||||
|
||||
PerformanceChecker::~PerformanceChecker(){
|
||||
v_int64 elapsedTicks = oatpp::base::Environment::getMicroTickCount() - m_ticks;
|
||||
OATPP_LOGD(m_tag, "%ld(micro)", elapsedTicks);
|
||||
OATPP_LOGD(m_tag, "%ld(micro)", elapsedTicks)
|
||||
}
|
||||
|
||||
v_int64 PerformanceChecker::getElapsedTicks(){
|
||||
@ -54,10 +54,10 @@ ThreadLocalObjectsChecker::~ThreadLocalObjectsChecker(){
|
||||
v_counter objectsCreatedPerTest = base::Environment::getThreadLocalObjectsCreated() - m_objectsCreated;
|
||||
|
||||
if(leakingObjects == 0){
|
||||
OATPP_LOGE(m_tag, "OK:\n created(obj): %ld", objectsCreatedPerTest);
|
||||
OATPP_LOGE(m_tag, "OK:\n created(obj): %ld", objectsCreatedPerTest)
|
||||
}else{
|
||||
OATPP_LOGE(m_tag, "FAILED, leakingObjects = %ld", leakingObjects);
|
||||
OATPP_ASSERT(false);
|
||||
OATPP_LOGE(m_tag, "FAILED, leakingObjects = %ld", leakingObjects)
|
||||
OATPP_ASSERT(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace oatpp { namespace test {
|
||||
|
||||
void UnitTest::run(v_int32 times) {
|
||||
|
||||
OATPP_LOGI(TAG, "\033[1mSTART\033[0m...");
|
||||
OATPP_LOGI(TAG, "\033[1mSTART\033[0m...")
|
||||
|
||||
v_counter objectsCount = base::Environment::getObjectsCount();
|
||||
v_counter objectsCreated = base::Environment::getObjectsCreated();
|
||||
@ -51,11 +51,11 @@ void UnitTest::run(v_int32 times) {
|
||||
v_counter objectsCreatedPerTest = base::Environment::getObjectsCreated() - objectsCreated;
|
||||
|
||||
if(leakingObjects == 0){
|
||||
OATPP_LOGI(TAG, "\033[1mFINISHED\033[0m - \033[1;32msuccess!\033[0m");
|
||||
OATPP_LOGI(TAG, "\033[33m%ld(micro), %ld(objs)\033[0m\n", millis, objectsCreatedPerTest);
|
||||
OATPP_LOGI(TAG, "\033[1mFINISHED\033[0m - \033[1;32msuccess!\033[0m")
|
||||
OATPP_LOGI(TAG, "\033[33m%ld(micro), %ld(objs)\033[0m\n", millis, objectsCreatedPerTest)
|
||||
}else{
|
||||
|
||||
OATPP_LOGE(TAG, "\033[1mFINISHED\033[0m - \033[1;31mfailed\033[0m, leakingObjects = %ld", leakingObjects);
|
||||
OATPP_LOGE(TAG, "\033[1mFINISHED\033[0m - \033[1;31mfailed\033[0m, leakingObjects = %ld", leakingObjects)
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
m_server = std::make_shared<oatpp::network::Server>(m_connectionProvider, m_connectionHandler);
|
||||
OATPP_LOGD("\033[1;34mClientServerTestRunner\033[0m", "\033[1;34mRunning server on port %s. Timeout %ld(micro)\033[0m",
|
||||
m_connectionProvider->getProperty("port").toString()->c_str(),
|
||||
timeout.count());
|
||||
timeout.count())
|
||||
|
||||
std::function<bool()> condition = [&runConditionForLambda](){
|
||||
return runConditionForLambda;
|
||||
@ -120,7 +120,7 @@ public:
|
||||
while(running) {
|
||||
timeoutCondition.wait_for(lock, std::chrono::seconds(1));
|
||||
auto elapsed = std::chrono::system_clock::now() - startTime;
|
||||
OATPP_ASSERT("ClientServerTestRunner: Error. Timeout." && elapsed < timeout);
|
||||
OATPP_ASSERT("ClientServerTestRunner: Error. Timeout." && elapsed < timeout)
|
||||
}
|
||||
|
||||
});
|
||||
@ -129,7 +129,7 @@ public:
|
||||
clientThread.join();
|
||||
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - startTime);
|
||||
OATPP_LOGD("\033[1;34mClientServerTestRunner\033[0m", "\033[1;34mFinished with time %ld(micro). Stopping server...\033[0m", elapsed.count());
|
||||
OATPP_LOGD("\033[1;34mClientServerTestRunner\033[0m", "\033[1;34mFinished with time %ld(micro). Stopping server...\033[0m", elapsed.count())
|
||||
|
||||
running = false;
|
||||
timeoutCondition.notify_one();
|
||||
|
@ -70,4 +70,4 @@
|
||||
|
||||
#undef OATPP_ENUM_MACRO_1
|
||||
|
||||
#undef ENUM
|
||||
#undef ENUM
|
||||
|
@ -142,4 +142,4 @@ void ConditionVariable::notifyAll() {
|
||||
m_list.notifyAll();
|
||||
}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
@ -315,7 +315,7 @@ Action CoroutineHandle::takeAction(Action&& action) {
|
||||
default:
|
||||
return std::forward<oatpp::async::Action>(action);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// action = iterate();
|
||||
// ++ iterations;
|
||||
|
@ -430,7 +430,7 @@ private:
|
||||
public:
|
||||
|
||||
CoroutineHandle(Processor* processor, AbstractCoroutine* rootCoroutine);
|
||||
~CoroutineHandle();
|
||||
~CoroutineHandle() override;
|
||||
|
||||
Action takeAction(Action&& action);
|
||||
Action iterate();
|
||||
@ -501,7 +501,7 @@ public:
|
||||
/**
|
||||
* Virtual Destructor
|
||||
*/
|
||||
virtual ~AbstractCoroutine() = default;
|
||||
virtual ~AbstractCoroutine() override = default;
|
||||
|
||||
/**
|
||||
* Entrypoint of Coroutine.
|
||||
|
@ -97,4 +97,4 @@ CoroutineWaitList& CoroutineWaitList::operator=(CoroutineWaitList&& other) {
|
||||
|
||||
}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
@ -30,4 +30,4 @@ Error::Error(const std::string& what)
|
||||
: runtime_error(what)
|
||||
{}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~IOEventWorker();
|
||||
~IOEventWorker() override;
|
||||
|
||||
/**
|
||||
* Push list of tasks to worker.
|
||||
@ -158,7 +158,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~IOEventWorkerForeman();
|
||||
~IOEventWorkerForeman() override;
|
||||
|
||||
/**
|
||||
* Push list of tasks to worker.
|
||||
|
@ -46,7 +46,7 @@ void IOEventWorker::initEventQueue() {
|
||||
#endif
|
||||
|
||||
if(m_eventQueueHandle == -1) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]", "Error. Call to ::epoll_create1() failed. errno=%d", errno);
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]", "Error. Call to ::epoll_create1() failed. errno=%d", errno)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Call to ::epoll_create1() failed.");
|
||||
}
|
||||
|
||||
@ -54,14 +54,14 @@ void IOEventWorker::initEventQueue() {
|
||||
|
||||
if(!m_outEvents) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]",
|
||||
"Error. Unable to allocate %lu bytes for events.", MAX_EVENTS * sizeof(epoll_event));
|
||||
"Error. Unable to allocate %lu bytes for events.", MAX_EVENTS * sizeof(epoll_event))
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Unable to allocate memory for events.");
|
||||
}
|
||||
|
||||
m_wakeupTrigger = ::eventfd(0, EFD_NONBLOCK);
|
||||
|
||||
if(m_wakeupTrigger == -1) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]", "Error. Call to ::eventfd() failed. errno=%d", errno);
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]", "Error. Call to ::eventfd() failed. errno=%d", errno)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Call to ::eventfd() failed.");
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ void IOEventWorker::initEventQueue() {
|
||||
|
||||
auto res = ::epoll_ctl(m_eventQueueHandle, EPOLL_CTL_ADD, m_wakeupTrigger, &event);
|
||||
if(res == -1) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]", "Error. Call to ::epoll_ctl failed. errno=%d", errno);
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]", "Error. Call to ::epoll_ctl failed. errno=%d", errno)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Call to ::epoll_ctl() failed.");
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ void IOEventWorker::setCoroutineEvent(CoroutineHandle* coroutine, int operation,
|
||||
case Action::TYPE_IO_REPEAT: break;
|
||||
|
||||
default:
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::pushCoroutineToQueue()]", "Error. Unknown Action. action.getType()==%d", action.getType());
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::pushCoroutineToQueue()]", "Error. Unknown Action. action.getType()==%d", action.getType())
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::pushCoroutineToQueue()]: Error. Unknown Action.");
|
||||
|
||||
}
|
||||
@ -131,7 +131,7 @@ void IOEventWorker::setCoroutineEvent(CoroutineHandle* coroutine, int operation,
|
||||
|
||||
auto res = epoll_ctl(m_eventQueueHandle, operation, action.getIOHandle(), &event);
|
||||
if(res == -1) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::setEpollEvent()]", "Error. Call to epoll_ctl failed. operation=%d, errno=%d", operation, errno);
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::setEpollEvent()]", "Error. Call to epoll_ctl failed. operation=%d, errno=%d", operation, errno)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::setEpollEvent()]: Error. Call to epoll_ctl failed.");
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ void IOEventWorker::waitEvents() {
|
||||
"foreman=%lx\n"
|
||||
"this=%lx\n"
|
||||
"specialization=%d",
|
||||
errno, m_inEventsCount, reinterpret_cast<v_buff_usize>(m_foreman), reinterpret_cast<v_buff_usize>(this), m_specialization);
|
||||
errno, m_inEventsCount, reinterpret_cast<v_buff_usize>(m_foreman), reinterpret_cast<v_buff_usize>(this), m_specialization)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::waitEvents()]: Error. Event loop failed.");
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ void IOEventWorker::waitEvents() {
|
||||
"[oatpp::async::worker::IOEventWorker::waitEvents()]",
|
||||
"Error. Call to epoll_ctl failed. operation=%d, errno=%d. action_code=%d, worker_specialization=%d",
|
||||
EPOLL_CTL_DEL, errno, action.getIOEventCode(), m_specialization
|
||||
);
|
||||
)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::waitEvents()]: Error. Call to epoll_ctl failed.");
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ void IOEventWorker::waitEvents() {
|
||||
"[oatpp::async::worker::IOEventWorker::waitEvents()]",
|
||||
"Error. Call to epoll_ctl failed. operation=%d, errno=%d. action_code=%d, worker_specialization=%d",
|
||||
EPOLL_CTL_DEL, errno, action.getIOEventCode(), m_specialization
|
||||
);
|
||||
)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::waitEvents()]: Error. Call to epoll_ctl failed.");
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ void IOEventWorker::waitEvents() {
|
||||
|
||||
res = epoll_ctl(m_eventQueueHandle, EPOLL_CTL_DEL, prevAction.getIOHandle(), nullptr);
|
||||
if(res == -1) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::waitEvents()]", "Error. Call to epoll_ctl failed. operation=%d, errno=%d", EPOLL_CTL_DEL, errno);
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::waitEvents()]", "Error. Call to epoll_ctl failed. operation=%d, errno=%d", EPOLL_CTL_DEL, errno)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::waitEvents()]: Error. Call to epoll_ctl failed.");
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void IOEventWorker::initEventQueue() {
|
||||
m_outEvents = std::unique_ptr<v_char8[]>(new (std::nothrow) v_char8[MAX_EVENTS * sizeof(struct kevent)]);
|
||||
if(!m_outEvents) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]",
|
||||
"Error. Unable to allocate %d bytes for events.", MAX_EVENTS * sizeof(struct kevent));
|
||||
"Error. Unable to allocate %d bytes for events.", MAX_EVENTS * sizeof(struct kevent))
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Unable to allocate memory for events.");
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ void IOEventWorker::consumeBacklog() {
|
||||
m_inEvents = std::unique_ptr<v_char8[]>(new (std::nothrow) v_char8[m_inEventsCapacity * sizeof(struct kevent)]);
|
||||
if(!m_inEvents) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::consumeBacklog()]",
|
||||
"Error. Unable to allocate %d bytes for events.", m_inEventsCapacity * sizeof(struct kevent));
|
||||
"Error. Unable to allocate %d bytes for events.", m_inEventsCapacity * sizeof(struct kevent))
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::consumeBacklog()]: Error. Unable to allocate memory for events.");
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ void IOEventWorker::waitEvents() {
|
||||
"foreman=%d\n"
|
||||
"this=%d\n"
|
||||
"specialization=%d",
|
||||
errno, m_inEventsCount, m_foreman, this, m_specialization);
|
||||
errno, m_inEventsCount, m_foreman, this, m_specialization)
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::waitEvents()]: Error. Event loop failed.");
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ void IOEventWorker::waitEvents() {
|
||||
auto coroutine = (CoroutineHandle*) event->udata;
|
||||
|
||||
if((event->flags & EV_ERROR) > 0) {
|
||||
OATPP_LOGD("Error", "data='%s'", strerror((int)event->data));
|
||||
OATPP_LOGD("Error", "data='%s'", strerror((int)event->data))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -172,4 +172,4 @@ void IOWorker::detach() {
|
||||
m_thread.detach();
|
||||
}
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
@ -136,4 +136,4 @@ void TimerWorker::detach() {
|
||||
m_thread.detach();
|
||||
}
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
@ -54,4 +54,4 @@ Worker::Type Worker::getType() {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
@ -246,10 +246,10 @@ void Environment::checkTypes(){
|
||||
v_uint32 vUInt32 = ~v_uint32(1);
|
||||
v_uint64 vUInt64 = ~v_uint64(1);
|
||||
|
||||
OATPP_ASSERT(vInt32 < 0);
|
||||
OATPP_ASSERT(vInt64 < 0);
|
||||
OATPP_ASSERT(vUInt32 > 0);
|
||||
OATPP_ASSERT(vUInt64 > 0);
|
||||
OATPP_ASSERT(vInt32 < 0)
|
||||
OATPP_ASSERT(vInt64 < 0)
|
||||
OATPP_ASSERT(vUInt32 > 0)
|
||||
OATPP_ASSERT(vUInt64 > 0)
|
||||
|
||||
}
|
||||
|
||||
@ -309,18 +309,18 @@ std::shared_ptr<Logger> Environment::getLogger() {
|
||||
|
||||
void Environment::printCompilationConfig() {
|
||||
|
||||
OATPP_LOGD("oatpp-version", OATPP_VERSION);
|
||||
OATPP_LOGD("oatpp-version", OATPP_VERSION)
|
||||
|
||||
#ifdef OATPP_DISABLE_ENV_OBJECT_COUNTERS
|
||||
OATPP_LOGD("oatpp/Config", "OATPP_DISABLE_ENV_OBJECT_COUNTERS");
|
||||
OATPP_LOGD("oatpp/Config", "OATPP_DISABLE_ENV_OBJECT_COUNTERS")
|
||||
#endif
|
||||
|
||||
#ifdef OATPP_COMPAT_BUILD_NO_THREAD_LOCAL
|
||||
OATPP_LOGD("oatpp/Config", "OATPP_COMPAT_BUILD_NO_THREAD_LOCAL");
|
||||
OATPP_LOGD("oatpp/Config", "OATPP_COMPAT_BUILD_NO_THREAD_LOCAL")
|
||||
#endif
|
||||
|
||||
#ifdef OATPP_THREAD_HARDWARE_CONCURRENCY
|
||||
OATPP_LOGD("oatpp/Config", "OATPP_THREAD_HARDWARE_CONCURRENCY=%d", OATPP_THREAD_HARDWARE_CONCURRENCY);
|
||||
OATPP_LOGD("oatpp/Config", "OATPP_THREAD_HARDWARE_CONCURRENCY=%d", OATPP_THREAD_HARDWARE_CONCURRENCY)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ public:
|
||||
*/
|
||||
#define OATPP_ASSERT_FMT(FMT, EXP) \
|
||||
if(!(EXP)) { \
|
||||
OATPP_LOGE("\033[1mASSERT\033[0m[\033[1;31mFAILED\033[0m]", FMT, #EXP); \
|
||||
OATPP_LOGE("\033[1mASSERT\033[0m[\033[1;31mFAILED\033[0m]", FMT, #EXP) \
|
||||
exit(EXIT_FAILURE); \
|
||||
}
|
||||
|
||||
@ -501,7 +501,7 @@ if(!(EXP)) { \
|
||||
*/
|
||||
#define OATPP_ASSERT(EXP) \
|
||||
if(!(EXP)) { \
|
||||
OATPP_LOGE("\033[1mASSERT\033[0m[\033[1;31mFAILED\033[0m]", #EXP); \
|
||||
OATPP_LOGE("\033[1mASSERT\033[0m[\033[1;31mFAILED\033[0m]", #EXP) \
|
||||
exit(EXIT_FAILURE); \
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ v_int32 setThreadAffinityToCpuRange(std::thread::native_handle_type nativeHandle
|
||||
v_int32 result = pthread_setaffinity_np(nativeHandle, sizeof(cpu_set_t), &cpuset);
|
||||
|
||||
if (result != 0) {
|
||||
OATPP_LOGD("[oatpp::concurrency::Thread::assignThreadToCpu(...)]", "error code - %d", result);
|
||||
OATPP_LOGD("[oatpp::concurrency::Thread::assignThreadToCpu(...)]", "error code - %d", result)
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -78,7 +78,7 @@ static v_int32 calcHardwareConcurrency() {
|
||||
#if !defined(OATPP_THREAD_HARDWARE_CONCURRENCY)
|
||||
v_int32 concurrency = static_cast<v_int32>(std::thread::hardware_concurrency());
|
||||
if(concurrency == 0) {
|
||||
OATPP_LOGD("[oatpp::concurrency:Thread::calcHardwareConcurrency()]", "Warning - failed to get hardware_concurrency. Setting hardware_concurrency=1");
|
||||
OATPP_LOGD("[oatpp::concurrency:Thread::calcHardwareConcurrency()]", "Warning - failed to get hardware_concurrency. Setting hardware_concurrency=1")
|
||||
concurrency = 1;
|
||||
}
|
||||
return concurrency;
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~IOBuffer();
|
||||
~IOBuffer() override;
|
||||
|
||||
/**
|
||||
* Get pointer to buffer data.
|
||||
|
@ -42,4 +42,4 @@ oatpp::String ObjectMapper::writeToString(const type::Void& variant) const {
|
||||
return stream.toString();
|
||||
}
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
@ -402,7 +402,7 @@ public:
|
||||
auto dispatcher = static_cast<const __class::AbstractObject::PolymorphicDispatcher*>(
|
||||
__class::Object<ObjT>::getType()->polymorphicDispatcher
|
||||
);
|
||||
return dispatcher->getProperties()->getList().size();
|
||||
return static_cast<v_int64>(dispatcher->getProperties()->getList().size());
|
||||
}
|
||||
|
||||
ObjectWrapper<void>& operator[](const std::string& propertyName) {
|
||||
|
@ -30,4 +30,4 @@ namespace __class {
|
||||
const ClassId AbstractUnorderedSet::CLASS_ID("UnorderedSet");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}}
|
||||
|
@ -30,4 +30,4 @@ namespace __class {
|
||||
const ClassId AbstractVector::CLASS_ID("Vector");
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
/**
|
||||
* virtual destructor.
|
||||
*/
|
||||
virtual ~Resource() = default;
|
||||
virtual ~Resource() override = default;
|
||||
|
||||
/**
|
||||
* Open output stream.
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~BufferOutputStream();
|
||||
~BufferOutputStream() override;
|
||||
|
||||
/**
|
||||
* Write `count` of bytes to stream.
|
||||
|
@ -52,7 +52,7 @@ FileInputStream::FileInputStream(const char* filename, const std::shared_ptr<voi
|
||||
: FileInputStream(std::fopen(filename, "rb"), true, captureData)
|
||||
{
|
||||
if(!m_file) {
|
||||
OATPP_LOGE("[oatpp::data::stream::FileInputStream::FileInputStream(filename)]", "Error. Can't open file '%s'.", filename);
|
||||
OATPP_LOGE("[oatpp::data::stream::FileInputStream::FileInputStream(filename)]", "Error. Can't open file '%s'.", filename)
|
||||
throw std::runtime_error("[oatpp::data::stream::FileInputStream::FileInputStream(filename)]: Error. Can't open file.");
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ FileOutputStream::FileOutputStream(const char* filename, const char* mode, const
|
||||
: FileOutputStream(std::fopen(filename, mode), true, captureData)
|
||||
{
|
||||
if(!m_file) {
|
||||
OATPP_LOGE("[oatpp::data::stream::FileOutputStream::FileOutputStream(filename, mode)]", "Error. Can't open file '%s'.", filename);
|
||||
OATPP_LOGE("[oatpp::data::stream::FileOutputStream::FileOutputStream(filename, mode)]", "Error. Can't open file '%s'.", filename)
|
||||
throw std::runtime_error("[oatpp::data::stream::FileOutputStream::FileOutputStream(filename, mode)]: Error. Can't open file.");
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~FileInputStream();
|
||||
~FileInputStream() override;
|
||||
|
||||
/**
|
||||
* Get file.
|
||||
@ -160,7 +160,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~FileOutputStream();
|
||||
~FileOutputStream() override;
|
||||
|
||||
/**
|
||||
* Get file.
|
||||
|
@ -42,7 +42,7 @@ v_io_size WriteCallback::writeSimple(const void *data, v_buff_size count) {
|
||||
async::Action action;
|
||||
auto res = write(data, count, action);
|
||||
if(!action.isNone()) {
|
||||
OATPP_LOGE("[oatpp::data::stream::WriteCallback::writeSimple()]", "Error. writeSimple is called on a stream in Async mode.");
|
||||
OATPP_LOGE("[oatpp::data::stream::WriteCallback::writeSimple()]", "Error. writeSimple is called on a stream in Async mode.")
|
||||
throw std::runtime_error("[oatpp::data::stream::WriteCallback::writeSimple()]: Error. writeSimple is called on a stream in Async mode.");
|
||||
}
|
||||
return res;
|
||||
@ -54,7 +54,7 @@ v_io_size WriteCallback::writeExactSizeDataSimple(data::buffer::InlineWriteData&
|
||||
async::Action action;
|
||||
auto res = write(inlineData, action);
|
||||
if(!action.isNone()) {
|
||||
OATPP_LOGE("[oatpp::data::stream::WriteCallback::writeExactSizeDataSimple()]", "Error. writeExactSizeDataSimple() is called on a stream in Async mode.");
|
||||
OATPP_LOGE("[oatpp::data::stream::WriteCallback::writeExactSizeDataSimple()]", "Error. writeExactSizeDataSimple() is called on a stream in Async mode.")
|
||||
throw std::runtime_error("[oatpp::data::stream::WriteCallback::writeExactSizeDataSimple()]: Error. writeExactSizeDataSimple() is called on a stream in Async mode.");
|
||||
}
|
||||
if(res == IOError::BROKEN_PIPE || res == IOError::ZERO_VALUE) {
|
||||
@ -93,7 +93,7 @@ async::Action WriteCallback::writeExactSizeDataAsyncInline(data::buffer::InlineW
|
||||
case IOError::RETRY_WRITE:
|
||||
return async::Action::createActionByType(async::Action::TYPE_REPEAT);
|
||||
default:
|
||||
OATPP_LOGE("[oatpp::data::stream::writeExactSizeDataAsyncInline()]", "Error. Unknown IO result.");
|
||||
OATPP_LOGE("[oatpp::data::stream::writeExactSizeDataAsyncInline()]", "Error. Unknown IO result.")
|
||||
return new async::Error(
|
||||
"[oatpp::data::stream::writeExactSizeDataAsyncInline()]: Error. Unknown IO result.");
|
||||
}
|
||||
@ -146,7 +146,7 @@ v_io_size ReadCallback::readExactSizeDataSimple(data::buffer::InlineReadData& in
|
||||
async::Action action;
|
||||
auto res = read(inlineData, action);
|
||||
if(!action.isNone()) {
|
||||
OATPP_LOGE("[oatpp::data::stream::ReadCallback::readExactSizeDataSimple()]", "Error. readExactSizeDataSimple() is called on a stream in Async mode.");
|
||||
OATPP_LOGE("[oatpp::data::stream::ReadCallback::readExactSizeDataSimple()]", "Error. readExactSizeDataSimple() is called on a stream in Async mode.")
|
||||
throw std::runtime_error("[oatpp::data::stream::ReadCallback::readExactSizeDataSimple()]: Error. readExactSizeDataSimple() is called on a stream in Async mode.");
|
||||
}
|
||||
if(res <= 0 && res != IOError::RETRY_READ && res != IOError::RETRY_WRITE) {
|
||||
@ -185,7 +185,7 @@ async::Action ReadCallback::readExactSizeDataAsyncInline(data::buffer::InlineRea
|
||||
case IOError::RETRY_WRITE:
|
||||
return async::Action::createActionByType(async::Action::TYPE_REPEAT);
|
||||
default:
|
||||
OATPP_LOGE("[oatpp::data::stream::readExactSizeDataAsyncInline()]", "Error. Unknown IO result.");
|
||||
OATPP_LOGE("[oatpp::data::stream::readExactSizeDataAsyncInline()]", "Error. Unknown IO result.")
|
||||
return new async::Error(
|
||||
"[oatpp::data::stream::readExactSizeDataAsyncInline()]: Error. Unknown IO result.");
|
||||
}
|
||||
@ -219,7 +219,7 @@ async::Action ReadCallback::readSomeDataAsyncInline(data::buffer::InlineReadData
|
||||
case IOError::RETRY_WRITE:
|
||||
return async::Action::createActionByType(async::Action::TYPE_REPEAT);
|
||||
default:
|
||||
OATPP_LOGE("[oatpp::data::stream::readSomeDataAsyncInline()]", "Error. Unknown IO result.");
|
||||
OATPP_LOGE("[oatpp::data::stream::readSomeDataAsyncInline()]", "Error. Unknown IO result.")
|
||||
return new async::Error(
|
||||
"[oatpp::data::stream::readSomeDataAsyncInline()]: Error. Unknown IO result.");
|
||||
}
|
||||
@ -235,7 +235,7 @@ v_io_size ReadCallback::readSimple(void *data, v_buff_size count) {
|
||||
async::Action action;
|
||||
auto res = read(data, count, action);
|
||||
if(!action.isNone()) {
|
||||
OATPP_LOGE("[oatpp::data::stream::ReadCallback::readSimple()]", "Error. readSimple is called on a stream in Async mode.");
|
||||
OATPP_LOGE("[oatpp::data::stream::ReadCallback::readSimple()]", "Error. readSimple is called on a stream in Async mode.")
|
||||
throw std::runtime_error("[oatpp::data::stream::ReadCallback::readSimple()]: Error. readSimple is called on a stream in Async mode.");
|
||||
}
|
||||
return res;
|
||||
|
@ -262,7 +262,7 @@ public:
|
||||
/**
|
||||
* Default virtual destructor.
|
||||
*/
|
||||
virtual ~OutputStream() = default;
|
||||
virtual ~OutputStream() override = default;
|
||||
|
||||
/**
|
||||
* Set stream I/O mode.
|
||||
@ -328,7 +328,7 @@ public:
|
||||
/**
|
||||
* Default virtual destructor.
|
||||
*/
|
||||
virtual ~InputStream() = default;
|
||||
virtual ~InputStream() override = default;
|
||||
|
||||
/**
|
||||
* Set stream I/O mode.
|
||||
@ -358,7 +358,7 @@ class BufferedInputStream : public InputStream {
|
||||
/**
|
||||
* Default virtual destructor.
|
||||
*/
|
||||
virtual ~BufferedInputStream() = default;
|
||||
virtual ~BufferedInputStream() override = default;
|
||||
|
||||
/**
|
||||
* Peek up to count of bytes int he buffer
|
||||
|
@ -45,4 +45,4 @@ v_buff_size ParsingError::getPosition() const {
|
||||
return m_position;
|
||||
}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
/**
|
||||
* Default virtual destructor.
|
||||
*/
|
||||
virtual ~Invalidator() = default;
|
||||
virtual ~Invalidator() override = default;
|
||||
|
||||
/**
|
||||
* Invalidate resource that was previously created by the correspondent provider. <br>
|
||||
|
@ -365,7 +365,7 @@ public:
|
||||
return ptr;
|
||||
}
|
||||
|
||||
virtual ~PoolTemplate() {
|
||||
virtual ~PoolTemplate() override {
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual ~Provider() = default;
|
||||
virtual ~Provider() override = default;
|
||||
|
||||
/**
|
||||
* Some optional properties that user might want to know. <br>
|
||||
|
@ -38,4 +38,4 @@ v_int64 Binary::nextP2(v_int64 v) {
|
||||
return v;
|
||||
}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
@ -62,7 +62,7 @@ void Server::conditionalMainLoop() {
|
||||
setStatus(STATUS_STOPPING);
|
||||
}
|
||||
} else {
|
||||
OATPP_LOGD("[oatpp::network::server::mainLoop()]", "Error. Server already stopped - closing connection...");
|
||||
OATPP_LOGD("[oatpp::network::server::mainLoop()]", "Error. Server already stopped - closing connection...")
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ void Server::mainLoop(Server *instance) {
|
||||
if (instance->getStatus() == STATUS_RUNNING) {
|
||||
instance->m_connectionHandler->handleConnection(connectionHandle, params /* null params */);
|
||||
} else {
|
||||
OATPP_LOGD("[oatpp::network::server::mainLoop()]", "Error. Server already stopped - closing connection...");
|
||||
OATPP_LOGD("[oatpp::network::server::mainLoop()]", "Error. Server already stopped - closing connection...")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
Server(const std::shared_ptr<ConnectionProvider>& connectionProvider,
|
||||
const std::shared_ptr<ConnectionHandler>& connectionHandler);
|
||||
|
||||
virtual ~Server();
|
||||
virtual ~Server() override;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -60,7 +60,7 @@ ConnectionMonitor::ConnectionProxy::~ConnectionProxy() {
|
||||
|
||||
for(auto& pair : m_stats.metricsData) {
|
||||
OATPP_LOGE("[oatpp::network::ConnectionMonitor::ConnectionProxy::~ConnectionProxy()]",
|
||||
"Error. Memory leak. Metric data was not deleted: Metric name - '%s'", pair.first->c_str());
|
||||
"Error. Memory leak. Metric data was not deleted: Metric name - '%s'", pair.first->c_str())
|
||||
}
|
||||
|
||||
}
|
||||
@ -187,7 +187,7 @@ void ConnectionMonitor::Monitor::freeConnectionStats(ConnectionStats& stats) {
|
||||
it->second->deleteMetricData(metric.second);
|
||||
} else {
|
||||
OATPP_LOGE("[oatpp::network::ConnectionMonitor::Monitor::freeConnectionStats]",
|
||||
"Error. Can't free Metric data. Unknown Metric: name - '%s'", it->first->c_str());
|
||||
"Error. Can't free Metric data. Unknown Metric: name - '%s'", it->first->c_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
/**
|
||||
* Default virtual destructor.
|
||||
*/
|
||||
virtual ~MetricsChecker() = default;
|
||||
virtual ~MetricsChecker() override = default;
|
||||
|
||||
/**
|
||||
* Get list of metrics names that are checked by this MetricsChecker.
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
/**
|
||||
* Default virtual destructor.
|
||||
*/
|
||||
virtual ~StatCollector() = default;
|
||||
virtual ~StatCollector() override = default;
|
||||
|
||||
/**
|
||||
* Unique metric name that is collected by this `StatCollector`.
|
||||
|
@ -101,7 +101,7 @@ v_io_size Connection::write(const void *buff, v_buff_size count, async::Action&
|
||||
} else if(e == WSAECONNRESET) {
|
||||
return IOError::BROKEN_PIPE;
|
||||
} else {
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e);
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e)
|
||||
return IOError::BROKEN_PIPE; // Consider all other errors as a broken pipe.
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ v_io_size Connection::write(const void *buff, v_buff_size count, async::Action&
|
||||
return IOError::BROKEN_PIPE;
|
||||
}
|
||||
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e);
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e)
|
||||
return IOError::BROKEN_PIPE; // Consider all other errors as a broken pipe.
|
||||
}
|
||||
return result;
|
||||
@ -176,7 +176,7 @@ v_io_size Connection::read(void *buff, v_buff_size count, async::Action& action)
|
||||
} else if(e == WSAECONNRESET) {
|
||||
return IOError::BROKEN_PIPE;
|
||||
} else {
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e);
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e)
|
||||
return IOError::BROKEN_PIPE; // Consider all other errors as a broken pipe.
|
||||
}
|
||||
}
|
||||
@ -208,7 +208,7 @@ v_io_size Connection::read(void *buff, v_buff_size count, async::Action& action)
|
||||
return IOError::BROKEN_PIPE;
|
||||
}
|
||||
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e);
|
||||
//OATPP_LOGD("Connection", "write errno=%d", e)
|
||||
return IOError::BROKEN_PIPE; // Consider all other errors as a broken pipe.
|
||||
}
|
||||
return result;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
* Virtual Destructor (See &id:oatpp::base::Countable;).
|
||||
* Close socket handle.
|
||||
*/
|
||||
~Connection();
|
||||
~Connection() override;
|
||||
|
||||
/**
|
||||
* Implementation of &id:oatpp::data::stream::IOStream::write;.
|
||||
|
@ -151,7 +151,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::get() {
|
||||
int yes = 1;
|
||||
v_int32 ret = setsockopt(clientHandle, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(int));
|
||||
if(ret < 0) {
|
||||
OATPP_LOGD("[oatpp::network::tcp::client::ConnectionProvider::getConnection()]", "Warning. Failed to set %s for socket", "SO_NOSIGPIPE");
|
||||
OATPP_LOGD("[oatpp::network::tcp::client::ConnectionProvider::getConnection()]", "Warning. Failed to set %s for socket", "SO_NOSIGPIPE")
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -184,7 +184,7 @@ oatpp::async::CoroutineStarterForResult<const provider::ResourceHandle<data::str
|
||||
, m_isHandleOpened(false)
|
||||
{}
|
||||
|
||||
~ConnectCoroutine() {
|
||||
~ConnectCoroutine() override {
|
||||
if(m_result != nullptr) {
|
||||
freeaddrinfo(m_result);
|
||||
}
|
||||
@ -266,7 +266,7 @@ oatpp::async::CoroutineStarterForResult<const provider::ResourceHandle<data::str
|
||||
int yes = 1;
|
||||
v_int32 ret = setsockopt(m_clientHandle, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(int));
|
||||
if(ret < 0) {
|
||||
OATPP_LOGD("[oatpp::network::tcp::client::ConnectionProvider::getConnectionAsync()]", "Warning. Failed to set %s for socket", "SO_NOSIGPIPE");
|
||||
OATPP_LOGD("[oatpp::network::tcp::client::ConnectionProvider::getConnectionAsync()]", "Warning. Failed to set %s for socket", "SO_NOSIGPIPE")
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -174,7 +174,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
const int iResult = getaddrinfo(m_address.host->c_str(), portStr->c_str(), &hints, &result);
|
||||
if (iResult != 0) {
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]", "Error. Call to getaddrinfo() failed with result=%d", iResult);
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]", "Error. Call to getaddrinfo() failed with result=%d", iResult)
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Call to getaddrinfo() failed.");
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
char buf[buflen];
|
||||
OATPP_LOGW("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]",
|
||||
"Warning. Failed to set %s for accepting socket: %s", "IPV6_V6ONLY",
|
||||
strerror_s(buf, buflen, errno));
|
||||
strerror_s(buf, buflen, errno))
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
if (currResult == nullptr) {
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]",
|
||||
"Error. Couldn't bind. WSAGetLastError=%ld", WSAGetLastError());
|
||||
"Error. Couldn't bind. WSAGetLastError=%ld", WSAGetLastError())
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: "
|
||||
"Error. Couldn't bind ");
|
||||
}
|
||||
@ -240,7 +240,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
oatpp::v_io_handle serverHandle;
|
||||
oatpp::v_io_handle serverHandle = INVALID_IO_HANDLE;
|
||||
v_int32 ret;
|
||||
int yes = 1;
|
||||
|
||||
@ -264,7 +264,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
ret = getaddrinfo(m_address.host->c_str(), portStr->c_str(), &hints, &result);
|
||||
if (ret != 0) {
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]", "Error. Call to getaddrinfo() failed with result=%d: %s", ret, strerror(errno));
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]", "Error. Call to getaddrinfo() failed with result=%d: %s", ret, strerror(errno))
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Call to getaddrinfo() failed.");
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
if (setsockopt(serverHandle, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0) {
|
||||
OATPP_LOGW("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]",
|
||||
"Warning. Failed to set %s for accepting socket: %s", "SO_REUSEADDR", strerror(errno));
|
||||
"Warning. Failed to set %s for accepting socket: %s", "SO_REUSEADDR", strerror(errno))
|
||||
}
|
||||
|
||||
if (bind(serverHandle, currResult->ai_addr, static_cast<v_sock_size>(currResult->ai_addrlen)) == 0 &&
|
||||
@ -299,7 +299,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
if (currResult == nullptr) {
|
||||
std::string err = strerror(errno);
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]",
|
||||
"Error. Couldn't bind. %s", err.c_str());
|
||||
"Error. Couldn't bind. %s", err.c_str())
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: "
|
||||
"Error. Couldn't bind " + err);
|
||||
}
|
||||
@ -325,7 +325,7 @@ void ConnectionProvider::prepareConnectionHandle(oatpp::v_io_handle handle) {
|
||||
int yes = 1;
|
||||
v_int32 ret = setsockopt(handle, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(int));
|
||||
if(ret < 0) {
|
||||
OATPP_LOGD("[oatpp::network::tcp::server::ConnectionProvider::prepareConnectionHandle()]", "Warning. Failed to set %s for socket", "SO_NOSIGPIPE");
|
||||
OATPP_LOGD("[oatpp::network::tcp::server::ConnectionProvider::prepareConnectionHandle()]", "Warning. Failed to set %s for socket", "SO_NOSIGPIPE")
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -389,7 +389,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getExtended
|
||||
::close(handle);
|
||||
#endif
|
||||
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::getExtendedConnection()]", "Error. Unknown address family.");
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::getExtendedConnection()]", "Error. Unknown address family.")
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
~ConnectionProvider();
|
||||
~ConnectionProvider() override;
|
||||
|
||||
/**
|
||||
* Close accept-socket.
|
||||
|
@ -86,7 +86,7 @@ Interface::~Interface() {
|
||||
std::lock_guard<std::mutex> lock(m_listenerMutex);
|
||||
if (m_listenerLock != nullptr) {
|
||||
OATPP_LOGE("[oatpp::network::virtual_::Interface::~Interface()]",
|
||||
"Error! Interface destructor called, but listener is still bonded!!!");
|
||||
"Error! Interface destructor called, but listener is still bonded!!!")
|
||||
m_listenerLock.load()->m_interface = nullptr;
|
||||
}
|
||||
}
|
||||
@ -175,7 +175,7 @@ void Interface::unbindListener(ListenerLock* listenerLock) {
|
||||
m_listenerLock = nullptr;
|
||||
dropAllConnection();
|
||||
} else {
|
||||
OATPP_LOGE("[oatpp::network::virtual_::Interface::unbindListener()]", "Error! Unbinding wrong listener!!!");
|
||||
OATPP_LOGE("[oatpp::network::virtual_::Interface::unbindListener()]", "Error! Unbinding wrong listener!!!")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Interface();
|
||||
~Interface() override;
|
||||
|
||||
/**
|
||||
* Obtain interface for given name.
|
||||
|
@ -261,7 +261,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual ~Pipe();
|
||||
virtual ~Pipe() override;
|
||||
|
||||
/**
|
||||
* Get pointer to &l:Pipe::Writer; for this pipe.
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor. Close corresponding pipes.
|
||||
*/
|
||||
~Socket();
|
||||
~Socket() override;
|
||||
|
||||
/**
|
||||
* Limit the available amount of bytes to read from socket and limit the available amount of bytes to write to socket. <br>
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual ~Connection() = default;
|
||||
virtual ~Connection() override = default;
|
||||
|
||||
};
|
||||
|
||||
|
@ -332,7 +332,7 @@ oatpp::Void Deserializer::deserializeCollection(Deserializer* deserializer, pars
|
||||
caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeCollection()]: Error. ']' - expected", ERROR_CODE_ARRAY_SCOPE_CLOSE);
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
return collection;
|
||||
|
||||
|
@ -68,4 +68,4 @@ std::shared_ptr<Deserializer> ObjectMapper::getDeserializer() {
|
||||
return m_deserializer;
|
||||
}
|
||||
|
||||
}}}}
|
||||
}}}}
|
||||
|
@ -231,7 +231,7 @@ public:
|
||||
(void) parameter;
|
||||
|
||||
OATPP_LOGE("[oatpp::web::client::ApiClient::TypeInterpretation::toString()]",
|
||||
"Error. No conversion from '%s' to '%s' is defined.", typeName->c_str(), "oatpp::String");
|
||||
"Error. No conversion from '%s' to '%s' is defined.", typeName->c_str(), "oatpp::String")
|
||||
|
||||
throw std::runtime_error(
|
||||
"[oatpp::web::client::ApiClient::TypeInterpretation::toString()]: Error. "
|
||||
|
@ -212,4 +212,4 @@ RequestExecutor::executeAsync(
|
||||
|
||||
}
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
@ -73,12 +73,12 @@ void StreamPartReader::onPartData(const std::shared_ptr<Part>& part, const char*
|
||||
|
||||
if(size > 0) {
|
||||
if(m_maxDataSize > 0 && tagObject->size + size > m_maxDataSize) {
|
||||
OATPP_LOGE("[oatpp::web::mime::multipart::StreamPartReader::onPartData()]", "Error. Part size exceeds specified maxDataSize=%ld", m_maxDataSize);
|
||||
OATPP_LOGE("[oatpp::web::mime::multipart::StreamPartReader::onPartData()]", "Error. Part size exceeds specified maxDataSize=%ld", m_maxDataSize)
|
||||
throw std::runtime_error("[oatpp::web::mime::multipart::StreamPartReader::onPartData()]: Error. Part size exceeds specified maxDataSize");
|
||||
}
|
||||
auto res = tagObject->outputStream->writeExactSizeDataSimple(data, size);
|
||||
if(res != size) {
|
||||
OATPP_LOGE("[oatpp::web::mime::multipart::StreamPartReader::onPartData()]", "Error. Failed to stream all data. Streamed %ld/%ld", res, size);
|
||||
OATPP_LOGE("[oatpp::web::mime::multipart::StreamPartReader::onPartData()]", "Error. Failed to stream all data. Streamed %ld/%ld", res, size)
|
||||
throw std::runtime_error("[oatpp::web::mime::multipart::StreamPartReader::onPartData()]: Error. Failed to stream all data.");
|
||||
}
|
||||
tagObject->size += res;
|
||||
@ -163,7 +163,7 @@ async::CoroutineStarter AsyncStreamPartReader::onPartDataAsync(const std::shared
|
||||
|
||||
if(size > 0) {
|
||||
if(m_maxDataSize > 0 && tagObject->size + size > m_maxDataSize) {
|
||||
OATPP_LOGE("[oatpp::web::mime::multipart::AsyncStreamPartReader::onPartDataAsync()]", "Error. Part size exceeds specified maxDataSize=%ld", m_maxDataSize);
|
||||
OATPP_LOGE("[oatpp::web::mime::multipart::AsyncStreamPartReader::onPartDataAsync()]", "Error. Part size exceeds specified maxDataSize=%ld", m_maxDataSize)
|
||||
throw std::runtime_error("[oatpp::web::mime::multipart::AsyncStreamPartReader::onPartDataAsync()]: Error. Part size exceeds specified maxDataSize");
|
||||
}
|
||||
return tagObject->outputStream->writeExactSizeDataAsync(data, size);
|
||||
|
@ -51,4 +51,4 @@ std::shared_ptr<EncoderProvider> ProviderCollection::get(const std::unordered_se
|
||||
|
||||
}
|
||||
|
||||
}}}}}
|
||||
}}}}}
|
||||
|
@ -162,4 +162,4 @@ async::CoroutineStarterForResult<const oatpp::String&> Request::readBodyToString
|
||||
return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream, m_connection);
|
||||
}
|
||||
|
||||
}}}}}
|
||||
}}}}}
|
||||
|
@ -78,7 +78,7 @@ RequestHeadersReader::Result RequestHeadersReader::readHeaders(data::stream::Inp
|
||||
error.ioStatus = readHeadersSectionIterative(iteration, stream, action);
|
||||
|
||||
if(!action.isNone()) {
|
||||
OATPP_LOGE("[oatpp::web::protocol::http::incoming::RequestHeadersReader::readHeaders]", "Error. Async action is unexpected.");
|
||||
OATPP_LOGE("[oatpp::web::protocol::http::incoming::RequestHeadersReader::readHeaders]", "Error. Async action is unexpected.")
|
||||
throw std::runtime_error("[oatpp::web::protocol::http::incoming::RequestHeadersReader::readHeaders]: Error. Async action is unexpected.");
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual ~Body() = default;
|
||||
virtual ~Body() override = default;
|
||||
|
||||
///////////////////////////
|
||||
// From the ReadCallback //
|
||||
|
@ -30,7 +30,7 @@ namespace oatpp { namespace web { namespace protocol { namespace http { namespac
|
||||
v_io_size MultipartBody::readBody(void *buffer, v_buff_size count, async::Action& action) {
|
||||
const auto& stream = m_iterator.getPartInputStream();
|
||||
if(!stream) {
|
||||
OATPP_LOGW("[oatpp::web::protocol::http::outgoing::MultipartBody::MultipartReadCallback::readBody()]", "Warning. Part has no input stream.");
|
||||
OATPP_LOGW("[oatpp::web::protocol::http::outgoing::MultipartBody::MultipartReadCallback::readBody()]", "Warning. Part has no input stream.")
|
||||
return 0;
|
||||
}
|
||||
return stream->read(buffer, count, action);
|
||||
@ -81,7 +81,7 @@ v_io_size MultipartBody::read(void *buffer, v_buff_size count, async::Action& ac
|
||||
break;
|
||||
|
||||
default:
|
||||
OATPP_LOGE("[oatpp::web::protocol::http::outgoing::MultipartBody::MultipartReadCallback::read()]", "Error. Invalid state %d", m_state);
|
||||
OATPP_LOGE("[oatpp::web::protocol::http::outgoing::MultipartBody::MultipartReadCallback::read()]", "Error. Invalid state %d", m_state)
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -107,7 +107,7 @@ v_io_size MultipartBody::read(void *buffer, v_buff_size count, async::Action& ac
|
||||
}
|
||||
|
||||
} else if(action.isNone()) {
|
||||
OATPP_LOGE("[oatpp::web::protocol::http::outgoing::MultipartBody::MultipartReadCallback::read()]", "Error. Invalid read result %ld. State=%d", res, m_state);
|
||||
OATPP_LOGE("[oatpp::web::protocol::http::outgoing::MultipartBody::MultipartReadCallback::read()]", "Error. Invalid read result %ld. State=%d", res, m_state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ HttpProcessor::ConnectionState HttpProcessor::processNextRequest(ProcessingResou
|
||||
handler->handleConnection(resources.connection, response->getConnectionUpgradeParameters());
|
||||
connectionState = ConnectionState::DELEGATED;
|
||||
} else {
|
||||
OATPP_LOGW("[oatpp::web::server::HttpProcessor::processNextRequest()]", "Warning. ConnectionUpgradeHandler not set!");
|
||||
OATPP_LOGW("[oatpp::web::server::HttpProcessor::processNextRequest()]", "Warning. ConnectionUpgradeHandler not set!")
|
||||
connectionState = ConnectionState::CLOSING;
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ HttpProcessor::Coroutine::Action HttpProcessor::Coroutine::onRequestDone() {
|
||||
handler->handleConnection(m_connection, m_currentResponse->getConnectionUpgradeParameters());
|
||||
m_connectionState = ConnectionState::DELEGATED;
|
||||
} else {
|
||||
OATPP_LOGW("[oatpp::web::server::HttpProcessor::Coroutine::onResponseFormed()]", "Warning. ConnectionUpgradeHandler not set!");
|
||||
OATPP_LOGW("[oatpp::web::server::HttpProcessor::Coroutine::onResponseFormed()]", "Warning. ConnectionUpgradeHandler not set!")
|
||||
m_connectionState = ConnectionState::CLOSING;
|
||||
}
|
||||
break;
|
||||
@ -425,7 +425,7 @@ HttpProcessor::Coroutine::Action HttpProcessor::Coroutine::handleError(Error* er
|
||||
}
|
||||
|
||||
if(m_currentResponse) {
|
||||
//OATPP_LOGE("[oatpp::web::server::HttpProcessor::Coroutine::handleError()]", "Unhandled error. '%s'. Dropping connection", error->what());
|
||||
//OATPP_LOGE("[oatpp::web::server::HttpProcessor::Coroutine::handleError()]", "Unhandled error. '%s'. Dropping connection", error->what())
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -263,9 +263,9 @@ protected:
|
||||
|
||||
if(m_method == nullptr) {
|
||||
if(m_methodAsync == nullptr) {
|
||||
throw protocol::http::HttpError(Status::CODE_500, "[ApiController]: Error. Handler method is nullptr.");;
|
||||
throw protocol::http::HttpError(Status::CODE_500, "[ApiController]: Error. Handler method is nullptr.");
|
||||
}
|
||||
throw protocol::http::HttpError(Status::CODE_500, "[ApiController]: Error. Non-async call to async endpoint.");;
|
||||
throw protocol::http::HttpError(Status::CODE_500, "[ApiController]: Error. Non-async call to async endpoint.");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -437,7 +437,7 @@ public:
|
||||
(void) text;
|
||||
success = false;
|
||||
OATPP_LOGE("[oatpp::web::server::api::ApiController::TypeInterpretation::fromString()]",
|
||||
"Error. No conversion from '%s' to '%s' is defined.", "oatpp::String", typeName->c_str());
|
||||
"Error. No conversion from '%s' to '%s' is defined.", "oatpp::String", typeName->c_str())
|
||||
throw std::runtime_error("[oatpp::web::server::api::ApiController::TypeInterpretation::fromString()]: Error. "
|
||||
"No conversion from 'oatpp::String' to '" + *typeName + "' is defined. "
|
||||
"Please define type conversion.");
|
||||
|
@ -41,16 +41,16 @@ const std::list<oatpp::String>& Endpoint::Info::Params::getOrder() const {
|
||||
return m_order;
|
||||
}
|
||||
|
||||
Endpoint::Info::Param& Endpoint::Info::Params::add(const oatpp::String& name, oatpp::data::mapping::type::Type* type) {
|
||||
m_order.push_back(name);
|
||||
Endpoint::Info::Param& param = operator [](name);
|
||||
param.name = name;
|
||||
Endpoint::Info::Param& Endpoint::Info::Params::add(const oatpp::String& aname, oatpp::data::mapping::type::Type* type) {
|
||||
m_order.push_back(aname);
|
||||
Endpoint::Info::Param& param = operator [](aname);
|
||||
param.name = aname;
|
||||
param.type = type;
|
||||
return param;
|
||||
}
|
||||
|
||||
Endpoint::Info::Param& Endpoint::Info::Params::operator [](const oatpp::String& name) {
|
||||
return m_params[name];
|
||||
Endpoint::Info::Param& Endpoint::Info::Params::operator [](const oatpp::String& aname) {
|
||||
return m_params[aname];
|
||||
}
|
||||
|
||||
Endpoint::Info::Info() : hide(false)
|
||||
|
@ -97,12 +97,12 @@ public:
|
||||
/**
|
||||
* Add parameter name to list order
|
||||
* @tparam T
|
||||
* @param name
|
||||
* @param aname
|
||||
* @return new or existing parameter
|
||||
*/
|
||||
template<class T>
|
||||
Param& add(const oatpp::String& name) {
|
||||
return add(name, T::Class::getType());
|
||||
Param& add(const oatpp::String& aname) {
|
||||
return add(aname, T::Class::getType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
|
||||
for(auto& pair : m_endpointsByPattern) {
|
||||
auto mapping = pair.first->toString();
|
||||
OATPP_LOGD("Router", "url '%s %s' -> mapped", reinterpret_cast<const char*>(branch.getData()), mapping->c_str());
|
||||
OATPP_LOGD("Router", "url '%s %s' -> mapped", reinterpret_cast<const char*>(branch.getData()), mapping->c_str())
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,15 +75,15 @@ void runTests() {
|
||||
|
||||
oatpp::base::Environment::printCompilationConfig();
|
||||
|
||||
OATPP_LOGD("Tests", "coroutine handle size=%lu", sizeof(oatpp::async::CoroutineHandle));
|
||||
OATPP_LOGD("Tests", "coroutine size=%lu", sizeof(oatpp::async::AbstractCoroutine));
|
||||
OATPP_LOGD("Tests", "action size=%lu", sizeof(oatpp::async::Action));
|
||||
OATPP_LOGD("Tests", "class count=%d", oatpp::data::mapping::type::ClassId::getClassCount());
|
||||
OATPP_LOGD("Tests", "coroutine handle size=%lu", sizeof(oatpp::async::CoroutineHandle))
|
||||
OATPP_LOGD("Tests", "coroutine size=%lu", sizeof(oatpp::async::AbstractCoroutine))
|
||||
OATPP_LOGD("Tests", "action size=%lu", sizeof(oatpp::async::Action))
|
||||
OATPP_LOGD("Tests", "class count=%d", oatpp::data::mapping::type::ClassId::getClassCount())
|
||||
|
||||
auto names = oatpp::data::mapping::type::ClassId::getRegisteredClassNames();
|
||||
v_int32 i = 0;
|
||||
for(auto& name : names) {
|
||||
OATPP_LOGD("CLASS", "%d --> '%s'", i, name);
|
||||
OATPP_LOGD("CLASS", "%d --> '%s'", i, name)
|
||||
i ++;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ int main() {
|
||||
std::cout << "objectsCount = " << oatpp::base::Environment::getObjectsCount() << "\n";
|
||||
std::cout << "objectsCreated = " << oatpp::base::Environment::getObjectsCreated() << "\n\n";
|
||||
|
||||
OATPP_ASSERT(oatpp::base::Environment::getObjectsCount() == 0);
|
||||
OATPP_ASSERT(oatpp::base::Environment::getObjectsCount() == 0)
|
||||
|
||||
oatpp::base::Environment::destroy();
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
{}
|
||||
|
||||
Action act() override {
|
||||
return m_cv->waitFor(m_lockGuard, [this]{return false;}, std::chrono::seconds(1))
|
||||
return m_cv->waitFor(m_lockGuard, []{return false;}, std::chrono::seconds(1))
|
||||
.next(yieldTo(&TestCoroutineTimeout::onReady));
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ void ConditionVariableTest::onRun() {
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
||||
}
|
||||
OATPP_ASSERT(finished);
|
||||
OATPP_ASSERT(finished)
|
||||
});
|
||||
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ bool checkSymbol(char symbol, const char* data, v_buff_size size) {
|
||||
for (v_buff_size j = 0; j < NUM_SYMBOLS; j++) {
|
||||
|
||||
if (data[i + j] != symbol) {
|
||||
OATPP_LOGD("aaa", "j pos=%ld", j);
|
||||
OATPP_LOGD("aaa", "j pos=%ld", j)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ bool checkSymbol(char symbol, const char* data, v_buff_size size) {
|
||||
|
||||
}
|
||||
|
||||
OATPP_LOGD("aaa", "No symbol found");
|
||||
OATPP_LOGD("aaa", "No symbol found")
|
||||
return false;
|
||||
|
||||
}
|
||||
@ -202,9 +202,9 @@ void LockTest::onRun() {
|
||||
if(!check) {
|
||||
v_int32 code = c;
|
||||
auto str = oatpp::String(reinterpret_cast<const char*>(&c), 1);
|
||||
OATPP_LOGE(TAG, "Failed for symbol %d, '%s'", code, str->data());
|
||||
OATPP_LOGE(TAG, "Failed for symbol %d, '%s'", code, str->data())
|
||||
}
|
||||
OATPP_ASSERT(check);
|
||||
OATPP_ASSERT(check)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,25 +38,25 @@ void CommandLineArgumentsTest::onRun() {
|
||||
|
||||
oatpp::base::CommandLineArguments args(argc, argv);
|
||||
|
||||
OATPP_ASSERT(args.getArgumentIndex("-k") == 0);
|
||||
OATPP_ASSERT(args.getArgumentIndex("-c") == 1);
|
||||
OATPP_ASSERT(args.getArgumentIndex("100") == 2);
|
||||
OATPP_ASSERT(args.getArgumentIndex("-n") == 3);
|
||||
OATPP_ASSERT(args.getArgumentIndex("500000") == 4);
|
||||
OATPP_ASSERT(args.getArgumentIndex("http://127.0.0.1:8000/") == 5);
|
||||
OATPP_ASSERT(args.getArgumentIndex("not-existing-arg") == -1);
|
||||
OATPP_ASSERT(args.getArgumentIndex("-k") == 0)
|
||||
OATPP_ASSERT(args.getArgumentIndex("-c") == 1)
|
||||
OATPP_ASSERT(args.getArgumentIndex("100") == 2)
|
||||
OATPP_ASSERT(args.getArgumentIndex("-n") == 3)
|
||||
OATPP_ASSERT(args.getArgumentIndex("500000") == 4)
|
||||
OATPP_ASSERT(args.getArgumentIndex("http://127.0.0.1:8000/") == 5)
|
||||
OATPP_ASSERT(args.getArgumentIndex("not-existing-arg") == -1)
|
||||
|
||||
OATPP_ASSERT(args.hasArgument("-k"));
|
||||
OATPP_ASSERT(args.hasArgument("not-existing-arg") == false);
|
||||
OATPP_ASSERT(args.hasArgument("-k"))
|
||||
OATPP_ASSERT(args.hasArgument("not-existing-arg") == false)
|
||||
|
||||
OATPP_ASSERT(std::strcmp(args.getArgumentStartingWith("http"), "http://127.0.0.1:8000/") == 0);
|
||||
OATPP_ASSERT(std::strcmp(args.getArgumentStartingWith("tcp", "tcp://default/"), "tcp://default/") == 0);
|
||||
OATPP_ASSERT(std::strcmp(args.getArgumentStartingWith("http"), "http://127.0.0.1:8000/") == 0)
|
||||
OATPP_ASSERT(std::strcmp(args.getArgumentStartingWith("tcp", "tcp://default/"), "tcp://default/") == 0)
|
||||
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("-c"), "100") == 0);
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("-c", nullptr), "100") == 0);
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("-c"), "100") == 0)
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("-c", nullptr), "100") == 0)
|
||||
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("-n"), "500000") == 0);
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("--non-existing", "default"), "default") == 0);
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("-n"), "500000") == 0)
|
||||
OATPP_ASSERT(std::strcmp(args.getNamedArgumentValue("--non-existing", "default"), "default") == 0)
|
||||
|
||||
}
|
||||
|
||||
|
@ -27,53 +27,53 @@
|
||||
|
||||
namespace oatpp { namespace test { namespace base {
|
||||
|
||||
OATPP_LOG_CATEGORY(LoggerTest::TESTCATEGORY, "LogCategory", true);
|
||||
OATPP_LOG_CATEGORY(LoggerTest::TESTCATEGORY, "LogCategory", true)
|
||||
|
||||
void LoggerTest::onRun() {
|
||||
|
||||
auto logger = std::static_pointer_cast<oatpp::base::DefaultLogger>(oatpp::base::Environment::getLogger());
|
||||
|
||||
OATPP_LOGV("LoggerTest", "Verbose Log");
|
||||
OATPP_LOGD("LoggerTest", "Debug Log");
|
||||
OATPP_LOGI("LoggerTest", "Info Log");
|
||||
OATPP_LOGW("LoggerTest", "Warning Log");
|
||||
OATPP_LOGE("LoggerTest", "Error Log");
|
||||
OATPP_LOGV("LoggerTest", "Verbose Log")
|
||||
OATPP_LOGD("LoggerTest", "Debug Log")
|
||||
OATPP_LOGI("LoggerTest", "Info Log")
|
||||
OATPP_LOGW("LoggerTest", "Warning Log")
|
||||
OATPP_LOGE("LoggerTest", "Error Log")
|
||||
|
||||
OATPP_LOGI("LoggerTest", " --- Disabling Debug Log");
|
||||
OATPP_LOGI("LoggerTest", " --- Disabling Debug Log")
|
||||
logger->disablePriority(oatpp::base::DefaultLogger::PRIORITY_D);
|
||||
OATPP_ASSERT(!logger->isLogPriorityEnabled(oatpp::base::DefaultLogger::PRIORITY_D))
|
||||
|
||||
OATPP_LOGV("LoggerTest", "Verbose Log");
|
||||
OATPP_LOGD("LoggerTest", "Debug Log");
|
||||
OATPP_LOGI("LoggerTest", "Info Log");
|
||||
OATPP_LOGW("LoggerTest", "Warning Log");
|
||||
OATPP_LOGE("LoggerTest", "Error Log");
|
||||
OATPP_LOGV("LoggerTest", "Verbose Log")
|
||||
OATPP_LOGD("LoggerTest", "Debug Log")
|
||||
OATPP_LOGI("LoggerTest", "Info Log")
|
||||
OATPP_LOGW("LoggerTest", "Warning Log")
|
||||
OATPP_LOGE("LoggerTest", "Error Log")
|
||||
|
||||
OATPP_LOGI("LoggerTest", " --- Enabling Debug Log again");
|
||||
OATPP_LOGI("LoggerTest", " --- Enabling Debug Log again")
|
||||
logger->enablePriority(oatpp::base::DefaultLogger::PRIORITY_D);
|
||||
OATPP_ASSERT(logger->isLogPriorityEnabled(oatpp::base::DefaultLogger::PRIORITY_D))
|
||||
|
||||
OATPP_LOGV("LoggerTest", "Verbose Log");
|
||||
OATPP_LOGD("LoggerTest", "Debug Log");
|
||||
OATPP_LOGI("LoggerTest", "Info Log");
|
||||
OATPP_LOGW("LoggerTest", "Warning Log");
|
||||
OATPP_LOGE("LoggerTest", "Error Log");
|
||||
OATPP_LOGV("LoggerTest", "Verbose Log")
|
||||
OATPP_LOGD("LoggerTest", "Debug Log")
|
||||
OATPP_LOGI("LoggerTest", "Info Log")
|
||||
OATPP_LOGW("LoggerTest", "Warning Log")
|
||||
OATPP_LOGE("LoggerTest", "Error Log")
|
||||
|
||||
OATPP_LOGI(TESTCATEGORY, " --- Log-Test with category");
|
||||
OATPP_LOGV(TESTCATEGORY, "Verbose Log");
|
||||
OATPP_LOGD(TESTCATEGORY, "Debug Log");
|
||||
OATPP_LOGI(TESTCATEGORY, "Info Log");
|
||||
OATPP_LOGW(TESTCATEGORY, "Warning Log");
|
||||
OATPP_LOGE(TESTCATEGORY, "Error Log");
|
||||
OATPP_LOGI(TESTCATEGORY, " --- Log-Test with category")
|
||||
OATPP_LOGV(TESTCATEGORY, "Verbose Log")
|
||||
OATPP_LOGD(TESTCATEGORY, "Debug Log")
|
||||
OATPP_LOGI(TESTCATEGORY, "Info Log")
|
||||
OATPP_LOGW(TESTCATEGORY, "Warning Log")
|
||||
OATPP_LOGE(TESTCATEGORY, "Error Log")
|
||||
|
||||
OATPP_LOGI(TESTCATEGORY, " --- Disabling Debug Log for category");
|
||||
OATPP_LOGI(TESTCATEGORY, " --- Disabling Debug Log for category")
|
||||
TESTCATEGORY.disablePriority(oatpp::base::DefaultLogger::PRIORITY_D);
|
||||
OATPP_ASSERT(!TESTCATEGORY.isLogPriorityEnabled(oatpp::base::DefaultLogger::PRIORITY_D))
|
||||
OATPP_LOGV(TESTCATEGORY, "Verbose Log");
|
||||
OATPP_LOGD(TESTCATEGORY, "Debug Log");
|
||||
OATPP_LOGI(TESTCATEGORY, "Info Log");
|
||||
OATPP_LOGW(TESTCATEGORY, "Warning Log");
|
||||
OATPP_LOGE(TESTCATEGORY, "Error Log");
|
||||
OATPP_LOGV(TESTCATEGORY, "Verbose Log")
|
||||
OATPP_LOGD(TESTCATEGORY, "Debug Log")
|
||||
OATPP_LOGI(TESTCATEGORY, "Info Log")
|
||||
OATPP_LOGW(TESTCATEGORY, "Warning Log")
|
||||
OATPP_LOGE(TESTCATEGORY, "Error Log")
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class LoggerTest : public UnitTest{
|
||||
LoggerTest():UnitTest("TEST[base::LoggerTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
OATPP_DECLARE_LOG_CATEGORY(TESTCATEGORY);
|
||||
OATPP_DECLARE_LOG_CATEGORY(TESTCATEGORY)
|
||||
};
|
||||
|
||||
}}}
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
COUNTER ++;
|
||||
}
|
||||
|
||||
~TestCoroutine() {
|
||||
~TestCoroutine() override {
|
||||
COUNTER --;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ public:
|
||||
|
||||
Action compare() {
|
||||
auto result = m_writeCallback->toString();
|
||||
OATPP_ASSERT(m_etalon == result);
|
||||
OATPP_ASSERT(m_etalon == result)
|
||||
return finish();
|
||||
}
|
||||
|
||||
@ -213,9 +213,9 @@ void ProcessorTest::onRun() {
|
||||
auto result = runTestCase(data, p1N, p2N, p3N, buffSize);
|
||||
|
||||
if (result != etalon) {
|
||||
OATPP_LOGD(TAG, "error[%d, %d, %d, b=%d] result='%s'", p1N, p2N, p3N, buffSize, result->data());
|
||||
OATPP_LOGD(TAG, "error[%d, %d, %d, b=%d] result='%s'", p1N, p2N, p3N, buffSize, result->data())
|
||||
}
|
||||
OATPP_ASSERT(result == etalon);
|
||||
OATPP_ASSERT(result == etalon)
|
||||
|
||||
}
|
||||
}
|
||||
@ -235,8 +235,8 @@ void ProcessorTest::onRun() {
|
||||
|
||||
auto result = outStream.toString();
|
||||
|
||||
OATPP_ASSERT(result == data);
|
||||
OATPP_ASSERT(inStream.getCurrentPosition() == progress);
|
||||
OATPP_ASSERT(result == data)
|
||||
OATPP_ASSERT(inStream.getCurrentPosition() == progress)
|
||||
|
||||
}
|
||||
|
||||
|
@ -115,24 +115,24 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_str"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::String::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::String::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_str"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::String::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_str.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::String::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_str.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_str"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::String::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::String::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_str"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::String::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_str.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::String::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_str.get())
|
||||
|
||||
}
|
||||
|
||||
@ -143,48 +143,48 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_int8"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int8::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int8"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_int8.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int8::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_int8.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_int8"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int8::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int8"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int8.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int8::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int8.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_uint8"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt8::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint8"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint8.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt8::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint8.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_uint8"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt8::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint8"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt8::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint8.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt8::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint8.get())
|
||||
|
||||
}
|
||||
|
||||
@ -194,48 +194,48 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_int16"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int16::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int16"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_int16.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int16::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_int16.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_int16"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int16::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int16"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int16.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int16::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int16.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_uint16"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt16::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint16"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint16.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt16::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint16.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_uint16"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt16::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint16"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt16::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint16.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt16::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint16.get())
|
||||
|
||||
}
|
||||
|
||||
@ -245,48 +245,48 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_int32"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int32::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int32"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_int32.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int32::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_int32.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_int32"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int32::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int32"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int32.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int32::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int32.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_uint32"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt32::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint32"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint32.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt32::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint32.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_uint32"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt32::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint32"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint32.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt32::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint32.get())
|
||||
|
||||
}
|
||||
|
||||
@ -296,48 +296,48 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_int64"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int64::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_int64"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_int64.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int64::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_int64.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_int64"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Int64::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_int64"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int64.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Int64::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_int64.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_uint64"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt64::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_uint64"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint64.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt64::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_uint64.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_uint64"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::UInt64::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_uint64"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint64.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::UInt64::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_uint64.get())
|
||||
|
||||
}
|
||||
|
||||
@ -349,24 +349,24 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_float32"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float32::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_float32"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_float32.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float32::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_float32.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_float32"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float32::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_float32"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float32::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_float32.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float32::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_float32.get())
|
||||
|
||||
}
|
||||
|
||||
@ -376,24 +376,24 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_float64"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float64::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_float64"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_float64.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float64::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_float64.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_float64"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Float64::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_float64"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float64::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_float64.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Float64::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_float64.get())
|
||||
|
||||
}
|
||||
|
||||
@ -403,24 +403,24 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_bool"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Boolean::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_bool"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_bool.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Boolean::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_bool.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_bool"}, cache);
|
||||
OATPP_ASSERT(type != nullptr);
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(type != nullptr)
|
||||
OATPP_ASSERT(type->classId.id == oatpp::Boolean::Class::CLASS_ID.id)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_bool"}, cache);
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Boolean::Class::CLASS_ID.id);
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_bool.get());
|
||||
OATPP_ASSERT(val.getValueType()->classId.id == oatpp::Boolean::Class::CLASS_ID.id)
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_bool.get())
|
||||
|
||||
}
|
||||
|
||||
@ -430,22 +430,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_vector"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_vector.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_vector.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_vector"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_vector.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_vector.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_vector.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_vector.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_vector"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_vector.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_vector.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_vector"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_vector.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_vector.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_vector.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_vector.get())
|
||||
|
||||
}
|
||||
|
||||
@ -455,22 +455,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_list"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_list.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_list.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_list"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_list.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_list.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_list.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_list.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_list"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_list.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_list.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_list"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_list.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_list.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_list.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_list.get())
|
||||
|
||||
}
|
||||
|
||||
@ -480,22 +480,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_set"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_set.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_set.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_set"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_set.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_set.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_set.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_set.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_set"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_set.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_set.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_set"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_set.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_set.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_set.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_set.get())
|
||||
|
||||
}
|
||||
|
||||
@ -505,22 +505,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_fields"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_fields.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_fields.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_fields"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_fields.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_fields.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_fields.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_fields.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_fields"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_fields.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_fields.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_fields"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_fields.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_fields.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_fields.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_fields.get())
|
||||
|
||||
}
|
||||
|
||||
@ -530,22 +530,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_unordered_fields"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_unordered_fields.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_unordered_fields.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_unordered_fields"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_unordered_fields.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_unordered_fields.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_unordered_fields.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_unordered_fields.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_unordered_fields"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_unordered_fields.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_unordered_fields.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_unordered_fields"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_unordered_fields.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_unordered_fields.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_unordered_fields.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_unordered_fields.get())
|
||||
|
||||
}
|
||||
|
||||
@ -555,22 +555,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_any"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_any.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_any.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_any"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_any.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_any.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_any.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_any.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_any"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_any.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_any.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_any"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_any.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_any.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_any.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_any.get())
|
||||
|
||||
}
|
||||
|
||||
@ -580,22 +580,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto.get())
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_dto"}, cache);
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_dto.getValueType());
|
||||
OATPP_ASSERT(type == dto1->f_dto->f_dto.getValueType())
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_dto"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_dto.getValueType());
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_dto.get());
|
||||
OATPP_ASSERT(val.getValueType() == dto1->f_dto->f_dto.getValueType())
|
||||
OATPP_ASSERT(val.get() == dto1->f_dto->f_dto.get())
|
||||
|
||||
}
|
||||
|
||||
@ -605,22 +605,22 @@ void TypeResolverTest::onRun() {
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_non_existing"}, cache);
|
||||
OATPP_ASSERT(type == nullptr);
|
||||
OATPP_ASSERT(type == nullptr)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_non_existing"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == oatpp::Void::Class::getType());
|
||||
OATPP_ASSERT(val == nullptr);
|
||||
OATPP_ASSERT(val.getValueType() == oatpp::Void::Class::getType())
|
||||
OATPP_ASSERT(val == nullptr)
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
auto type = tr.resolveObjectPropertyType(oatpp::Object<TestDto>::Class::getType(), {"f_dto", "f_non_existing"}, cache);
|
||||
OATPP_ASSERT(type == nullptr);
|
||||
OATPP_ASSERT(type == nullptr)
|
||||
|
||||
auto val = tr.resolveObjectPropertyValue(dto1, {"f_dto", "f_non_existing"}, cache);
|
||||
OATPP_ASSERT(val.getValueType() == oatpp::Void::Class::getType());
|
||||
OATPP_ASSERT(val == nullptr);
|
||||
OATPP_ASSERT(val.getValueType() == oatpp::Void::Class::getType())
|
||||
OATPP_ASSERT(val == nullptr)
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,16 +36,16 @@ namespace {
|
||||
#include OATPP_CODEGEN_BEGIN(DTO)
|
||||
|
||||
class Dto1 : public oatpp::DTO {
|
||||
DTO_INIT(Dto1, DTO);
|
||||
DTO_INIT(Dto1, DTO)
|
||||
};
|
||||
|
||||
class Dto2 : public oatpp::DTO {
|
||||
DTO_INIT(Dto2, DTO);
|
||||
DTO_INIT(Dto2, DTO)
|
||||
};
|
||||
|
||||
class Test : public oatpp::DTO {
|
||||
|
||||
DTO_INIT(Test, DTO);
|
||||
DTO_INIT(Test, DTO)
|
||||
|
||||
DTO_FIELD(oatpp::Any, any);
|
||||
|
||||
@ -58,59 +58,59 @@ class Test : public oatpp::DTO {
|
||||
void AnyTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test default constructor...");
|
||||
OATPP_LOGI(TAG, "Test default constructor...")
|
||||
oatpp::Any any;
|
||||
OATPP_ASSERT(!any);
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any.getStoredType() == nullptr);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == nullptr)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test nullptr constructor...");
|
||||
OATPP_LOGI(TAG, "Test nullptr constructor...")
|
||||
oatpp::Any any(nullptr);
|
||||
OATPP_ASSERT(!any);
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any.getStoredType() == nullptr);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == nullptr)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test retrieve()...");
|
||||
OATPP_LOGI(TAG, "Test retrieve()...")
|
||||
oatpp::Any any(oatpp::String("Hello Any!"));
|
||||
OATPP_ASSERT(any);
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
auto str = any.retrieve<oatpp::String>();
|
||||
OATPP_ASSERT(str == "Hello Any!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(str == "Hello Any!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test store()...");
|
||||
OATPP_LOGI(TAG, "Test store()...")
|
||||
oatpp::Any any(oatpp::Int32(32));
|
||||
|
||||
OATPP_ASSERT(any);
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::Int32::getType());
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::Int32::getType())
|
||||
|
||||
any.store(oatpp::String("Hello Any!"));
|
||||
|
||||
OATPP_ASSERT(any);
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
|
||||
auto str = any.retrieve<oatpp::String>();
|
||||
OATPP_ASSERT(str == "Hello Any!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(str == "Hello Any!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test retrieve() class check...");
|
||||
OATPP_LOGI(TAG, "Test retrieve() class check...")
|
||||
oatpp::Any any(Dto1::createShared());
|
||||
OATPP_ASSERT(any);
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any.getStoredType() == Object<Dto1>::Class::getType());
|
||||
OATPP_ASSERT(any)
|
||||
OATPP_ASSERT(any.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any.getStoredType() == Object<Dto1>::Class::getType())
|
||||
|
||||
bool wasError = false;
|
||||
|
||||
@ -120,64 +120,64 @@ void AnyTest::onRun() {
|
||||
wasError = true;
|
||||
}
|
||||
|
||||
OATPP_ASSERT(wasError);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(wasError)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test copy-assign operator...");
|
||||
OATPP_LOGI(TAG, "Test copy-assign operator...")
|
||||
oatpp::Any any1(oatpp::String("Hello!"));
|
||||
oatpp::Any any2;
|
||||
|
||||
any2 = any1;
|
||||
|
||||
OATPP_ASSERT(any1);
|
||||
OATPP_ASSERT(any2);
|
||||
OATPP_ASSERT(any1)
|
||||
OATPP_ASSERT(any2)
|
||||
|
||||
OATPP_ASSERT(any1.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any2.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any1.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any2.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
|
||||
OATPP_ASSERT(any1.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(any1.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
|
||||
OATPP_ASSERT(any1 == any2);
|
||||
OATPP_ASSERT(any1.getPtr().get() != any2.getPtr().get());
|
||||
OATPP_ASSERT(any1 == any2)
|
||||
OATPP_ASSERT(any1.getPtr().get() != any2.getPtr().get())
|
||||
|
||||
auto str1 = any1.retrieve<oatpp::String>();
|
||||
auto str2 = any2.retrieve<oatpp::String>();
|
||||
|
||||
OATPP_ASSERT(str1 == str2);
|
||||
OATPP_ASSERT(str1.get() == str2.get() && str1 == "Hello!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(str1 == str2)
|
||||
OATPP_ASSERT(str1.get() == str2.get() && str1 == "Hello!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test move-assign operator...");
|
||||
OATPP_LOGI(TAG, "Test move-assign operator...")
|
||||
oatpp::Any any1(oatpp::String("Hello!"));
|
||||
oatpp::Any any2;
|
||||
|
||||
any2 = std::move(any1);
|
||||
|
||||
OATPP_ASSERT(!any1);
|
||||
OATPP_ASSERT(any2);
|
||||
OATPP_ASSERT(!any1)
|
||||
OATPP_ASSERT(any2)
|
||||
|
||||
OATPP_ASSERT(any1.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any2.getValueType() == oatpp::data::mapping::type::__class::Any::getType());
|
||||
OATPP_ASSERT(any1.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
OATPP_ASSERT(any2.getValueType() == oatpp::data::mapping::type::__class::Any::getType())
|
||||
|
||||
OATPP_ASSERT(any1.getStoredType() == nullptr);
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(any1.getStoredType() == nullptr)
|
||||
OATPP_ASSERT(any2.getStoredType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
|
||||
OATPP_ASSERT(any1 != any2);
|
||||
OATPP_ASSERT(any1.getPtr().get() != any2.getPtr().get());
|
||||
OATPP_ASSERT(any1 != any2)
|
||||
OATPP_ASSERT(any1.getPtr().get() != any2.getPtr().get())
|
||||
|
||||
auto str1 = any1.retrieve<oatpp::String>();
|
||||
auto str2 = any2.retrieve<oatpp::String>();
|
||||
|
||||
OATPP_ASSERT(str1 != str2);
|
||||
OATPP_ASSERT(str2 == "Hello!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(str1 != str2)
|
||||
OATPP_ASSERT(str2 == "Hello!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}}}}}}
|
||||
}}}}}}
|
||||
|
@ -58,26 +58,26 @@ ENUM(Enum3, v_int32,
|
||||
void EnumTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check Hash...");
|
||||
OATPP_LOGI(TAG, "Check Hash...")
|
||||
|
||||
{
|
||||
auto v = std::hash<oatpp::Enum<Enum1>>{}(oatpp::Enum<Enum1>());
|
||||
OATPP_ASSERT(v == 0);
|
||||
OATPP_ASSERT(v == 0)
|
||||
}
|
||||
|
||||
{
|
||||
auto v = std::hash<oatpp::Enum<Enum1>>{}(oatpp::Enum<Enum1>(Enum1::V1));
|
||||
OATPP_ASSERT(v == 1);
|
||||
OATPP_ASSERT(v == 1)
|
||||
}
|
||||
|
||||
{
|
||||
auto v = std::hash<oatpp::Enum<Enum1>>{}(oatpp::Enum<Enum1>(Enum1::V2));
|
||||
OATPP_ASSERT(v == 2);
|
||||
OATPP_ASSERT(v == 2)
|
||||
}
|
||||
|
||||
{
|
||||
auto v = std::hash<oatpp::Enum<Enum1>>{}(oatpp::Enum<Enum1>(Enum1::V3));
|
||||
OATPP_ASSERT(v == 3);
|
||||
OATPP_ASSERT(v == 3)
|
||||
}
|
||||
|
||||
std::unordered_map<oatpp::Enum<Enum1>, oatpp::String> map({
|
||||
@ -86,61 +86,61 @@ void EnumTest::onRun() {
|
||||
{Enum1::V3, "v3"},
|
||||
});
|
||||
|
||||
OATPP_ASSERT(map.size() == 3);
|
||||
OATPP_ASSERT(map[Enum1::V1] == "v1");
|
||||
OATPP_ASSERT(map[Enum1::V2] == "v2");
|
||||
OATPP_ASSERT(map[Enum1::V3] == "v3");
|
||||
OATPP_ASSERT(map.size() == 3)
|
||||
OATPP_ASSERT(map[Enum1::V1] == "v1")
|
||||
OATPP_ASSERT(map[Enum1::V2] == "v2")
|
||||
OATPP_ASSERT(map[Enum1::V3] == "v3")
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check Meta...");
|
||||
OATPP_LOGI(TAG, "Check Meta...")
|
||||
{
|
||||
const auto &entries = oatpp::Enum<Enum0>::getEntries();
|
||||
OATPP_ASSERT(entries.size() == 0);
|
||||
OATPP_ASSERT(entries.size() == 0)
|
||||
}
|
||||
|
||||
{
|
||||
const auto &v = oatpp::Enum<Enum1>::getEntries();
|
||||
OATPP_ASSERT(v.size() == 3);
|
||||
OATPP_ASSERT(v[0].index == 0 && v[0].name == "V1" && v[0].value == Enum1::V1 && v[0].description == nullptr);
|
||||
OATPP_ASSERT(v[1].index == 1 && v[1].name == "V2" && v[1].value == Enum1::V2 && v[1].description == nullptr);
|
||||
OATPP_ASSERT(v[2].index == 2 && v[2].name == "V3" && v[2].value == Enum1::V3 && v[2].description == nullptr);
|
||||
OATPP_ASSERT(v.size() == 3)
|
||||
OATPP_ASSERT(v[0].index == 0 && v[0].name == "V1" && v[0].value == Enum1::V1 && v[0].description == nullptr)
|
||||
OATPP_ASSERT(v[1].index == 1 && v[1].name == "V2" && v[1].value == Enum1::V2 && v[1].description == nullptr)
|
||||
OATPP_ASSERT(v[2].index == 2 && v[2].name == "V3" && v[2].value == Enum1::V3 && v[2].description == nullptr)
|
||||
}
|
||||
|
||||
{
|
||||
const auto &v = oatpp::Enum<Enum2>::getEntries();
|
||||
OATPP_ASSERT(v.size() == 3);
|
||||
OATPP_ASSERT(v[0].index == 0 && v[0].name == "name-1" && v[0].value == Enum2::NAME_1 && v[0].description == nullptr);
|
||||
OATPP_ASSERT(v[1].index == 1 && v[1].name == "name-2" && v[1].value == Enum2::NAME_2 && v[1].description == nullptr);
|
||||
OATPP_ASSERT(v[2].index == 2 && v[2].name == "name-3" && v[2].value == Enum2::NAME_3 && v[2].description == nullptr);
|
||||
OATPP_ASSERT(v.size() == 3)
|
||||
OATPP_ASSERT(v[0].index == 0 && v[0].name == "name-1" && v[0].value == Enum2::NAME_1 && v[0].description == nullptr)
|
||||
OATPP_ASSERT(v[1].index == 1 && v[1].name == "name-2" && v[1].value == Enum2::NAME_2 && v[1].description == nullptr)
|
||||
OATPP_ASSERT(v[2].index == 2 && v[2].name == "name-3" && v[2].value == Enum2::NAME_3 && v[2].description == nullptr)
|
||||
}
|
||||
|
||||
{
|
||||
const auto &v = oatpp::Enum<Enum3>::getEntries();
|
||||
OATPP_ASSERT(v.size() == 3);
|
||||
OATPP_ASSERT(v[0].index == 0 && v[0].name == "v-1" && v[0].value == Enum3::V_1 && v[0].description == "description_1");
|
||||
OATPP_ASSERT(v[1].index == 1 && v[1].name == "v-2" && v[1].value == Enum3::V_2 && v[1].description == "description_2");
|
||||
OATPP_ASSERT(v[2].index == 2 && v[2].name == "v-3" && v[2].value == Enum3::V_3 && v[2].description == "description_3");
|
||||
OATPP_ASSERT(v.size() == 3)
|
||||
OATPP_ASSERT(v[0].index == 0 && v[0].name == "v-1" && v[0].value == Enum3::V_1 && v[0].description == "description_1")
|
||||
OATPP_ASSERT(v[1].index == 1 && v[1].name == "v-2" && v[1].value == Enum3::V_2 && v[1].description == "description_2")
|
||||
OATPP_ASSERT(v[2].index == 2 && v[2].name == "v-3" && v[2].value == Enum3::V_3 && v[2].description == "description_3")
|
||||
}
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Declaration...");
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::Interpreter::notNull == false);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::Interpreter::notNull == true);
|
||||
OATPP_LOGI(TAG, "Declaration...")
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::Interpreter::notNull == false)
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::Interpreter::notNull == true)
|
||||
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsString::Interpreter::notNull == false);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsString::NotNull::Interpreter::notNull == true);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsString::Interpreter::notNull == false)
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsString::NotNull::Interpreter::notNull == true)
|
||||
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsNumber::Interpreter::notNull == false);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsNumber::NotNull::Interpreter::notNull == true);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsNumber::Interpreter::notNull == false)
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::AsNumber::NotNull::Interpreter::notNull == true)
|
||||
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::AsString::Interpreter::notNull == true);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::AsNumber::Interpreter::notNull == true);
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::AsString::Interpreter::notNull == true)
|
||||
OATPP_ASSERT(oatpp::Enum<Enum2>::NotNull::AsNumber::Interpreter::notNull == true)
|
||||
|
||||
auto pd1 = static_cast<const oatpp::data::mapping::type::__class::AbstractEnum::PolymorphicDispatcher*>(
|
||||
oatpp::Enum<Enum2>::Class::getType()->polymorphicDispatcher
|
||||
@ -150,154 +150,154 @@ void EnumTest::onRun() {
|
||||
oatpp::Enum<Enum2>::NotNull::Class::getType()->polymorphicDispatcher
|
||||
);
|
||||
|
||||
OATPP_ASSERT(pd1->notNull == false);
|
||||
OATPP_ASSERT(pd2->notNull == true);
|
||||
OATPP_ASSERT(pd1->notNull == false)
|
||||
OATPP_ASSERT(pd2->notNull == true)
|
||||
|
||||
{
|
||||
auto interEnum = pd1->getInterpretedEnum();
|
||||
OATPP_ASSERT(interEnum.size() == 3);
|
||||
OATPP_ASSERT(interEnum[0].getStoredType() == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(interEnum.size() == 3)
|
||||
OATPP_ASSERT(interEnum[0].getStoredType() == oatpp::String::Class::getType())
|
||||
}
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Interpreter AsString...");
|
||||
OATPP_LOGI(TAG, "Test Interpreter AsString...")
|
||||
oatpp::data::mapping::type::EnumInterpreterError e = oatpp::data::mapping::type::EnumInterpreterError::OK;
|
||||
auto inter = oatpp::Enum<Enum2>::AsString::Interpreter::toInterpretation(oatpp::Enum<Enum2>::AsString(Enum2::NAME_1), e);
|
||||
OATPP_ASSERT(inter.getValueType() == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
|
||||
OATPP_ASSERT(inter.getValueType() == oatpp::String::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
|
||||
auto interValue = inter.cast<oatpp::String>();
|
||||
OATPP_ASSERT(interValue == "name-1");
|
||||
OATPP_ASSERT(interValue == "name-1")
|
||||
|
||||
oatpp::Void voidValue = oatpp::Enum<Enum2>::AsString::Interpreter::fromInterpretation(interValue, e);
|
||||
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType());
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
|
||||
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
|
||||
auto value = voidValue.cast<oatpp::Enum<Enum2>::AsString>();
|
||||
OATPP_ASSERT(value == Enum2::NAME_1);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(value == Enum2::NAME_1)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Interpreter AsNumber...");
|
||||
OATPP_LOGI(TAG, "Test Interpreter AsNumber...")
|
||||
oatpp::data::mapping::type::EnumInterpreterError e = oatpp::data::mapping::type::EnumInterpreterError::OK;
|
||||
auto inter = oatpp::Enum<Enum2>::AsNumber::Interpreter::toInterpretation(oatpp::Enum<Enum2>::AsNumber(Enum2::NAME_1), e);
|
||||
OATPP_ASSERT(inter.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
|
||||
OATPP_ASSERT(inter.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
|
||||
auto interValue = inter.cast<oatpp::Int32>();
|
||||
OATPP_ASSERT(interValue == static_cast<v_int32>(Enum2::NAME_1));
|
||||
OATPP_ASSERT(interValue == static_cast<v_int32>(Enum2::NAME_1))
|
||||
|
||||
oatpp::Void voidValue = oatpp::Enum<Enum2>::AsNumber::Interpreter::fromInterpretation(interValue, e);
|
||||
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType());
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK);
|
||||
OATPP_ASSERT(voidValue.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType())
|
||||
OATPP_ASSERT(e == oatpp::data::mapping::type::EnumInterpreterError::OK)
|
||||
|
||||
auto value = voidValue.cast<oatpp::Enum<Enum2>::AsNumber>();
|
||||
OATPP_ASSERT(value == Enum2::NAME_1);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(value == Enum2::NAME_1)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test default constructors and == operators...");
|
||||
OATPP_LOGI(TAG, "Test default constructors and == operators...")
|
||||
oatpp::Enum<Enum2>::AsString e1;
|
||||
oatpp::Enum<Enum2>::AsString e2;
|
||||
|
||||
OATPP_ASSERT(!e1);
|
||||
OATPP_ASSERT(e1 == nullptr);
|
||||
OATPP_ASSERT(e1 == e2);
|
||||
OATPP_ASSERT(e2 == e1);
|
||||
OATPP_ASSERT(!e1)
|
||||
OATPP_ASSERT(e1 == nullptr)
|
||||
OATPP_ASSERT(e1 == e2)
|
||||
OATPP_ASSERT(e2 == e1)
|
||||
|
||||
oatpp::Enum<Enum2>::NotNull e3;
|
||||
|
||||
OATPP_ASSERT(e1 == e3);
|
||||
OATPP_ASSERT(e3 == e1);
|
||||
OATPP_ASSERT(e1 == e3)
|
||||
OATPP_ASSERT(e3 == e1)
|
||||
|
||||
oatpp::Enum<Enum2>::AsNumber::NotNull e4;
|
||||
|
||||
OATPP_ASSERT(e1 == e4);
|
||||
OATPP_ASSERT(e4 == e1);
|
||||
OATPP_ASSERT(e1 == e4)
|
||||
OATPP_ASSERT(e4 == e1)
|
||||
|
||||
OATPP_ASSERT(e1.getValueType() != e4.getValueType()); // Types are not equal because interpreters are different
|
||||
OATPP_ASSERT(e1.getValueType()->classId.id == e4.getValueType()->classId.id); // But classId is the same
|
||||
OATPP_ASSERT(e1.getValueType() != e4.getValueType()) // Types are not equal because interpreters are different
|
||||
OATPP_ASSERT(e1.getValueType()->classId.id == e4.getValueType()->classId.id) // But classId is the same
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test value constructor and == operators...");
|
||||
OATPP_LOGI(TAG, "Test value constructor and == operators...")
|
||||
oatpp::Enum<Enum2> e1(Enum2::NAME_1);
|
||||
oatpp::Enum<Enum2> e2(Enum2::NAME_1);
|
||||
oatpp::Enum<Enum2> e3;
|
||||
|
||||
OATPP_ASSERT(e1);
|
||||
OATPP_ASSERT(e1 != nullptr);
|
||||
OATPP_ASSERT(e1 == e2);
|
||||
OATPP_ASSERT(e1 != e3);
|
||||
OATPP_ASSERT(e3 != e1);
|
||||
OATPP_ASSERT(e1)
|
||||
OATPP_ASSERT(e1 != nullptr)
|
||||
OATPP_ASSERT(e1 == e2)
|
||||
OATPP_ASSERT(e1 != e3)
|
||||
OATPP_ASSERT(e3 != e1)
|
||||
|
||||
OATPP_ASSERT(e1 == Enum2::NAME_1);
|
||||
OATPP_ASSERT(e1 != Enum2::NAME_2);
|
||||
OATPP_ASSERT(e3 != Enum2::NAME_1);
|
||||
OATPP_ASSERT(e1 == Enum2::NAME_1)
|
||||
OATPP_ASSERT(e1 != Enum2::NAME_2)
|
||||
OATPP_ASSERT(e3 != Enum2::NAME_1)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test copy-assignment operator...");
|
||||
OATPP_LOGI(TAG, "Test copy-assignment operator...")
|
||||
oatpp::Enum<Enum2>::AsString e1;
|
||||
oatpp::Enum<Enum2>::AsNumber e2(Enum2::NAME_1);
|
||||
Enum2 ve;
|
||||
|
||||
OATPP_ASSERT(e1.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType());
|
||||
OATPP_ASSERT(e2.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType());
|
||||
OATPP_ASSERT(e1.getValueType() != e2.getValueType());
|
||||
OATPP_ASSERT(e1.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType())
|
||||
OATPP_ASSERT(e2.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType())
|
||||
OATPP_ASSERT(e1.getValueType() != e2.getValueType())
|
||||
|
||||
e1 = e2;
|
||||
|
||||
OATPP_ASSERT(e1.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType());
|
||||
OATPP_ASSERT(e2.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType());
|
||||
OATPP_ASSERT(e1.getValueType() != e2.getValueType());
|
||||
OATPP_ASSERT(e1.getValueType() == oatpp::Enum<Enum2>::AsString::Class::getType())
|
||||
OATPP_ASSERT(e2.getValueType() == oatpp::Enum<Enum2>::AsNumber::Class::getType())
|
||||
OATPP_ASSERT(e1.getValueType() != e2.getValueType())
|
||||
|
||||
OATPP_ASSERT(e1 == e2);
|
||||
OATPP_ASSERT(e2 == e1);
|
||||
OATPP_ASSERT(e1.get() == e2.get());
|
||||
OATPP_ASSERT(e1 == e2)
|
||||
OATPP_ASSERT(e2 == e1)
|
||||
OATPP_ASSERT(e1.get() == e2.get())
|
||||
|
||||
e1 = Enum2::NAME_2;
|
||||
|
||||
OATPP_ASSERT(e1 != e2);
|
||||
OATPP_ASSERT(e2 != e1);
|
||||
OATPP_ASSERT(e1.get() != e2.get());
|
||||
OATPP_ASSERT(e1 != e2)
|
||||
OATPP_ASSERT(e2 != e1)
|
||||
OATPP_ASSERT(e1.get() != e2.get())
|
||||
|
||||
OATPP_ASSERT(e1 == Enum2::NAME_2);
|
||||
OATPP_ASSERT(e2 == Enum2::NAME_1);
|
||||
OATPP_ASSERT(e1 == Enum2::NAME_2)
|
||||
OATPP_ASSERT(e2 == Enum2::NAME_1)
|
||||
|
||||
ve = e1;
|
||||
|
||||
OATPP_ASSERT(ve == Enum2::NAME_2);
|
||||
OATPP_ASSERT(ve == Enum2::NAME_2)
|
||||
|
||||
ve = e2;
|
||||
|
||||
OATPP_ASSERT(ve == Enum2::NAME_1);
|
||||
OATPP_ASSERT(ve == Enum2::NAME_1)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test move-assignment operator...");
|
||||
OATPP_LOGI(TAG, "Test move-assignment operator...")
|
||||
oatpp::Enum<Enum2>::AsString e1;
|
||||
oatpp::Enum<Enum2>::AsNumber e2(Enum2::NAME_1);
|
||||
|
||||
e1 = std::move(e2);
|
||||
|
||||
OATPP_ASSERT(e1);
|
||||
OATPP_ASSERT(!e2);
|
||||
OATPP_ASSERT(e1)
|
||||
OATPP_ASSERT(!e2)
|
||||
|
||||
OATPP_ASSERT(e1 == Enum2::NAME_1);
|
||||
OATPP_ASSERT(e1 == Enum2::NAME_1)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace __class {
|
||||
public:
|
||||
|
||||
oatpp::Object<PointDto> interpret(const Point& value) const override {
|
||||
OATPP_LOGD("Point::Interpretation", "interpret");
|
||||
OATPP_LOGD("Point::Interpretation", "interpret")
|
||||
auto dto = PointDto::createShared();
|
||||
dto->x = value->x;
|
||||
dto->y = value->y;
|
||||
@ -82,7 +82,7 @@ namespace __class {
|
||||
}
|
||||
|
||||
Point reproduce(const oatpp::Object<PointDto>& value) const override {
|
||||
OATPP_LOGD("Point::Interpretation", "reproduce");
|
||||
OATPP_LOGD("Point::Interpretation", "reproduce")
|
||||
return Point({value->x, value->y, value->z});
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ namespace __class {
|
||||
public:
|
||||
|
||||
oatpp::Object<LineDto> interpret(const Line& value) const override {
|
||||
OATPP_LOGD("Line::Interpretation", "interpret");
|
||||
OATPP_LOGD("Line::Interpretation", "interpret")
|
||||
auto dto = LineDto::createShared();
|
||||
dto->p1 = {value->p1.x, value->p1.y, value->p1.z};
|
||||
dto->p2 = {value->p2.x, value->p2.y, value->p2.z};
|
||||
@ -135,7 +135,7 @@ namespace __class {
|
||||
}
|
||||
|
||||
Line reproduce(const oatpp::Object<LineDto>& value) const override {
|
||||
OATPP_LOGD("Line::Interpretation", "reproduce");
|
||||
OATPP_LOGD("Line::Interpretation", "reproduce")
|
||||
return Line({{value->p1->x, value->p1->y, value->p1->z},
|
||||
{value->p2->x, value->p2->y, value->p2->z}});
|
||||
}
|
||||
@ -193,15 +193,15 @@ void InterpretationTest::onRun() {
|
||||
|
||||
auto json1 = mapper.writeToString(l);
|
||||
|
||||
OATPP_LOGD(TAG, "json1='%s'", json1->c_str());
|
||||
OATPP_LOGD(TAG, "json1='%s'", json1->c_str())
|
||||
|
||||
auto rl = mapper.readFromString<Line>(json1);
|
||||
|
||||
auto json2 = mapper.writeToString(rl);
|
||||
|
||||
OATPP_LOGD(TAG, "json2='%s'", json2->c_str());
|
||||
OATPP_LOGD(TAG, "json2='%s'", json2->c_str())
|
||||
|
||||
OATPP_ASSERT(json1 == json2);
|
||||
OATPP_ASSERT(json1 == json2)
|
||||
|
||||
oatpp::data::mapping::TypeResolver::Cache cache;
|
||||
|
||||
@ -212,9 +212,9 @@ void InterpretationTest::onRun() {
|
||||
//oatpp::data::mapping::TypeResolver::Cache cache;
|
||||
|
||||
auto v = tr.resolveObjectPropertyValue(l, {"p1", "x"}, cache);
|
||||
OATPP_ASSERT(v);
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(v.cast<oatpp::Int32>() == 1);
|
||||
OATPP_ASSERT(v)
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(v.cast<oatpp::Int32>() == 1)
|
||||
}
|
||||
|
||||
{
|
||||
@ -224,9 +224,9 @@ void InterpretationTest::onRun() {
|
||||
//oatpp::data::mapping::TypeResolver::Cache cache;
|
||||
|
||||
auto v = tr.resolveObjectPropertyValue(l, {"p1", "y"}, cache);
|
||||
OATPP_ASSERT(v);
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(v.cast<oatpp::Int32>() == 2);
|
||||
OATPP_ASSERT(v)
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(v.cast<oatpp::Int32>() == 2)
|
||||
}
|
||||
|
||||
{
|
||||
@ -236,11 +236,11 @@ void InterpretationTest::onRun() {
|
||||
//oatpp::data::mapping::TypeResolver::Cache cache;
|
||||
|
||||
auto v = tr.resolveObjectPropertyValue(l, {"p1", "z"}, cache);
|
||||
OATPP_ASSERT(v);
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(v.cast<oatpp::Int32>() == 3);
|
||||
OATPP_ASSERT(v)
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(v.cast<oatpp::Int32>() == 3)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}}}}}}
|
||||
}}}}}}
|
||||
|
@ -31,113 +31,113 @@ namespace oatpp { namespace test { namespace core { namespace data { namespace m
|
||||
void ListTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor...");
|
||||
OATPP_LOGI(TAG, "test default constructor...")
|
||||
oatpp::List<oatpp::String> list;
|
||||
|
||||
OATPP_ASSERT(!list);
|
||||
OATPP_ASSERT(list == nullptr);
|
||||
OATPP_ASSERT(!list)
|
||||
OATPP_ASSERT(list == nullptr)
|
||||
|
||||
OATPP_ASSERT(list.get() == nullptr);
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
|
||||
OATPP_ASSERT(list.getValueType()->params.size() == 1);
|
||||
OATPP_ASSERT(list.getValueType()->params.front() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(list.get() == nullptr)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_ASSERT(list.getValueType()->params.size() == 1)
|
||||
OATPP_ASSERT(list.getValueType()->params.front() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...");
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...")
|
||||
oatpp::List<oatpp::String> list({});
|
||||
|
||||
OATPP_ASSERT(list);
|
||||
OATPP_ASSERT(list != nullptr);
|
||||
OATPP_ASSERT(list->size() == 0);
|
||||
OATPP_ASSERT(list)
|
||||
OATPP_ASSERT(list != nullptr)
|
||||
OATPP_ASSERT(list->size() == 0)
|
||||
|
||||
OATPP_ASSERT(list.get() != nullptr);
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
|
||||
OATPP_ASSERT(list.getValueType()->params.size() == 1);
|
||||
OATPP_ASSERT(list.getValueType()->params.front() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(list.get() != nullptr)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_ASSERT(list.getValueType()->params.size() == 1)
|
||||
OATPP_ASSERT(list.getValueType()->params.front() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test createShared()...");
|
||||
OATPP_LOGI(TAG, "test createShared()...")
|
||||
oatpp::List<oatpp::String> list = oatpp::List<oatpp::String>::createShared();
|
||||
|
||||
OATPP_ASSERT(list);
|
||||
OATPP_ASSERT(list != nullptr);
|
||||
OATPP_ASSERT(list->size() == 0);
|
||||
OATPP_ASSERT(list)
|
||||
OATPP_ASSERT(list != nullptr)
|
||||
OATPP_ASSERT(list->size() == 0)
|
||||
|
||||
OATPP_ASSERT(list.get() != nullptr);
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(list.get() != nullptr)
|
||||
OATPP_ASSERT(list.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...")
|
||||
oatpp::List<oatpp::String> list1({});
|
||||
oatpp::List<oatpp::String> list2;
|
||||
|
||||
list2 = list1;
|
||||
|
||||
OATPP_ASSERT(list1);
|
||||
OATPP_ASSERT(list2);
|
||||
OATPP_ASSERT(list1)
|
||||
OATPP_ASSERT(list2)
|
||||
|
||||
OATPP_ASSERT(list1->size() == 0);
|
||||
OATPP_ASSERT(list2->size() == 0);
|
||||
OATPP_ASSERT(list1->size() == 0)
|
||||
OATPP_ASSERT(list2->size() == 0)
|
||||
|
||||
OATPP_ASSERT(list1.get() == list2.get());
|
||||
OATPP_ASSERT(list1.get() == list2.get())
|
||||
|
||||
list2->push_back("a");
|
||||
|
||||
OATPP_ASSERT(list1->size() == 1);
|
||||
OATPP_ASSERT(list2->size() == 1);
|
||||
OATPP_ASSERT(list1->size() == 1)
|
||||
OATPP_ASSERT(list2->size() == 1)
|
||||
|
||||
list2 = {"b", "c"};
|
||||
|
||||
OATPP_ASSERT(list1->size() == 1);
|
||||
OATPP_ASSERT(list2->size() == 2);
|
||||
OATPP_ASSERT(list1->size() == 1)
|
||||
OATPP_ASSERT(list2->size() == 2)
|
||||
|
||||
OATPP_ASSERT(list2[0] == "b");
|
||||
OATPP_ASSERT(list2[1] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(list2[0] == "b")
|
||||
OATPP_ASSERT(list2[1] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...")
|
||||
oatpp::List<oatpp::String> list1({});
|
||||
oatpp::List<oatpp::String> list2;
|
||||
|
||||
list2 = std::move(list1);
|
||||
|
||||
OATPP_ASSERT(!list1);
|
||||
OATPP_ASSERT(list2);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!list1)
|
||||
OATPP_ASSERT(list2)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test get element by index...");
|
||||
OATPP_LOGI(TAG, "test get element by index...")
|
||||
oatpp::List<oatpp::String> list = {"a", "b", "c"};
|
||||
|
||||
OATPP_ASSERT(list);
|
||||
OATPP_ASSERT(list != nullptr);
|
||||
OATPP_ASSERT(list->size() == 3);
|
||||
OATPP_ASSERT(list)
|
||||
OATPP_ASSERT(list != nullptr)
|
||||
OATPP_ASSERT(list->size() == 3)
|
||||
|
||||
OATPP_ASSERT(list[0] == "a");
|
||||
OATPP_ASSERT(list[1] == "b");
|
||||
OATPP_ASSERT(list[2] == "c");
|
||||
OATPP_ASSERT(list[0] == "a")
|
||||
OATPP_ASSERT(list[1] == "b")
|
||||
OATPP_ASSERT(list[2] == "c")
|
||||
|
||||
list[1] = "Hello!";
|
||||
|
||||
OATPP_ASSERT(list->size() == 3);
|
||||
OATPP_ASSERT(list->size() == 3)
|
||||
|
||||
OATPP_ASSERT(list[0] == "a");
|
||||
OATPP_ASSERT(list[1] == "Hello!");
|
||||
OATPP_ASSERT(list[2] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(list[0] == "a")
|
||||
OATPP_ASSERT(list[1] == "Hello!")
|
||||
OATPP_ASSERT(list[2] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...");
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::List<oatpp::String> list = {"a", "b", "c"};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
@ -146,13 +146,13 @@ void ListTest::onRun() {
|
||||
|
||||
polymorphicDispatcher->addItem(list, oatpp::String("d"));
|
||||
|
||||
OATPP_ASSERT(list->size() == 4);
|
||||
OATPP_ASSERT(list->size() == 4)
|
||||
|
||||
OATPP_ASSERT(list[0] == "a");
|
||||
OATPP_ASSERT(list[1] == "b");
|
||||
OATPP_ASSERT(list[2] == "c");
|
||||
OATPP_ASSERT(list[3] == "d");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(list[0] == "a")
|
||||
OATPP_ASSERT(list[1] == "b")
|
||||
OATPP_ASSERT(list[2] == "c")
|
||||
OATPP_ASSERT(list[3] == "d")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -193,164 +193,164 @@ void ObjectTest::onRun() {
|
||||
|
||||
{
|
||||
auto dto = DtoA::createShared("id1");
|
||||
OATPP_ASSERT(dto->id == "id1");
|
||||
OATPP_ASSERT(dto->id == "id1")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Meta 1...");
|
||||
OATPP_LOGI(TAG, "Test Meta 1...")
|
||||
|
||||
auto type = Object<DtoA>::Class::getType();
|
||||
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
const auto& propsMap = dispatcher->getProperties()->getMap();
|
||||
|
||||
OATPP_ASSERT(propsMap.size() == 1);
|
||||
OATPP_ASSERT(propsMap.size() == 1)
|
||||
|
||||
auto it = propsMap.find("id");
|
||||
OATPP_ASSERT(it != propsMap.end());
|
||||
OATPP_ASSERT(it->second->info.description == "identifier");
|
||||
OATPP_ASSERT(it->second->info.pattern == "^[a-z0-9]+$");
|
||||
OATPP_ASSERT(it != propsMap.end())
|
||||
OATPP_ASSERT(it->second->info.description == "identifier")
|
||||
OATPP_ASSERT(it->second->info.pattern == "^[a-z0-9]+$")
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Meta 2...");
|
||||
OATPP_LOGI(TAG, "Test Meta 2...")
|
||||
|
||||
auto type = Object<DtoB>::Class::getType();
|
||||
auto dispatcher = static_cast<const oatpp::data::mapping::type::__class::AbstractObject::PolymorphicDispatcher*>(type->polymorphicDispatcher);
|
||||
const auto& propsMap = dispatcher->getProperties()->getMap();
|
||||
|
||||
OATPP_ASSERT(propsMap.size() == 2);
|
||||
OATPP_ASSERT(propsMap.size() == 2)
|
||||
|
||||
{
|
||||
auto it = propsMap.find("id");
|
||||
OATPP_ASSERT("id" && it != propsMap.end());
|
||||
OATPP_ASSERT(it->second->info.description == "identifier");
|
||||
OATPP_ASSERT("id" && it != propsMap.end())
|
||||
OATPP_ASSERT(it->second->info.description == "identifier")
|
||||
}
|
||||
|
||||
{
|
||||
auto it = propsMap.find("field-a");
|
||||
OATPP_ASSERT("field-a" && it != propsMap.end());
|
||||
OATPP_ASSERT(it->second->info.description == "some field with a qualified name");
|
||||
OATPP_ASSERT("field-a" && it != propsMap.end())
|
||||
OATPP_ASSERT(it->second->info.description == "some field with a qualified name")
|
||||
}
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 1...");
|
||||
OATPP_LOGI(TAG, "Test 1...")
|
||||
Object<DtoA> a;
|
||||
OATPP_ASSERT(!a);
|
||||
OATPP_ASSERT(a == nullptr);
|
||||
OATPP_ASSERT(a.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!a)
|
||||
OATPP_ASSERT(a == nullptr)
|
||||
OATPP_ASSERT(a.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 2...");
|
||||
OATPP_LOGI(TAG, "Test 2...")
|
||||
Object<DtoA> a;
|
||||
Object<DtoA> b;
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 3...");
|
||||
OATPP_LOGI(TAG, "Test 3...")
|
||||
auto a = DtoA::createShared();
|
||||
Object<DtoA> b;
|
||||
OATPP_ASSERT(a != b);
|
||||
OATPP_ASSERT(b != a);
|
||||
OATPP_ASSERT(a != b)
|
||||
OATPP_ASSERT(b != a)
|
||||
auto ohc = a->hashCode();
|
||||
auto whc = std::hash<oatpp::Object<DtoA>>{}(a);
|
||||
OATPP_ASSERT(ohc == whc);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(ohc == whc)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 4...");
|
||||
OATPP_LOGI(TAG, "Test 4...")
|
||||
auto a = Dto0::createShared();
|
||||
auto b = Dto0::createShared();
|
||||
OATPP_ASSERT(a != b);
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(a != b)
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 5...");
|
||||
OATPP_LOGI(TAG, "Test 5...")
|
||||
auto a = DtoA::createShared();
|
||||
auto b = DtoA::createShared();
|
||||
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode());
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode())
|
||||
|
||||
a->id = "hello";
|
||||
|
||||
OATPP_ASSERT(a != b);
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode());
|
||||
OATPP_ASSERT(a != b)
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode())
|
||||
|
||||
b->id = "hello";
|
||||
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 6...");
|
||||
OATPP_LOGI(TAG, "Test 6...")
|
||||
auto a = DtoB::createShared();
|
||||
auto b = DtoB::createShared();
|
||||
|
||||
OATPP_ASSERT(a->a == "default-value");
|
||||
OATPP_ASSERT(b->a == "default-value");
|
||||
OATPP_ASSERT(a->a == "default-value")
|
||||
OATPP_ASSERT(b->a == "default-value")
|
||||
|
||||
a->a = "value1"; // value that is ignored in HC & EQ
|
||||
a->a = "value2"; // value that is ignored in HC & EQ
|
||||
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode());
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode())
|
||||
|
||||
a->id = "hello";
|
||||
|
||||
OATPP_ASSERT(a != b);
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode());
|
||||
OATPP_ASSERT(a != b)
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode())
|
||||
|
||||
b->id = "hello";
|
||||
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 7...");
|
||||
OATPP_LOGI(TAG, "Test 7...")
|
||||
auto a = DtoC::createShared();
|
||||
auto b = DtoC::createShared();
|
||||
|
||||
a->id = "1";
|
||||
b->id = "2";
|
||||
|
||||
OATPP_ASSERT(a != b);
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode());
|
||||
OATPP_ASSERT(a != b)
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode())
|
||||
|
||||
a->id = "2";
|
||||
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode());
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode())
|
||||
|
||||
a->c = "a";
|
||||
|
||||
OATPP_ASSERT(a != b);
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode());
|
||||
OATPP_ASSERT(a != b)
|
||||
OATPP_ASSERT(a->hashCode() != b->hashCode())
|
||||
|
||||
b->c = "a";
|
||||
|
||||
OATPP_ASSERT(a == b);
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(a == b)
|
||||
OATPP_ASSERT(a->hashCode() == b->hashCode())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 8...");
|
||||
OATPP_LOGI(TAG, "Test 8...")
|
||||
auto a = DtoB::createShared();
|
||||
auto b = DtoB::createShared();
|
||||
auto c = DtoB::createShared();
|
||||
@ -368,26 +368,26 @@ void ObjectTest::onRun() {
|
||||
|
||||
oatpp::UnorderedSet<oatpp::Object<DtoB>> set = {a, b, c, d, e};
|
||||
|
||||
OATPP_ASSERT(set->size() == 2);
|
||||
OATPP_ASSERT(set[a] == true);
|
||||
OATPP_ASSERT(set[b] == true);
|
||||
OATPP_ASSERT(set[c] == true);
|
||||
OATPP_ASSERT(set[d] == true);
|
||||
OATPP_ASSERT(set[e] == true);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(set->size() == 2)
|
||||
OATPP_ASSERT(set[a] == true)
|
||||
OATPP_ASSERT(set[b] == true)
|
||||
OATPP_ASSERT(set[c] == true)
|
||||
OATPP_ASSERT(set[d] == true)
|
||||
OATPP_ASSERT(set[e] == true)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 9...");
|
||||
OATPP_LOGI(TAG, "Test 9...")
|
||||
auto dto = DtoD::createShared();
|
||||
OATPP_ASSERT(dto->a.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(dto->a);
|
||||
OATPP_ASSERT(dto->a == 64);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(dto->a.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(dto->a)
|
||||
OATPP_ASSERT(dto->a == 64)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 10...");
|
||||
OATPP_LOGI(TAG, "Test 10...")
|
||||
OATPP_ASSERT(oatpp::Object<DtoA>::Class::getType()->extends(oatpp::Object<oatpp::DTO>::Class::getType()))
|
||||
OATPP_ASSERT(oatpp::Object<DtoA>::Class::getType()->extends(oatpp::Object<DtoA>::Class::getType()))
|
||||
OATPP_ASSERT(oatpp::Object<DtoB>::Class::getType()->extends(oatpp::Object<DtoA>::Class::getType()))
|
||||
@ -395,35 +395,35 @@ void ObjectTest::onRun() {
|
||||
OATPP_ASSERT(oatpp::Object<DtoC>::Class::getType()->extends(oatpp::Object<DtoA>::Class::getType()))
|
||||
OATPP_ASSERT(oatpp::Object<DtoD>::Class::getType()->extends(oatpp::Object<DtoA>::Class::getType()))
|
||||
OATPP_ASSERT(!oatpp::Object<DtoC>::Class::getType()->extends(oatpp::Object<DtoB>::Class::getType()))
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 11...");
|
||||
OATPP_LOGI(TAG, "Test 11...")
|
||||
|
||||
auto map = oatpp::Object<PolymorphicDto1>::getPropertiesMap();
|
||||
auto p = map["polymorph"];
|
||||
|
||||
OATPP_ASSERT(p->info.description == "");
|
||||
OATPP_ASSERT(p->info.typeSelector != nullptr);
|
||||
OATPP_ASSERT(p->info.description == "")
|
||||
OATPP_ASSERT(p->info.typeSelector != nullptr)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 12...");
|
||||
OATPP_LOGI(TAG, "Test 12...")
|
||||
|
||||
auto map = oatpp::Object<PolymorphicDto2>::getPropertiesMap();
|
||||
auto p = map["polymorph"];
|
||||
|
||||
OATPP_ASSERT(p->info.description == "description");
|
||||
OATPP_ASSERT(p->info.typeSelector != nullptr);
|
||||
OATPP_ASSERT(p->info.description == "description")
|
||||
OATPP_ASSERT(p->info.typeSelector != nullptr)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 13...");
|
||||
OATPP_LOGI(TAG, "Test 13...")
|
||||
|
||||
auto dto = oatpp::Object<PolymorphicDto2>::createShared();
|
||||
OATPP_ASSERT(dto->type == nullptr)
|
||||
@ -432,14 +432,14 @@ void ObjectTest::onRun() {
|
||||
OATPP_ASSERT(dto["type"].getValueType() == oatpp::String::Class::getType())
|
||||
|
||||
dto["type"] = oatpp::String("hello");
|
||||
OATPP_ASSERT(dto->type == "hello");
|
||||
OATPP_ASSERT(dto->type == "hello")
|
||||
OATPP_ASSERT(dto->type.getValueType() == oatpp::String::Class::getType())
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 14...");
|
||||
OATPP_LOGI(TAG, "Test 14...")
|
||||
|
||||
auto dto = oatpp::Object<PolymorphicDto2>::createShared();
|
||||
bool thrown = false;
|
||||
@ -447,17 +447,17 @@ void ObjectTest::onRun() {
|
||||
try{
|
||||
dto["type"] = oatpp::Int32(32);
|
||||
} catch(std::runtime_error const& e) {
|
||||
OATPP_LOGD(TAG, "error='%s'", e.what());
|
||||
OATPP_LOGD(TAG, "error='%s'", e.what())
|
||||
thrown = true;
|
||||
}
|
||||
|
||||
OATPP_ASSERT(thrown)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 15...");
|
||||
OATPP_LOGI(TAG, "Test 15...")
|
||||
|
||||
auto dto = oatpp::Object<PolymorphicDto2>::createShared();
|
||||
bool thrown = false;
|
||||
@ -465,17 +465,17 @@ void ObjectTest::onRun() {
|
||||
try{
|
||||
dto["non-existing"];
|
||||
} catch(std::out_of_range const& e) {
|
||||
OATPP_LOGD(TAG, "error='%s'", e.what());
|
||||
OATPP_LOGD(TAG, "error='%s'", e.what())
|
||||
thrown = true;
|
||||
}
|
||||
|
||||
OATPP_ASSERT(thrown)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 16...");
|
||||
OATPP_LOGI(TAG, "Test 16...")
|
||||
|
||||
oatpp::parser::json::mapping::ObjectMapper mapper;
|
||||
|
||||
@ -503,11 +503,11 @@ void ObjectTest::onRun() {
|
||||
|
||||
OATPP_ASSERT(polymorphClone->fieldA == "type-A")
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 17...");
|
||||
OATPP_LOGI(TAG, "Test 17...")
|
||||
|
||||
oatpp::parser::json::mapping::ObjectMapper mapper;
|
||||
|
||||
@ -535,11 +535,11 @@ void ObjectTest::onRun() {
|
||||
|
||||
OATPP_ASSERT(polymorphClone == "Hello World!")
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test 18...");
|
||||
OATPP_LOGI(TAG, "Test 18...")
|
||||
|
||||
oatpp::parser::json::mapping::ObjectMapper mapper;
|
||||
|
||||
@ -569,7 +569,7 @@ void ObjectTest::onRun() {
|
||||
OATPP_ASSERT(polymorphClone == nullptr)
|
||||
OATPP_ASSERT(polymorphClone.getValueType() == oatpp::String::Class::getType())
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,161 +37,161 @@ namespace {
|
||||
void ObjectWrapperTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check default valueType is assigned (default tparam Clazz)...");
|
||||
OATPP_LOGI(TAG, "Check default valueType is assigned (default tparam Clazz)...")
|
||||
ObjectWrapper<std::string> pw;
|
||||
OATPP_ASSERT(!pw);
|
||||
OATPP_ASSERT(pw == nullptr);
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!pw)
|
||||
OATPP_ASSERT(pw == nullptr)
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check default valueType is assigned (specified tparam Clazz)...");
|
||||
OATPP_LOGI(TAG, "Check default valueType is assigned (specified tparam Clazz)...")
|
||||
ObjectWrapper<std::string, oatpp::data::mapping::type::__class::String> pw;
|
||||
OATPP_ASSERT(!pw);
|
||||
OATPP_ASSERT(pw == nullptr);
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!pw)
|
||||
OATPP_ASSERT(pw == nullptr)
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from constructor...");
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from constructor...")
|
||||
ObjectWrapper<std::string> pw(oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(!pw);
|
||||
OATPP_ASSERT(pw == nullptr);
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!pw)
|
||||
OATPP_ASSERT(pw == nullptr)
|
||||
OATPP_ASSERT(pw.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from copy constructor...");
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from copy constructor...")
|
||||
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
ObjectWrapper<std::string> pw2(pw1);
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from move constructor...");
|
||||
OATPP_LOGI(TAG, "Check valueType is assigned from move constructor...")
|
||||
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
ObjectWrapper<std::string> pw2(std::move(pw1));
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is NOT assigned from copy-assign operator...");
|
||||
OATPP_LOGI(TAG, "Check valueType is NOT assigned from copy-assign operator...")
|
||||
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
ObjectWrapper<std::string> pw2;
|
||||
bool throws = false;
|
||||
try {
|
||||
pw2 = pw1;
|
||||
} catch (std::runtime_error& e) {
|
||||
} catch (std::runtime_error&) {
|
||||
throws = true;
|
||||
}
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(throws)
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check valueType is NOT assigned from move-assign operator...");
|
||||
OATPP_LOGI(TAG, "Check valueType is NOT assigned from move-assign operator...")
|
||||
ObjectWrapper<std::string> pw1(oatpp::data::mapping::type::__class::String::getType());
|
||||
ObjectWrapper<std::string> pw2;
|
||||
bool throws = false;
|
||||
try {
|
||||
pw2 = std::move(pw1);
|
||||
} catch (std::runtime_error& e) {
|
||||
} catch (std::runtime_error&) {
|
||||
throws = true;
|
||||
}
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
OATPP_ASSERT(throws)
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check copy-assign operator. Check == operator...");
|
||||
OATPP_LOGI(TAG, "Check copy-assign operator. Check == operator...")
|
||||
ObjectWrapper<std::string> pw1;
|
||||
OATPP_ASSERT(!pw1);
|
||||
OATPP_ASSERT(pw1 == nullptr);
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_ASSERT(!pw1)
|
||||
OATPP_ASSERT(pw1 == nullptr)
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
|
||||
ObjectWrapper<std::string> pw2 = std::make_shared<std::string>("Hello!");
|
||||
OATPP_ASSERT(pw2);
|
||||
OATPP_ASSERT(pw2 != nullptr);
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
|
||||
pw1 = pw2;
|
||||
|
||||
OATPP_ASSERT(pw1);
|
||||
OATPP_ASSERT(pw1 != nullptr);
|
||||
OATPP_ASSERT(pw1)
|
||||
OATPP_ASSERT(pw1 != nullptr)
|
||||
|
||||
OATPP_ASSERT(pw2);
|
||||
OATPP_ASSERT(pw2 != nullptr);
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
|
||||
OATPP_ASSERT(pw1 == pw2);
|
||||
OATPP_ASSERT(pw1.get() == pw2.get());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(pw1 == pw2)
|
||||
OATPP_ASSERT(pw1.get() == pw2.get())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check != operator...");
|
||||
OATPP_LOGI(TAG, "Check != operator...")
|
||||
ObjectWrapper<std::string, oatpp::data::mapping::type::__class::String> pw1(std::make_shared<std::string>("Hello!"));
|
||||
OATPP_ASSERT(pw1);
|
||||
OATPP_ASSERT(pw1 != nullptr);
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(pw1)
|
||||
OATPP_ASSERT(pw1 != nullptr)
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
|
||||
ObjectWrapper<std::string, oatpp::data::mapping::type::__class::String> pw2(std::make_shared<std::string>("Hello!"));
|
||||
OATPP_ASSERT(pw2);
|
||||
OATPP_ASSERT(pw2 != nullptr);
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType());
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::String::getType())
|
||||
|
||||
OATPP_ASSERT(pw1 != pw2);
|
||||
OATPP_ASSERT(pw1.get() != pw2.get());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(pw1 != pw2)
|
||||
OATPP_ASSERT(pw1.get() != pw2.get())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check move-assign operator. Check != operator...");
|
||||
OATPP_LOGI(TAG, "Check move-assign operator. Check != operator...")
|
||||
ObjectWrapper<std::string> pw1;
|
||||
OATPP_ASSERT(!pw1);
|
||||
OATPP_ASSERT(pw1 == nullptr);
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_ASSERT(!pw1)
|
||||
OATPP_ASSERT(pw1 == nullptr)
|
||||
OATPP_ASSERT(pw1.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
|
||||
ObjectWrapper<std::string> pw2 = std::make_shared<std::string>("Hello!");
|
||||
OATPP_ASSERT(pw2);
|
||||
OATPP_ASSERT(pw2 != nullptr);
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType());
|
||||
OATPP_ASSERT(pw2)
|
||||
OATPP_ASSERT(pw2 != nullptr)
|
||||
OATPP_ASSERT(pw2.getValueType() == oatpp::data::mapping::type::__class::Void::getType())
|
||||
|
||||
pw1 = std::move(pw2);
|
||||
|
||||
OATPP_ASSERT(pw1);
|
||||
OATPP_ASSERT(pw1 != nullptr);
|
||||
OATPP_ASSERT(pw1)
|
||||
OATPP_ASSERT(pw1 != nullptr)
|
||||
|
||||
OATPP_ASSERT(!pw2);
|
||||
OATPP_ASSERT(pw2 == nullptr);
|
||||
OATPP_ASSERT(!pw2)
|
||||
OATPP_ASSERT(pw2 == nullptr)
|
||||
|
||||
OATPP_ASSERT(pw1 != pw2);
|
||||
OATPP_ASSERT(pw1.get() != pw2.get());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(pw1 != pw2)
|
||||
OATPP_ASSERT(pw1.get() != pw2.get())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Check oatpp::Void type reassigned");
|
||||
OATPP_LOGI(TAG, "Check oatpp::Void type reassigned")
|
||||
|
||||
oatpp::Void v;
|
||||
v = oatpp::String("test");
|
||||
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::String::Class::getType())
|
||||
|
||||
v = oatpp::Int32(32);
|
||||
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(v.getValueType() == oatpp::Int32::Class::getType())
|
||||
|
||||
oatpp::Int32 i = v.cast<oatpp::Int32>();
|
||||
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_ASSERT(i == 32);
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_ASSERT(i == 32)
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,121 +31,121 @@ namespace oatpp { namespace test { namespace core { namespace data { namespace m
|
||||
void PairListTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor...");
|
||||
OATPP_LOGI(TAG, "test default constructor...")
|
||||
oatpp::Fields<String> map;
|
||||
|
||||
OATPP_ASSERT(!map);
|
||||
OATPP_ASSERT(map == nullptr);
|
||||
OATPP_ASSERT(!map)
|
||||
OATPP_ASSERT(map == nullptr)
|
||||
|
||||
OATPP_ASSERT(map.get() == nullptr);
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2);
|
||||
OATPP_ASSERT(map.get() == nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2)
|
||||
auto it = map.getValueType()->params.begin();
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...");
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...")
|
||||
oatpp::Fields<String> map({});
|
||||
|
||||
OATPP_ASSERT(map);
|
||||
OATPP_ASSERT(map != nullptr);
|
||||
OATPP_ASSERT(map->size() == 0);
|
||||
OATPP_ASSERT(map)
|
||||
OATPP_ASSERT(map != nullptr)
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr);
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2);
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2)
|
||||
auto it = map.getValueType()->params.begin();
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test createShared()...");
|
||||
OATPP_LOGI(TAG, "test createShared()...")
|
||||
oatpp::Fields<String> map = oatpp::Fields<String>::createShared();
|
||||
|
||||
OATPP_ASSERT(map);
|
||||
OATPP_ASSERT(map != nullptr);
|
||||
OATPP_ASSERT(map->size() == 0);
|
||||
OATPP_ASSERT(map)
|
||||
OATPP_ASSERT(map != nullptr)
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr);
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...")
|
||||
oatpp::Fields<String> map1({});
|
||||
oatpp::Fields<String> map2;
|
||||
|
||||
map2 = map1;
|
||||
|
||||
OATPP_ASSERT(map1);
|
||||
OATPP_ASSERT(map2);
|
||||
OATPP_ASSERT(map1)
|
||||
OATPP_ASSERT(map2)
|
||||
|
||||
OATPP_ASSERT(map1->size() == 0);
|
||||
OATPP_ASSERT(map2->size() == 0);
|
||||
OATPP_ASSERT(map1->size() == 0)
|
||||
OATPP_ASSERT(map2->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map1.get() == map2.get());
|
||||
OATPP_ASSERT(map1.get() == map2.get())
|
||||
|
||||
map2->push_back({"key", "a"});
|
||||
|
||||
OATPP_ASSERT(map1->size() == 1);
|
||||
OATPP_ASSERT(map2->size() == 1);
|
||||
OATPP_ASSERT(map1->size() == 1)
|
||||
OATPP_ASSERT(map2->size() == 1)
|
||||
|
||||
map2 = {{"key1", "b"}, {"key2", "c"}};
|
||||
|
||||
OATPP_ASSERT(map1->size() == 1);
|
||||
OATPP_ASSERT(map2->size() == 2);
|
||||
OATPP_ASSERT(map1->size() == 1)
|
||||
OATPP_ASSERT(map2->size() == 2)
|
||||
|
||||
OATPP_ASSERT(map2["key1"] == "b");
|
||||
OATPP_ASSERT(map2["key2"] == "c");
|
||||
OATPP_ASSERT(map2.getValueByKey("key1") == "b");
|
||||
OATPP_ASSERT(map2.getValueByKey("key2") == "c");
|
||||
OATPP_ASSERT(map2.getValueByKey("key3") == nullptr);
|
||||
OATPP_ASSERT(map2.getValueByKey("key3", "default-val") == "default-val");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map2["key1"] == "b")
|
||||
OATPP_ASSERT(map2["key2"] == "c")
|
||||
OATPP_ASSERT(map2.getValueByKey("key1") == "b")
|
||||
OATPP_ASSERT(map2.getValueByKey("key2") == "c")
|
||||
OATPP_ASSERT(map2.getValueByKey("key3") == nullptr)
|
||||
OATPP_ASSERT(map2.getValueByKey("key3", "default-val") == "default-val")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...")
|
||||
oatpp::Fields<String> map1({});
|
||||
oatpp::Fields<String> map2;
|
||||
|
||||
map2 = std::move(map1);
|
||||
|
||||
OATPP_ASSERT(!map1);
|
||||
OATPP_ASSERT(map2);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!map1)
|
||||
OATPP_ASSERT(map2)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test get element by index...");
|
||||
OATPP_LOGI(TAG, "test get element by index...")
|
||||
oatpp::Fields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
|
||||
|
||||
OATPP_ASSERT(map);
|
||||
OATPP_ASSERT(map != nullptr);
|
||||
OATPP_ASSERT(map->size() == 3);
|
||||
OATPP_ASSERT(map)
|
||||
OATPP_ASSERT(map != nullptr)
|
||||
OATPP_ASSERT(map->size() == 3)
|
||||
|
||||
OATPP_ASSERT(map["key1"] == "a");
|
||||
OATPP_ASSERT(map["key2"] == "b");
|
||||
OATPP_ASSERT(map["key3"] == "c");
|
||||
OATPP_ASSERT(map["key1"] == "a")
|
||||
OATPP_ASSERT(map["key2"] == "b")
|
||||
OATPP_ASSERT(map["key3"] == "c")
|
||||
|
||||
map["key2"] = "Hello!";
|
||||
|
||||
OATPP_ASSERT(map->size() == 3);
|
||||
OATPP_ASSERT(map->size() == 3)
|
||||
|
||||
OATPP_ASSERT(map["key1"] == "a");
|
||||
OATPP_ASSERT(map["key2"] == "Hello!");
|
||||
OATPP_ASSERT(map["key3"] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map["key1"] == "a")
|
||||
OATPP_ASSERT(map["key2"] == "Hello!")
|
||||
OATPP_ASSERT(map["key3"] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...");
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::Fields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::mapping::type::__class::Map::PolymorphicDispatcher*>(
|
||||
@ -154,13 +154,13 @@ void PairListTest::onRun() {
|
||||
|
||||
polymorphicDispatcher->addItem(map, oatpp::String("key1"), oatpp::String("d"));
|
||||
|
||||
OATPP_ASSERT(map->size() == 4);
|
||||
OATPP_ASSERT(map->size() == 4)
|
||||
|
||||
OATPP_ASSERT(map[0].first == "key1" && map[0].second == "a");
|
||||
OATPP_ASSERT(map[1].first == "key2" && map[1].second == "b");
|
||||
OATPP_ASSERT(map[2].first == "key3" && map[2].second == "c");
|
||||
OATPP_ASSERT(map[3].first == "key1" && map[3].second == "d");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map[0].first == "key1" && map[0].second == "a")
|
||||
OATPP_ASSERT(map[1].first == "key2" && map[1].second == "b")
|
||||
OATPP_ASSERT(map[2].first == "key3" && map[2].second == "c")
|
||||
OATPP_ASSERT(map[3].first == "key1" && map[3].second == "d")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace {
|
||||
template<class T>
|
||||
void checkHash(const T& val) {
|
||||
auto h = std::hash<T>{}(val);
|
||||
OATPP_LOGI("HASH", "type='%s', hash=%lu", val.getValueType()->classId.name, h);
|
||||
OATPP_LOGI("HASH", "type='%s', hash=%lu", val.getValueType()->classId.name, h)
|
||||
}
|
||||
|
||||
}
|
||||
@ -55,197 +55,197 @@ void PrimitiveTest::onRun() {
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor");
|
||||
OATPP_LOGI(TAG, "test default constructor")
|
||||
oatpp::Int32 i;
|
||||
OATPP_ASSERT(!i);
|
||||
OATPP_ASSERT(i == nullptr);
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!i)
|
||||
OATPP_ASSERT(i == nullptr)
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test value constructor");
|
||||
OATPP_LOGI(TAG, "test value constructor")
|
||||
oatpp::Int32 i(0);
|
||||
OATPP_ASSERT(i);
|
||||
OATPP_ASSERT(i != nullptr);
|
||||
OATPP_ASSERT(i == 0);
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(i)
|
||||
OATPP_ASSERT(i != nullptr)
|
||||
OATPP_ASSERT(i == 0)
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test implicit value constructor");
|
||||
OATPP_LOGI(TAG, "test implicit value constructor")
|
||||
oatpp::Int32 i = 0;
|
||||
OATPP_ASSERT(i);
|
||||
OATPP_ASSERT(i != nullptr);
|
||||
OATPP_ASSERT(i == 0);
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(i)
|
||||
OATPP_ASSERT(i != nullptr)
|
||||
OATPP_ASSERT(i == 0)
|
||||
OATPP_ASSERT(i.getValueType() == oatpp::Int32::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test '==' and '!=' operators");
|
||||
OATPP_LOGI(TAG, "test '==' and '!=' operators")
|
||||
oatpp::Int32 i1 = 0;
|
||||
oatpp::Int32 i2;
|
||||
|
||||
OATPP_ASSERT(i1);
|
||||
OATPP_ASSERT(i1 != nullptr);
|
||||
OATPP_ASSERT(i1 == 0);
|
||||
OATPP_ASSERT(i1 != 1);
|
||||
OATPP_ASSERT(i1)
|
||||
OATPP_ASSERT(i1 != nullptr)
|
||||
OATPP_ASSERT(i1 == 0)
|
||||
OATPP_ASSERT(i1 != 1)
|
||||
|
||||
OATPP_ASSERT(!i2);
|
||||
OATPP_ASSERT(!i2)
|
||||
OATPP_ASSERT(i2 == nullptr)
|
||||
|
||||
OATPP_ASSERT(i1 != i2);
|
||||
OATPP_ASSERT(i2 != i1);
|
||||
OATPP_ASSERT(i1 != i2)
|
||||
OATPP_ASSERT(i2 != i1)
|
||||
|
||||
i2 = 0;
|
||||
|
||||
OATPP_ASSERT(i1 == i2);
|
||||
OATPP_ASSERT(i2 == i1);
|
||||
OATPP_ASSERT(i1 == i2)
|
||||
OATPP_ASSERT(i2 == i1)
|
||||
|
||||
i1 = nullptr;
|
||||
i2 = nullptr;
|
||||
|
||||
OATPP_ASSERT(i1 == i2);
|
||||
OATPP_ASSERT(i1 == i2)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-assign operator");
|
||||
OATPP_LOGI(TAG, "test copy-assign operator")
|
||||
oatpp::Int32 i1 = 0;
|
||||
oatpp::Int32 i2;
|
||||
|
||||
OATPP_ASSERT(i1 != i2);
|
||||
OATPP_ASSERT(i1 != i2)
|
||||
|
||||
i2 = i1;
|
||||
|
||||
OATPP_ASSERT(i1 == i2);
|
||||
OATPP_ASSERT(i1.get() == i2.get());
|
||||
OATPP_ASSERT(i1 == i2)
|
||||
OATPP_ASSERT(i1.get() == i2.get())
|
||||
|
||||
i2 = 1;
|
||||
|
||||
OATPP_ASSERT(i1 != i2);
|
||||
OATPP_ASSERT(i1.get() != i2.get());
|
||||
OATPP_ASSERT(i1 != i2)
|
||||
OATPP_ASSERT(i1.get() != i2.get())
|
||||
|
||||
OATPP_ASSERT(i1 == 0);
|
||||
OATPP_ASSERT(i2 == 1);
|
||||
OATPP_ASSERT(i1 == 0)
|
||||
OATPP_ASSERT(i2 == 1)
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assign operator");
|
||||
OATPP_LOGI(TAG, "test move-assign operator")
|
||||
oatpp::Int32 i1 = 0;
|
||||
oatpp::Int32 i2;
|
||||
|
||||
OATPP_ASSERT(i1 != i2);
|
||||
OATPP_ASSERT(i1 != i2)
|
||||
|
||||
i2 = std::move(i1);
|
||||
|
||||
OATPP_ASSERT(i1 == nullptr);
|
||||
OATPP_ASSERT(i2 != nullptr);
|
||||
OATPP_ASSERT(i1 == nullptr)
|
||||
OATPP_ASSERT(i2 != nullptr)
|
||||
|
||||
OATPP_ASSERT(i2 == 0);
|
||||
OATPP_ASSERT(i2 == 0)
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assign operator");
|
||||
OATPP_LOGI(TAG, "test move-assign operator")
|
||||
oatpp::Int32 i = 0;
|
||||
v_int32 v = i;
|
||||
OATPP_ASSERT(v == i);
|
||||
OATPP_ASSERT(v == i)
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Boolean [nullptr]");
|
||||
OATPP_LOGI(TAG, "Test Boolean [nullptr]")
|
||||
oatpp::Boolean b;
|
||||
|
||||
OATPP_ASSERT(!b);
|
||||
OATPP_ASSERT(b == nullptr);
|
||||
OATPP_ASSERT(b != false);
|
||||
OATPP_ASSERT(b != true);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!b)
|
||||
OATPP_ASSERT(b == nullptr)
|
||||
OATPP_ASSERT(b != false)
|
||||
OATPP_ASSERT(b != true)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Boolean nullptr constructor");
|
||||
OATPP_LOGI(TAG, "Test Boolean nullptr constructor")
|
||||
oatpp::Boolean b = nullptr;
|
||||
|
||||
OATPP_ASSERT(!b);
|
||||
OATPP_ASSERT(b == nullptr);
|
||||
OATPP_ASSERT(b != false);
|
||||
OATPP_ASSERT(b != true);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!b)
|
||||
OATPP_ASSERT(b == nullptr)
|
||||
OATPP_ASSERT(b != false)
|
||||
OATPP_ASSERT(b != true)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Boolean [false]");
|
||||
OATPP_LOGI(TAG, "Test Boolean [false]")
|
||||
oatpp::Boolean b = false;
|
||||
|
||||
OATPP_ASSERT(!b); // <--- still !b
|
||||
OATPP_ASSERT(b != nullptr);
|
||||
OATPP_ASSERT(b == false);
|
||||
OATPP_ASSERT(b != true);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!b) // <--- still !b
|
||||
OATPP_ASSERT(b != nullptr)
|
||||
OATPP_ASSERT(b == false)
|
||||
OATPP_ASSERT(b != true)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Boolean [true]");
|
||||
OATPP_LOGI(TAG, "Test Boolean [true]")
|
||||
oatpp::Boolean b = true;
|
||||
|
||||
OATPP_ASSERT(b);
|
||||
OATPP_ASSERT(b != nullptr);
|
||||
OATPP_ASSERT(b != false);
|
||||
OATPP_ASSERT(b == true);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(b)
|
||||
OATPP_ASSERT(b != nullptr)
|
||||
OATPP_ASSERT(b != false)
|
||||
OATPP_ASSERT(b == true)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Boolean copy-assign operator");
|
||||
OATPP_LOGI(TAG, "Test Boolean copy-assign operator")
|
||||
oatpp::Boolean b1 = true;
|
||||
oatpp::Boolean b2;
|
||||
|
||||
b2 = b1;
|
||||
|
||||
OATPP_ASSERT(b2);
|
||||
OATPP_ASSERT(b1);
|
||||
OATPP_ASSERT(b1 == b2);
|
||||
OATPP_ASSERT(b1.get() == b2.get());
|
||||
OATPP_ASSERT(b2)
|
||||
OATPP_ASSERT(b1)
|
||||
OATPP_ASSERT(b1 == b2)
|
||||
OATPP_ASSERT(b1.get() == b2.get())
|
||||
|
||||
b2 = false;
|
||||
|
||||
OATPP_ASSERT(b1.get() != b2.get());
|
||||
OATPP_ASSERT(b1 != b2);
|
||||
OATPP_ASSERT(b2 != b1);
|
||||
OATPP_ASSERT(b1.get() != b2.get())
|
||||
OATPP_ASSERT(b1 != b2)
|
||||
OATPP_ASSERT(b2 != b1)
|
||||
|
||||
b1 = false;
|
||||
b2 = nullptr;
|
||||
|
||||
OATPP_ASSERT(b1 != b2);
|
||||
OATPP_ASSERT(b2 != b1);
|
||||
OATPP_ASSERT(b1 != b2)
|
||||
OATPP_ASSERT(b2 != b1)
|
||||
|
||||
b1 = nullptr;
|
||||
b2 = nullptr;
|
||||
|
||||
OATPP_ASSERT(b1 == b2);
|
||||
OATPP_ASSERT(b1 == b2)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Test Boolean move-assign operator");
|
||||
OATPP_LOGI(TAG, "Test Boolean move-assign operator")
|
||||
oatpp::Boolean b1 = true;
|
||||
oatpp::Boolean b2;
|
||||
|
||||
b2 = std::move(b1);
|
||||
|
||||
OATPP_ASSERT(b2 != nullptr);
|
||||
OATPP_ASSERT(b1 == nullptr);
|
||||
OATPP_ASSERT(b2 != nullptr)
|
||||
OATPP_ASSERT(b1 == nullptr)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "check default value");
|
||||
OATPP_LOGI(TAG, "check default value")
|
||||
oatpp::UInt8 s0;
|
||||
oatpp::UInt8 s1 = 255;
|
||||
OATPP_ASSERT(s0.getValue(128) == 128)
|
||||
|
@ -38,230 +38,230 @@ void StringTest::onRun() {
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor");
|
||||
OATPP_LOGI(TAG, "test default constructor")
|
||||
oatpp::String s;
|
||||
OATPP_ASSERT(!s);
|
||||
OATPP_ASSERT(s == nullptr);
|
||||
OATPP_ASSERT(s == static_cast<const char*>(nullptr));
|
||||
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!s)
|
||||
OATPP_ASSERT(s == nullptr)
|
||||
OATPP_ASSERT(s == static_cast<const char*>(nullptr))
|
||||
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test nullptr constructor");
|
||||
OATPP_LOGI(TAG, "test nullptr constructor")
|
||||
oatpp::String s(nullptr);
|
||||
OATPP_ASSERT(!s);
|
||||
OATPP_ASSERT(s == nullptr);
|
||||
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!s)
|
||||
OATPP_ASSERT(s == nullptr)
|
||||
OATPP_ASSERT(s.getValueType() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test const char* constructor");
|
||||
OATPP_LOGI(TAG, "test const char* constructor")
|
||||
oatpp::String s("abc\0xyz");
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 3);
|
||||
OATPP_ASSERT(s == "abc");
|
||||
OATPP_ASSERT(s == "abc\0xyz");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 3)
|
||||
OATPP_ASSERT(s == "abc")
|
||||
OATPP_ASSERT(s == "abc\0xyz")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test std::string constructor");
|
||||
OATPP_LOGI(TAG, "test std::string constructor")
|
||||
std::string a("abc\0xyz", 7);
|
||||
oatpp::String s(a);
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 7);
|
||||
OATPP_ASSERT(s != "abc");
|
||||
OATPP_ASSERT(s != "abc\0xyz");
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7));
|
||||
OATPP_ASSERT(s == a);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 7)
|
||||
OATPP_ASSERT(s != "abc")
|
||||
OATPP_ASSERT(s != "abc\0xyz")
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7))
|
||||
OATPP_ASSERT(s == a)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test std::string move constructor");
|
||||
OATPP_LOGI(TAG, "test std::string move constructor")
|
||||
std::string a("abc\0xyz", 7);
|
||||
oatpp::String s(std::move(a));
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 7);
|
||||
OATPP_ASSERT(s != "abc");
|
||||
OATPP_ASSERT(s != "abc\0xyz");
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7));
|
||||
OATPP_ASSERT(a == "");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 7)
|
||||
OATPP_ASSERT(s != "abc")
|
||||
OATPP_ASSERT(s != "abc\0xyz")
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7))
|
||||
OATPP_ASSERT(a == "")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test const char* assign operator");
|
||||
OATPP_LOGI(TAG, "test const char* assign operator")
|
||||
oatpp::String s;
|
||||
s = "abc\0xyz";
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 3);
|
||||
OATPP_ASSERT(s == "abc");
|
||||
OATPP_ASSERT(s == "abc\0xyz");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 3)
|
||||
OATPP_ASSERT(s == "abc")
|
||||
OATPP_ASSERT(s == "abc\0xyz")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test std::string assign operator");
|
||||
OATPP_LOGI(TAG, "test std::string assign operator")
|
||||
oatpp::String s;
|
||||
std::string a = std::string("abc\0xyz", 7);
|
||||
s = a;
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 7);
|
||||
OATPP_ASSERT(s != "abc");
|
||||
OATPP_ASSERT(s != "abc\0xyz");
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7));
|
||||
OATPP_ASSERT(s == a);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 7)
|
||||
OATPP_ASSERT(s != "abc")
|
||||
OATPP_ASSERT(s != "abc\0xyz")
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7))
|
||||
OATPP_ASSERT(s == a)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test std::string move assign operator");
|
||||
OATPP_LOGI(TAG, "test std::string move assign operator")
|
||||
oatpp::String s;
|
||||
std::string a = std::string("abc\0xyz", 7);
|
||||
s = std::move(a);
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 7);
|
||||
OATPP_ASSERT(s != "abc");
|
||||
OATPP_ASSERT(s != "abc\0xyz");
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7));
|
||||
OATPP_ASSERT(a == "");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 7)
|
||||
OATPP_ASSERT(s != "abc")
|
||||
OATPP_ASSERT(s != "abc\0xyz")
|
||||
OATPP_ASSERT(s == std::string("abc\0xyz", 7))
|
||||
OATPP_ASSERT(a == "")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test const char* implicit constructor");
|
||||
OATPP_LOGI(TAG, "test const char* implicit constructor")
|
||||
oatpp::String s = "";
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s->size() == 0);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s->size() == 0)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test '==', '!=' operators");
|
||||
OATPP_LOGI(TAG, "test '==', '!=' operators")
|
||||
oatpp::String s1 = "a";
|
||||
oatpp::String s2;
|
||||
|
||||
OATPP_ASSERT(s1 != s2);
|
||||
OATPP_ASSERT(s2 != s1);
|
||||
OATPP_ASSERT(s1 != s2)
|
||||
OATPP_ASSERT(s2 != s1)
|
||||
|
||||
OATPP_ASSERT(s1 == "a");
|
||||
OATPP_ASSERT(s1 != "aa");
|
||||
OATPP_ASSERT(s1 != "");
|
||||
OATPP_ASSERT(s1 == "a")
|
||||
OATPP_ASSERT(s1 != "aa")
|
||||
OATPP_ASSERT(s1 != "")
|
||||
|
||||
s2 = "aa";
|
||||
|
||||
OATPP_ASSERT(s1 != s2);
|
||||
OATPP_ASSERT(s2 != s1);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s1 != s2)
|
||||
OATPP_ASSERT(s2 != s1)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-asssign operator");
|
||||
OATPP_LOGI(TAG, "test copy-asssign operator")
|
||||
oatpp::String s1 = "s1";
|
||||
oatpp::String s2;
|
||||
|
||||
s2 = s1;
|
||||
|
||||
OATPP_ASSERT(s1 == s2);
|
||||
OATPP_ASSERT(s1.get() == s2.get());
|
||||
OATPP_ASSERT(s1 == s2)
|
||||
OATPP_ASSERT(s1.get() == s2.get())
|
||||
|
||||
s1 = "s2";
|
||||
|
||||
OATPP_ASSERT(s1 != s2);
|
||||
OATPP_ASSERT(s2 != s1);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s1 != s2)
|
||||
OATPP_ASSERT(s2 != s1)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test const char* assign operator");
|
||||
OATPP_LOGI(TAG, "test const char* assign operator")
|
||||
oatpp::String s1 = "s1";
|
||||
oatpp::String s2(s1);
|
||||
|
||||
OATPP_ASSERT(s1 == s2);
|
||||
OATPP_ASSERT(s1.get() == s2.get());
|
||||
OATPP_ASSERT(s1 == s2)
|
||||
OATPP_ASSERT(s1.get() == s2.get())
|
||||
|
||||
s1 = "s2";
|
||||
|
||||
OATPP_ASSERT(s1 != s2);
|
||||
OATPP_ASSERT(s2 != s1);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s1 != s2)
|
||||
OATPP_ASSERT(s2 != s1)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move assign operator");
|
||||
OATPP_LOGI(TAG, "test move assign operator")
|
||||
oatpp::String s1 = "s1";
|
||||
oatpp::String s2;
|
||||
|
||||
s2 = std::move(s1);
|
||||
|
||||
OATPP_ASSERT(s1 == nullptr);
|
||||
OATPP_ASSERT(s2 != nullptr);
|
||||
OATPP_ASSERT(s2 == "s1");
|
||||
OATPP_ASSERT(s1 == nullptr)
|
||||
OATPP_ASSERT(s2 != nullptr)
|
||||
OATPP_ASSERT(s2 == "s1")
|
||||
|
||||
OATPP_ASSERT(s1 != s2);
|
||||
OATPP_ASSERT(s1.get() != s2.get());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s1 != s2)
|
||||
OATPP_ASSERT(s1.get() != s2.get())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test compareCI_ASCII methods 1");
|
||||
OATPP_LOGI(TAG, "test compareCI_ASCII methods 1")
|
||||
|
||||
oatpp::String s1 = "hello";
|
||||
|
||||
{
|
||||
oatpp::String s2;
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
const char* s2 = nullptr;
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test compareCI_ASCII methods 2");
|
||||
OATPP_LOGI(TAG, "test compareCI_ASCII methods 2")
|
||||
|
||||
oatpp::String s1;
|
||||
|
||||
{
|
||||
oatpp::String s2 = "hello";
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
std::string s2 = "hello";
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
const char* s2 = "hello";
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(!s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
oatpp::String s2;
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
const char* s2 = nullptr;
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(nullptr));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(nullptr))
|
||||
}
|
||||
|
||||
{
|
||||
@ -270,44 +270,44 @@ void StringTest::onRun() {
|
||||
|
||||
try {
|
||||
std::string s2 = s1;
|
||||
} catch (const std::runtime_error& e) {
|
||||
} catch (const std::runtime_error&) {
|
||||
exceptionThrown = true;
|
||||
}
|
||||
|
||||
OATPP_ASSERT(exceptionThrown);
|
||||
OATPP_ASSERT(exceptionThrown)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test compareCI_ASCII methods 3");
|
||||
OATPP_LOGI(TAG, "test compareCI_ASCII methods 3")
|
||||
|
||||
oatpp::String s1 = "hello";
|
||||
|
||||
{
|
||||
oatpp::String s2 = "HELLO";
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
std::string s2 = "HELLO";
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
const char* s2 = "HELLO";
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII(s2))
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII("HELLO"));
|
||||
OATPP_ASSERT(s1.equalsCI_ASCII("HELLO"))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "check default value");
|
||||
OATPP_LOGI(TAG, "check default value")
|
||||
oatpp::String s0;
|
||||
oatpp::String s1 = "hello";
|
||||
OATPP_ASSERT(s0.getValue("def") == "def")
|
||||
|
@ -36,7 +36,7 @@ namespace {
|
||||
|
||||
class TestDto : public oatpp::DTO {
|
||||
|
||||
DTO_INIT(TestDto, DTO);
|
||||
DTO_INIT(TestDto, DTO)
|
||||
|
||||
DTO_FIELD(String, field_string);
|
||||
DTO_FIELD(Int8, field_int8);
|
||||
@ -68,53 +68,53 @@ void TypeTest::onRun() {
|
||||
|
||||
auto obj = TestDto::createShared();
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_string.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_string.getValueType()->classId == oatpp::data::mapping::type::__class::String::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_string.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_string.getValueType()->classId == oatpp::data::mapping::type::__class::String::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int8.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_int8.getValueType()->classId == oatpp::data::mapping::type::__class::Int8::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int8.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int8.getValueType()->classId == oatpp::data::mapping::type::__class::Int8::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int16.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_int16.getValueType()->classId == oatpp::data::mapping::type::__class::Int16::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int16.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int16.getValueType()->classId == oatpp::data::mapping::type::__class::Int16::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int32.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_int32.getValueType()->classId == oatpp::data::mapping::type::__class::Int32::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int32.getValueType()->classId == oatpp::data::mapping::type::__class::Int32::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int64.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_int64.getValueType()->classId == oatpp::data::mapping::type::__class::Int64::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_int64.getValueType()->classId == oatpp::data::mapping::type::__class::Int64::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float32.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_float32.getValueType()->classId == oatpp::data::mapping::type::__class::Float32::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_float32.getValueType()->classId == oatpp::data::mapping::type::__class::Float32::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float64.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_float64.getValueType()->classId == oatpp::data::mapping::type::__class::Float64::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_float64.getValueType()->classId == oatpp::data::mapping::type::__class::Float64::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_boolean.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_boolean.getValueType()->classId == oatpp::data::mapping::type::__class::Boolean::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_boolean.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_boolean.getValueType()->classId == oatpp::data::mapping::type::__class::Boolean::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_string.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_list_string.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_string.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_string.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int32.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_list_int32.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_int32.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int64.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_list_int64.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_int64.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float32.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_list_float32.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float32.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_float32.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float64.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_list_float64.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float64.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_float64.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_boolean.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_list_boolean.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_boolean.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_list_boolean.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_map_string_string.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->field_map_string_string.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_map_string_string.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->field_map_string_string.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractPairList::CLASS_ID)
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->obj1.getValueType()->classId.name);
|
||||
OATPP_ASSERT(obj->obj1.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->obj1.getValueType()->classId.name)
|
||||
OATPP_ASSERT(obj->obj1.getValueType()->classId == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID)
|
||||
|
||||
OATPP_ASSERT(oatpp::String::Class::getType()->extends(oatpp::String::Class::getType()))
|
||||
OATPP_ASSERT(oatpp::Int32::Class::getType()->extends(oatpp::Int32::Class::getType()))
|
||||
|
@ -31,117 +31,117 @@ namespace oatpp { namespace test { namespace core { namespace data { namespace m
|
||||
void UnorderedMapTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor...");
|
||||
OATPP_LOGI(TAG, "test default constructor...")
|
||||
oatpp::UnorderedFields<String> map;
|
||||
|
||||
OATPP_ASSERT(!map);
|
||||
OATPP_ASSERT(map == nullptr);
|
||||
OATPP_ASSERT(!map)
|
||||
OATPP_ASSERT(map == nullptr)
|
||||
|
||||
OATPP_ASSERT(map.get() == nullptr);
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2);
|
||||
OATPP_ASSERT(map.get() == nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2)
|
||||
auto it = map.getValueType()->params.begin();
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...");
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...")
|
||||
oatpp::UnorderedFields<String> map({});
|
||||
|
||||
OATPP_ASSERT(map);
|
||||
OATPP_ASSERT(map != nullptr);
|
||||
OATPP_ASSERT(map->size() == 0);
|
||||
OATPP_ASSERT(map)
|
||||
OATPP_ASSERT(map != nullptr)
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr);
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2);
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_ASSERT(map.getValueType()->params.size() == 2)
|
||||
auto it = map.getValueType()->params.begin();
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_ASSERT(*it++ == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test createShared()...");
|
||||
OATPP_LOGI(TAG, "test createShared()...")
|
||||
oatpp::UnorderedFields<String> map = oatpp::UnorderedFields<String>::createShared();
|
||||
|
||||
OATPP_ASSERT(map);
|
||||
OATPP_ASSERT(map != nullptr);
|
||||
OATPP_ASSERT(map->size() == 0);
|
||||
OATPP_ASSERT(map)
|
||||
OATPP_ASSERT(map != nullptr)
|
||||
OATPP_ASSERT(map->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map.get() != nullptr);
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map.get() != nullptr)
|
||||
OATPP_ASSERT(map.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...")
|
||||
oatpp::UnorderedFields<String> map1({});
|
||||
oatpp::UnorderedFields<String> map2;
|
||||
|
||||
map2 = map1;
|
||||
|
||||
OATPP_ASSERT(map1);
|
||||
OATPP_ASSERT(map2);
|
||||
OATPP_ASSERT(map1)
|
||||
OATPP_ASSERT(map2)
|
||||
|
||||
OATPP_ASSERT(map1->size() == 0);
|
||||
OATPP_ASSERT(map2->size() == 0);
|
||||
OATPP_ASSERT(map1->size() == 0)
|
||||
OATPP_ASSERT(map2->size() == 0)
|
||||
|
||||
OATPP_ASSERT(map1.get() == map2.get());
|
||||
OATPP_ASSERT(map1.get() == map2.get())
|
||||
|
||||
map2->insert({"key", "a"});
|
||||
|
||||
OATPP_ASSERT(map1->size() == 1);
|
||||
OATPP_ASSERT(map2->size() == 1);
|
||||
OATPP_ASSERT(map1->size() == 1)
|
||||
OATPP_ASSERT(map2->size() == 1)
|
||||
|
||||
map2 = {{"key1", "b"}, {"key2", "c"}};
|
||||
|
||||
OATPP_ASSERT(map1->size() == 1);
|
||||
OATPP_ASSERT(map2->size() == 2);
|
||||
OATPP_ASSERT(map1->size() == 1)
|
||||
OATPP_ASSERT(map2->size() == 2)
|
||||
|
||||
OATPP_ASSERT(map2["key1"] == "b");
|
||||
OATPP_ASSERT(map2["key2"] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map2["key1"] == "b")
|
||||
OATPP_ASSERT(map2["key2"] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...")
|
||||
oatpp::UnorderedFields<String> map1({});
|
||||
oatpp::UnorderedFields<String> map2;
|
||||
|
||||
map2 = std::move(map1);
|
||||
|
||||
OATPP_ASSERT(!map1);
|
||||
OATPP_ASSERT(map2);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!map1)
|
||||
OATPP_ASSERT(map2)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test get element by index...");
|
||||
OATPP_LOGI(TAG, "test get element by index...")
|
||||
oatpp::UnorderedFields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
|
||||
|
||||
OATPP_ASSERT(map);
|
||||
OATPP_ASSERT(map != nullptr);
|
||||
OATPP_ASSERT(map->size() == 3);
|
||||
OATPP_ASSERT(map)
|
||||
OATPP_ASSERT(map != nullptr)
|
||||
OATPP_ASSERT(map->size() == 3)
|
||||
|
||||
OATPP_ASSERT(map["key1"] == "a");
|
||||
OATPP_ASSERT(map["key2"] == "b");
|
||||
OATPP_ASSERT(map["key3"] == "c");
|
||||
OATPP_ASSERT(map["key1"] == "a")
|
||||
OATPP_ASSERT(map["key2"] == "b")
|
||||
OATPP_ASSERT(map["key3"] == "c")
|
||||
|
||||
map["key2"] = "Hello!";
|
||||
|
||||
OATPP_ASSERT(map->size() == 3);
|
||||
OATPP_ASSERT(map->size() == 3)
|
||||
|
||||
OATPP_ASSERT(map["key1"] == "a");
|
||||
OATPP_ASSERT(map["key2"] == "Hello!");
|
||||
OATPP_ASSERT(map["key3"] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map["key1"] == "a")
|
||||
OATPP_ASSERT(map["key2"] == "Hello!")
|
||||
OATPP_ASSERT(map["key3"] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...");
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::UnorderedFields<String> map = {{"key1", "a"}, {"key2", "b"}, {"key3", "c"}};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::mapping::type::__class::Map::PolymorphicDispatcher*>(
|
||||
@ -150,12 +150,12 @@ void UnorderedMapTest::onRun() {
|
||||
|
||||
polymorphicDispatcher->addItem(map, oatpp::String("key1"), oatpp::String("d"));
|
||||
|
||||
OATPP_ASSERT(map->size() == 3);
|
||||
OATPP_ASSERT(map->size() == 3)
|
||||
|
||||
OATPP_ASSERT(map["key1"] == "d");
|
||||
OATPP_ASSERT(map["key2"] == "b");
|
||||
OATPP_ASSERT(map["key3"] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(map["key1"] == "d")
|
||||
OATPP_ASSERT(map["key2"] == "b")
|
||||
OATPP_ASSERT(map["key3"] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,92 +32,92 @@ void UnorderedSetTest::onRun() {
|
||||
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor...");
|
||||
OATPP_LOGI(TAG, "test default constructor...")
|
||||
oatpp::UnorderedSet<oatpp::String> set;
|
||||
|
||||
OATPP_ASSERT(!set);
|
||||
OATPP_ASSERT(set == nullptr);
|
||||
OATPP_ASSERT(!set)
|
||||
OATPP_ASSERT(set == nullptr)
|
||||
|
||||
OATPP_ASSERT(set.get() == nullptr);
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
|
||||
OATPP_ASSERT(set.getValueType()->params.size() == 1);
|
||||
OATPP_ASSERT(set.getValueType()->params.front() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(set.get() == nullptr)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_ASSERT(set.getValueType()->params.size() == 1)
|
||||
OATPP_ASSERT(set.getValueType()->params.front() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...");
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...")
|
||||
oatpp::UnorderedSet<oatpp::String> set({});
|
||||
|
||||
OATPP_ASSERT(set);
|
||||
OATPP_ASSERT(set != nullptr);
|
||||
OATPP_ASSERT(set->size() == 0);
|
||||
OATPP_ASSERT(set)
|
||||
OATPP_ASSERT(set != nullptr)
|
||||
OATPP_ASSERT(set->size() == 0)
|
||||
|
||||
OATPP_ASSERT(set.get() != nullptr);
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
|
||||
OATPP_ASSERT(set.getValueType()->params.size() == 1);
|
||||
OATPP_ASSERT(set.getValueType()->params.front() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(set.get() != nullptr)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_ASSERT(set.getValueType()->params.size() == 1)
|
||||
OATPP_ASSERT(set.getValueType()->params.front() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test createShared()...");
|
||||
OATPP_LOGI(TAG, "test createShared()...")
|
||||
oatpp::UnorderedSet<oatpp::String> set = oatpp::UnorderedSet<oatpp::String>::createShared();
|
||||
|
||||
OATPP_ASSERT(set);
|
||||
OATPP_ASSERT(set != nullptr);
|
||||
OATPP_ASSERT(set->size() == 0);
|
||||
OATPP_ASSERT(set)
|
||||
OATPP_ASSERT(set != nullptr)
|
||||
OATPP_ASSERT(set->size() == 0)
|
||||
|
||||
OATPP_ASSERT(set.get() != nullptr);
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(set.get() != nullptr)
|
||||
OATPP_ASSERT(set.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...")
|
||||
oatpp::UnorderedSet<oatpp::String> set1({});
|
||||
oatpp::UnorderedSet<oatpp::String> set2;
|
||||
|
||||
set2 = set1;
|
||||
|
||||
OATPP_ASSERT(set1);
|
||||
OATPP_ASSERT(set2);
|
||||
OATPP_ASSERT(set1)
|
||||
OATPP_ASSERT(set2)
|
||||
|
||||
OATPP_ASSERT(set1->size() == 0);
|
||||
OATPP_ASSERT(set2->size() == 0);
|
||||
OATPP_ASSERT(set1->size() == 0)
|
||||
OATPP_ASSERT(set2->size() == 0)
|
||||
|
||||
OATPP_ASSERT(set1.get() == set2.get());
|
||||
OATPP_ASSERT(set1.get() == set2.get())
|
||||
|
||||
set2->insert("a");
|
||||
|
||||
OATPP_ASSERT(set1->size() == 1);
|
||||
OATPP_ASSERT(set2->size() == 1);
|
||||
OATPP_ASSERT(set1->size() == 1)
|
||||
OATPP_ASSERT(set2->size() == 1)
|
||||
|
||||
set2 = {"b", "c"};
|
||||
|
||||
OATPP_ASSERT(set1->size() == 1);
|
||||
OATPP_ASSERT(set2->size() == 2);
|
||||
OATPP_ASSERT(set1->size() == 1)
|
||||
OATPP_ASSERT(set2->size() == 2)
|
||||
|
||||
OATPP_ASSERT(set2["b"] == true);
|
||||
OATPP_ASSERT(set2["c"] == true);
|
||||
OATPP_ASSERT(set2["b"] == true)
|
||||
OATPP_ASSERT(set2["c"] == true)
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...")
|
||||
oatpp::UnorderedSet<oatpp::String> set1({});
|
||||
oatpp::UnorderedSet<oatpp::String> set2;
|
||||
|
||||
set2 = std::move(set1);
|
||||
|
||||
OATPP_ASSERT(!set1);
|
||||
OATPP_ASSERT(set2);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!set1)
|
||||
OATPP_ASSERT(set2)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...");
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::UnorderedSet<oatpp::String> set = {"a", "b", "c"};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const typename oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
@ -130,13 +130,13 @@ void UnorderedSetTest::onRun() {
|
||||
|
||||
polymorphicDispatcher->addItem(set, oatpp::String("d"));
|
||||
|
||||
OATPP_ASSERT(set->size() == 4);
|
||||
OATPP_ASSERT(set->size() == 4)
|
||||
|
||||
OATPP_ASSERT(set["a"]);
|
||||
OATPP_ASSERT(set["b"]);
|
||||
OATPP_ASSERT(set["c"]);
|
||||
OATPP_ASSERT(set["d"]);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(set["a"])
|
||||
OATPP_ASSERT(set["b"])
|
||||
OATPP_ASSERT(set["c"])
|
||||
OATPP_ASSERT(set["d"])
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,113 +31,113 @@ namespace oatpp { namespace test { namespace core { namespace data { namespace m
|
||||
void VectorTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test default constructor...");
|
||||
OATPP_LOGI(TAG, "test default constructor...")
|
||||
oatpp::Vector<oatpp::String> vector;
|
||||
|
||||
OATPP_ASSERT(!vector);
|
||||
OATPP_ASSERT(vector == nullptr);
|
||||
OATPP_ASSERT(!vector)
|
||||
OATPP_ASSERT(vector == nullptr)
|
||||
|
||||
OATPP_ASSERT(vector.get() == nullptr);
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
|
||||
OATPP_ASSERT(vector.getValueType()->params.size() == 1);
|
||||
OATPP_ASSERT(vector.getValueType()->params.front() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(vector.get() == nullptr)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_ASSERT(vector.getValueType()->params.size() == 1)
|
||||
OATPP_ASSERT(vector.getValueType()->params.front() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...");
|
||||
OATPP_LOGI(TAG, "test empty ilist constructor...")
|
||||
oatpp::Vector<oatpp::String> vector({});
|
||||
|
||||
OATPP_ASSERT(vector);
|
||||
OATPP_ASSERT(vector != nullptr);
|
||||
OATPP_ASSERT(vector->size() == 0);
|
||||
OATPP_ASSERT(vector)
|
||||
OATPP_ASSERT(vector != nullptr)
|
||||
OATPP_ASSERT(vector->size() == 0)
|
||||
|
||||
OATPP_ASSERT(vector.get() != nullptr);
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
|
||||
OATPP_ASSERT(vector.getValueType()->params.size() == 1);
|
||||
OATPP_ASSERT(vector.getValueType()->params.front() == oatpp::String::Class::getType());
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(vector.get() != nullptr)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_ASSERT(vector.getValueType()->params.size() == 1)
|
||||
OATPP_ASSERT(vector.getValueType()->params.front() == oatpp::String::Class::getType())
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test createShared()...");
|
||||
OATPP_LOGI(TAG, "test createShared()...")
|
||||
oatpp::Vector<oatpp::String> vector = oatpp::Vector<oatpp::String>::createShared();
|
||||
|
||||
OATPP_ASSERT(vector);
|
||||
OATPP_ASSERT(vector != nullptr);
|
||||
OATPP_ASSERT(vector->size() == 0);
|
||||
OATPP_ASSERT(vector)
|
||||
OATPP_ASSERT(vector != nullptr)
|
||||
OATPP_ASSERT(vector->size() == 0)
|
||||
|
||||
OATPP_ASSERT(vector.get() != nullptr);
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(vector.get() != nullptr)
|
||||
OATPP_ASSERT(vector.getValueType()->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID.id)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test copy-assignment operator...")
|
||||
oatpp::Vector<oatpp::String> vector1({});
|
||||
oatpp::Vector<oatpp::String> vector2;
|
||||
|
||||
vector2 = vector1;
|
||||
|
||||
OATPP_ASSERT(vector1);
|
||||
OATPP_ASSERT(vector2);
|
||||
OATPP_ASSERT(vector1)
|
||||
OATPP_ASSERT(vector2)
|
||||
|
||||
OATPP_ASSERT(vector1->size() == 0);
|
||||
OATPP_ASSERT(vector2->size() == 0);
|
||||
OATPP_ASSERT(vector1->size() == 0)
|
||||
OATPP_ASSERT(vector2->size() == 0)
|
||||
|
||||
OATPP_ASSERT(vector1.get() == vector2.get());
|
||||
OATPP_ASSERT(vector1.get() == vector2.get())
|
||||
|
||||
vector2->push_back("a");
|
||||
|
||||
OATPP_ASSERT(vector1->size() == 1);
|
||||
OATPP_ASSERT(vector2->size() == 1);
|
||||
OATPP_ASSERT(vector1->size() == 1)
|
||||
OATPP_ASSERT(vector2->size() == 1)
|
||||
|
||||
vector2 = {"b", "c"};
|
||||
|
||||
OATPP_ASSERT(vector1->size() == 1);
|
||||
OATPP_ASSERT(vector2->size() == 2);
|
||||
OATPP_ASSERT(vector1->size() == 1)
|
||||
OATPP_ASSERT(vector2->size() == 2)
|
||||
|
||||
OATPP_ASSERT(vector2[0] == "b");
|
||||
OATPP_ASSERT(vector2[1] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(vector2[0] == "b")
|
||||
OATPP_ASSERT(vector2[1] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...");
|
||||
OATPP_LOGI(TAG, "test move-assignment operator...")
|
||||
oatpp::Vector<oatpp::String> vector1({});
|
||||
oatpp::Vector<oatpp::String> vector2;
|
||||
|
||||
vector2 = std::move(vector1);
|
||||
|
||||
OATPP_ASSERT(!vector1);
|
||||
OATPP_ASSERT(vector2);
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!vector1)
|
||||
OATPP_ASSERT(vector2)
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test get element by index...");
|
||||
OATPP_LOGI(TAG, "test get element by index...")
|
||||
oatpp::Vector<oatpp::String> vector = {"a", "b", "c"};
|
||||
|
||||
OATPP_ASSERT(vector);
|
||||
OATPP_ASSERT(vector != nullptr);
|
||||
OATPP_ASSERT(vector->size() == 3);
|
||||
OATPP_ASSERT(vector)
|
||||
OATPP_ASSERT(vector != nullptr)
|
||||
OATPP_ASSERT(vector->size() == 3)
|
||||
|
||||
OATPP_ASSERT(vector[0] == "a");
|
||||
OATPP_ASSERT(vector[1] == "b");
|
||||
OATPP_ASSERT(vector[2] == "c");
|
||||
OATPP_ASSERT(vector[0] == "a")
|
||||
OATPP_ASSERT(vector[1] == "b")
|
||||
OATPP_ASSERT(vector[2] == "c")
|
||||
|
||||
vector[1] = "Hello!";
|
||||
|
||||
OATPP_ASSERT(vector->size() == 3);
|
||||
OATPP_ASSERT(vector->size() == 3)
|
||||
|
||||
OATPP_ASSERT(vector[0] == "a");
|
||||
OATPP_ASSERT(vector[1] == "Hello!");
|
||||
OATPP_ASSERT(vector[2] == "c");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(vector[0] == "a")
|
||||
OATPP_ASSERT(vector[1] == "Hello!")
|
||||
OATPP_ASSERT(vector[2] == "c")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...");
|
||||
OATPP_LOGI(TAG, "test polymorphicDispatcher...")
|
||||
oatpp::Vector<oatpp::String> vector = {"a", "b", "c"};
|
||||
|
||||
auto polymorphicDispatcher = static_cast<const oatpp::data::mapping::type::__class::Collection::PolymorphicDispatcher*>(
|
||||
@ -146,13 +146,13 @@ void VectorTest::onRun() {
|
||||
|
||||
polymorphicDispatcher->addItem(vector, oatpp::String("d"));
|
||||
|
||||
OATPP_ASSERT(vector->size() == 4);
|
||||
OATPP_ASSERT(vector->size() == 4)
|
||||
|
||||
OATPP_ASSERT(vector[0] == "a");
|
||||
OATPP_ASSERT(vector[1] == "b");
|
||||
OATPP_ASSERT(vector[2] == "c");
|
||||
OATPP_ASSERT(vector[3] == "d");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(vector[0] == "a")
|
||||
OATPP_ASSERT(vector[1] == "b")
|
||||
OATPP_ASSERT(vector[2] == "c")
|
||||
OATPP_ASSERT(vector[3] == "d")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,29 +53,29 @@ void LazyStringMapTest::onRun() {
|
||||
oatpp::String s1 = map.get("key1");
|
||||
oatpp::String s2 = map.get("key2");
|
||||
|
||||
OATPP_ASSERT(s1 == "Hello");
|
||||
OATPP_ASSERT(s2 == "World!");
|
||||
OATPP_ASSERT(s1 == "Hello")
|
||||
OATPP_ASSERT(s2 == "World!")
|
||||
|
||||
oatpp::String s12 = map.get("key1");
|
||||
oatpp::String s22 = map.get("key2");
|
||||
|
||||
OATPP_ASSERT(s1.get() == s12.get());
|
||||
OATPP_ASSERT(s2.get() == s22.get());
|
||||
OATPP_ASSERT(s1.get() == s12.get())
|
||||
OATPP_ASSERT(s2.get() == s22.get())
|
||||
|
||||
OATPP_ASSERT(map.get("KEY1") == nullptr);
|
||||
OATPP_ASSERT(map.get("KEY2") == nullptr);
|
||||
OATPP_ASSERT(map.get("KEY1") == nullptr)
|
||||
OATPP_ASSERT(map.get("KEY2") == nullptr)
|
||||
|
||||
auto all = map.getAll();
|
||||
|
||||
auto s13 = all["key1"];
|
||||
auto s23 = all["key2"];
|
||||
|
||||
OATPP_ASSERT(s13.getData() == s1->data() && s13.getSize() == static_cast<v_buff_size>(s1->size()));
|
||||
OATPP_ASSERT(s23.getData() == s2->data() && s23.getSize() == static_cast<v_buff_size>(s2->size()));
|
||||
OATPP_ASSERT(s1.get() == s13.getMemoryHandle().get());
|
||||
OATPP_ASSERT(s2.get() == s23.getMemoryHandle().get());
|
||||
OATPP_ASSERT(s13.getData() == s1->data() && s13.getSize() == static_cast<v_buff_size>(s1->size()))
|
||||
OATPP_ASSERT(s23.getData() == s2->data() && s23.getSize() == static_cast<v_buff_size>(s2->size()))
|
||||
OATPP_ASSERT(s1.get() == s13.getMemoryHandle().get())
|
||||
OATPP_ASSERT(s2.get() == s23.getMemoryHandle().get())
|
||||
|
||||
OATPP_ASSERT(map.getSize() == 2);
|
||||
OATPP_ASSERT(map.getSize() == 2)
|
||||
|
||||
}
|
||||
|
||||
@ -89,26 +89,26 @@ void LazyStringMapTest::onRun() {
|
||||
auto s01 = map.getAsMemoryLabel_Unsafe<StringKeyLabel>("key1");
|
||||
auto s02 = map.getAsMemoryLabel_Unsafe<StringKeyLabel>("key2");
|
||||
|
||||
OATPP_ASSERT(s01 == "Hello");
|
||||
OATPP_ASSERT(s02 == "World!");
|
||||
OATPP_ASSERT(s01 == "Hello")
|
||||
OATPP_ASSERT(s02 == "World!")
|
||||
|
||||
OATPP_ASSERT(s01.getMemoryHandle() == nullptr);
|
||||
OATPP_ASSERT(s02.getMemoryHandle() == nullptr);
|
||||
OATPP_ASSERT(s01.getMemoryHandle() == nullptr)
|
||||
OATPP_ASSERT(s02.getMemoryHandle() == nullptr)
|
||||
|
||||
auto s1 = map.getAsMemoryLabel<StringKeyLabel>("key1");
|
||||
auto s2 = map.getAsMemoryLabel<StringKeyLabel>("key2");
|
||||
|
||||
OATPP_ASSERT(s1 == "Hello");
|
||||
OATPP_ASSERT(s2 == "World!");
|
||||
OATPP_ASSERT(s1 == "Hello")
|
||||
OATPP_ASSERT(s2 == "World!")
|
||||
|
||||
oatpp::String s12 = map.get("key1");
|
||||
oatpp::String s22 = map.get("key2");
|
||||
|
||||
OATPP_ASSERT(s1.getMemoryHandle().get() == s12.get());
|
||||
OATPP_ASSERT(s2.getMemoryHandle().get() == s22.get());
|
||||
OATPP_ASSERT(s1.getMemoryHandle().get() == s12.get())
|
||||
OATPP_ASSERT(s2.getMemoryHandle().get() == s22.get())
|
||||
|
||||
OATPP_ASSERT(map.getAsMemoryLabel<StringKeyLabel>("KEY1") == s1);
|
||||
OATPP_ASSERT(map.getAsMemoryLabel<StringKeyLabel>("KEY2") == s2);
|
||||
OATPP_ASSERT(map.getAsMemoryLabel<StringKeyLabel>("KEY1") == s1)
|
||||
OATPP_ASSERT(map.getAsMemoryLabel<StringKeyLabel>("KEY2") == s2)
|
||||
|
||||
}
|
||||
|
||||
@ -120,13 +120,13 @@ void LazyStringMapTest::onRun() {
|
||||
map1.put("key1", StringKeyLabel(nullptr, text, 5));
|
||||
map1.put("key2", StringKeyLabel(nullptr, text + 6, 6));
|
||||
|
||||
OATPP_ASSERT(map1.getSize() == 2);
|
||||
OATPP_ASSERT(map2.getSize() == 0);
|
||||
OATPP_ASSERT(map1.getSize() == 2)
|
||||
OATPP_ASSERT(map2.getSize() == 0)
|
||||
|
||||
map2 = std::move(map1);
|
||||
|
||||
OATPP_ASSERT(map1.getSize() == 0);
|
||||
OATPP_ASSERT(map2.getSize() == 2);
|
||||
OATPP_ASSERT(map1.getSize() == 0)
|
||||
OATPP_ASSERT(map2.getSize() == 2)
|
||||
|
||||
{
|
||||
|
||||
@ -135,11 +135,11 @@ void LazyStringMapTest::onRun() {
|
||||
auto s1 = all["key1"];
|
||||
auto s2 = all["key2"];
|
||||
|
||||
OATPP_ASSERT(s1.getMemoryHandle() == nullptr);
|
||||
OATPP_ASSERT(s2.getMemoryHandle() == nullptr);
|
||||
OATPP_ASSERT(s1.getMemoryHandle() == nullptr)
|
||||
OATPP_ASSERT(s2.getMemoryHandle() == nullptr)
|
||||
|
||||
OATPP_ASSERT(s1 == "Hello");
|
||||
OATPP_ASSERT(s2 == "World!");
|
||||
OATPP_ASSERT(s1 == "Hello")
|
||||
OATPP_ASSERT(s2 == "World!")
|
||||
|
||||
}
|
||||
|
||||
@ -150,17 +150,17 @@ void LazyStringMapTest::onRun() {
|
||||
auto s1 = all["key1"];
|
||||
auto s2 = all["key2"];
|
||||
|
||||
OATPP_ASSERT(s1.getMemoryHandle());
|
||||
OATPP_ASSERT(s2.getMemoryHandle());
|
||||
OATPP_ASSERT(s1.getMemoryHandle())
|
||||
OATPP_ASSERT(s2.getMemoryHandle())
|
||||
|
||||
OATPP_ASSERT(s1 == "Hello");
|
||||
OATPP_ASSERT(s2 == "World!");
|
||||
OATPP_ASSERT(s1 == "Hello")
|
||||
OATPP_ASSERT(s2 == "World!")
|
||||
|
||||
auto s12 = map2.get("key1");
|
||||
auto s22 = map2.get("key2");
|
||||
|
||||
OATPP_ASSERT(s1.getMemoryHandle().get() == s12.get());
|
||||
OATPP_ASSERT(s2.getMemoryHandle().get() == s22.get());
|
||||
OATPP_ASSERT(s1.getMemoryHandle().get() == s12.get())
|
||||
OATPP_ASSERT(s2.getMemoryHandle().get() == s22.get())
|
||||
|
||||
}
|
||||
|
||||
|
@ -42,105 +42,105 @@ namespace {
|
||||
void MemoryLabelTest::onRun() {
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabel default constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabel default constructor...")
|
||||
StringKeyLabel s;
|
||||
StringKeyLabel s0;
|
||||
OATPP_ASSERT(!s);
|
||||
OATPP_ASSERT(s == nullptr);
|
||||
OATPP_ASSERT(s == s0);
|
||||
OATPP_ASSERT(s != "text");
|
||||
OATPP_ASSERT(s != oatpp::String("text"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!s)
|
||||
OATPP_ASSERT(s == nullptr)
|
||||
OATPP_ASSERT(s == s0)
|
||||
OATPP_ASSERT(s != "text")
|
||||
OATPP_ASSERT(s != oatpp::String("text"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabel nullptr constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabel nullptr constructor...")
|
||||
StringKeyLabel s(nullptr);
|
||||
OATPP_ASSERT(!s);
|
||||
OATPP_ASSERT(s == nullptr);
|
||||
OATPP_ASSERT(s != "text");
|
||||
OATPP_ASSERT(s != oatpp::String("text"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!s)
|
||||
OATPP_ASSERT(s == nullptr)
|
||||
OATPP_ASSERT(s != "text")
|
||||
OATPP_ASSERT(s != oatpp::String("text"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabel const char* constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabel const char* constructor...")
|
||||
StringKeyLabel s("hello");
|
||||
StringKeyLabel s0;
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s != s0);
|
||||
OATPP_ASSERT(s0 != s);
|
||||
OATPP_ASSERT(s == "hello");
|
||||
OATPP_ASSERT(s == oatpp::String("hello"));
|
||||
OATPP_ASSERT(s != "text");
|
||||
OATPP_ASSERT(s != oatpp::String("text"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s != s0)
|
||||
OATPP_ASSERT(s0 != s)
|
||||
OATPP_ASSERT(s == "hello")
|
||||
OATPP_ASSERT(s == oatpp::String("hello"))
|
||||
OATPP_ASSERT(s != "text")
|
||||
OATPP_ASSERT(s != oatpp::String("text"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabel oatpp::String constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabel oatpp::String constructor...")
|
||||
StringKeyLabel s(oatpp::String("hello"));
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s == "hello");
|
||||
OATPP_ASSERT(s == oatpp::String("hello"));
|
||||
OATPP_ASSERT(s != "text");
|
||||
OATPP_ASSERT(s != oatpp::String("text"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s == "hello")
|
||||
OATPP_ASSERT(s == oatpp::String("hello"))
|
||||
OATPP_ASSERT(s != "text")
|
||||
OATPP_ASSERT(s != oatpp::String("text"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI default constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI default constructor...")
|
||||
StringKeyLabelCI s;
|
||||
StringKeyLabelCI s0;
|
||||
OATPP_ASSERT(!s);
|
||||
OATPP_ASSERT(s == nullptr);
|
||||
OATPP_ASSERT(s == s0);
|
||||
OATPP_ASSERT(s != "teXt");
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!s)
|
||||
OATPP_ASSERT(s == nullptr)
|
||||
OATPP_ASSERT(s == s0)
|
||||
OATPP_ASSERT(s != "teXt")
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI nullptr constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI nullptr constructor...")
|
||||
StringKeyLabelCI s(nullptr);
|
||||
OATPP_ASSERT(!s);
|
||||
OATPP_ASSERT(s == nullptr);
|
||||
OATPP_ASSERT(s != "teXt");
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(!s)
|
||||
OATPP_ASSERT(s == nullptr)
|
||||
OATPP_ASSERT(s != "teXt")
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI const char* constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI const char* constructor...")
|
||||
StringKeyLabelCI s("hello");
|
||||
StringKeyLabelCI s0;
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s != s0);
|
||||
OATPP_ASSERT(s0 != s);
|
||||
OATPP_ASSERT(s == "helLO");
|
||||
OATPP_ASSERT(s == oatpp::String("helLO"));
|
||||
OATPP_ASSERT(s != "text");
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s != s0)
|
||||
OATPP_ASSERT(s0 != s)
|
||||
OATPP_ASSERT(s == "helLO")
|
||||
OATPP_ASSERT(s == oatpp::String("helLO"))
|
||||
OATPP_ASSERT(s != "text")
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI oatpp::String constructor...");
|
||||
OATPP_LOGI(TAG, "StringKeyLabelCI oatpp::String constructor...")
|
||||
StringKeyLabelCI s(oatpp::String("hello"));
|
||||
OATPP_ASSERT(s);
|
||||
OATPP_ASSERT(s != nullptr);
|
||||
OATPP_ASSERT(s == "helLO");
|
||||
OATPP_ASSERT(s == oatpp::String("helLO"));
|
||||
OATPP_ASSERT(s != "text");
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"));
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(s)
|
||||
OATPP_ASSERT(s != nullptr)
|
||||
OATPP_ASSERT(s == "helLO")
|
||||
OATPP_ASSERT(s == oatpp::String("helLO"))
|
||||
OATPP_ASSERT(s != "text")
|
||||
OATPP_ASSERT(s != oatpp::String("teXt"))
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "general test...");
|
||||
OATPP_LOGI(TAG, "general test...")
|
||||
|
||||
oatpp::String sharedData = "big text goes here";
|
||||
oatpp::String key1 = "key1";
|
||||
@ -158,15 +158,15 @@ void MemoryLabelTest::onRun() {
|
||||
stringMap[key3] = MemoryLabel(sharedData.getPtr(), &sharedData->data()[9], 4);
|
||||
stringMap[key4] = MemoryLabel(sharedData.getPtr(), &sharedData->data()[14], 4);
|
||||
|
||||
OATPP_ASSERT(stringMap["key1"].equals("big"));
|
||||
OATPP_ASSERT(stringMap["key2"].equals("text"));
|
||||
OATPP_ASSERT(stringMap["key3"].equals("goes"));
|
||||
OATPP_ASSERT(stringMap["key4"].equals("here"));
|
||||
OATPP_ASSERT(stringMap["key1"].equals("big"))
|
||||
OATPP_ASSERT(stringMap["key2"].equals("text"))
|
||||
OATPP_ASSERT(stringMap["key3"].equals("goes"))
|
||||
OATPP_ASSERT(stringMap["key4"].equals("here"))
|
||||
|
||||
OATPP_ASSERT(stringMap.find("Key1") == stringMap.end());
|
||||
OATPP_ASSERT(stringMap.find("Key2") == stringMap.end());
|
||||
OATPP_ASSERT(stringMap.find("Key3") == stringMap.end());
|
||||
OATPP_ASSERT(stringMap.find("Key4") == stringMap.end());
|
||||
OATPP_ASSERT(stringMap.find("Key1") == stringMap.end())
|
||||
OATPP_ASSERT(stringMap.find("Key2") == stringMap.end())
|
||||
OATPP_ASSERT(stringMap.find("Key3") == stringMap.end())
|
||||
OATPP_ASSERT(stringMap.find("Key4") == stringMap.end())
|
||||
|
||||
|
||||
// CI
|
||||
@ -176,15 +176,15 @@ void MemoryLabelTest::onRun() {
|
||||
stringMapCI[key3] = MemoryLabel(sharedData.getPtr(), &sharedData->data()[9], 4);
|
||||
stringMapCI[key4] = MemoryLabel(sharedData.getPtr(), &sharedData->data()[14], 4);
|
||||
|
||||
OATPP_ASSERT(stringMapCI["key1"].equals("big"));
|
||||
OATPP_ASSERT(stringMapCI["key2"].equals("text"));
|
||||
OATPP_ASSERT(stringMapCI["key3"].equals("goes"));
|
||||
OATPP_ASSERT(stringMapCI["key4"].equals("here"));
|
||||
OATPP_ASSERT(stringMapCI["key1"].equals("big"))
|
||||
OATPP_ASSERT(stringMapCI["key2"].equals("text"))
|
||||
OATPP_ASSERT(stringMapCI["key3"].equals("goes"))
|
||||
OATPP_ASSERT(stringMapCI["key4"].equals("here"))
|
||||
|
||||
OATPP_ASSERT(stringMapCI["KEY1"].equals("big"));
|
||||
OATPP_ASSERT(stringMapCI["KEY2"].equals("text"));
|
||||
OATPP_ASSERT(stringMapCI["KEY3"].equals("goes"));
|
||||
OATPP_ASSERT(stringMapCI["KEY4"].equals("here"));
|
||||
OATPP_ASSERT(stringMapCI["KEY1"].equals("big"))
|
||||
OATPP_ASSERT(stringMapCI["KEY2"].equals("text"))
|
||||
OATPP_ASSERT(stringMapCI["KEY3"].equals("goes"))
|
||||
OATPP_ASSERT(stringMapCI["KEY4"].equals("here"))
|
||||
|
||||
{
|
||||
|
||||
@ -214,31 +214,31 @@ void MemoryLabelTest::onRun() {
|
||||
oatpp::web::protocol::http::Headers headers;
|
||||
oatpp::web::protocol::http::Parser::parseHeaders(headers, headersText.getPtr(), caret, status);
|
||||
|
||||
OATPP_ASSERT(status.code == 0);
|
||||
OATPP_ASSERT(headers.getSize() == 10);
|
||||
OATPP_ASSERT(status.code == 0)
|
||||
OATPP_ASSERT(headers.getSize() == 10)
|
||||
|
||||
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header0").equals("value0", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header1").equals("value1", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header2").equals("value2", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header3").equals("value3", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header4").equals("value4", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header5").equals("value5", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header6").equals("value6", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header7").equals("value7", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header8").equals("value8", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header9").equals("value9", 6));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header0").equals("value0", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header1").equals("value1", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header2").equals("value2", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header3").equals("value3", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header4").equals("value4", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header5").equals("value5", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header6").equals("value6", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header7").equals("value7", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header8").equals("value8", 6))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header9").equals("value9", 6))
|
||||
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header0").equals("value0"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header1").equals("value1"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header2").equals("value2"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header3").equals("value3"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header4").equals("value4"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header5").equals("value5"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header6").equals("value6"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header7").equals("value7"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header8").equals("value8"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header9").equals("value9"));
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header0").equals("value0"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header1").equals("value1"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header2").equals("value2"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header3").equals("value3"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header4").equals("value4"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header5").equals("value5"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header6").equals("value6"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header7").equals("value7"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header8").equals("value8"))
|
||||
OATPP_ASSERT(headers.getAsMemoryLabel<StringKeyLabel>("header9").equals("value9"))
|
||||
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ void MemoryLabelTest::onRun() {
|
||||
|
||||
}
|
||||
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
|
||||
}
|
||||
|
||||
@ -270,13 +270,13 @@ void MemoryLabelTest::onRun() {
|
||||
oatpp::web::protocol::http::Headers headers;
|
||||
oatpp::web::protocol::http::Parser::parseHeaders(headers, headersText.getPtr(), caret, status);
|
||||
|
||||
OATPP_ASSERT(status.code == 0);
|
||||
OATPP_ASSERT(headers.getSize() == 10);
|
||||
OATPP_ASSERT(status.code == 0)
|
||||
OATPP_ASSERT(headers.getSize() == 10)
|
||||
|
||||
for(auto& h : headers.getAll()) {
|
||||
auto key = h.first.toString();
|
||||
auto val = h.second.toString();
|
||||
OATPP_LOGD(TAG, "'%s': '%s'", key->c_str(), val->c_str());
|
||||
OATPP_LOGD(TAG, "'%s': '%s'", key->c_str(), val->c_str())
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,79 +33,79 @@ void StringTemplateTest::onRun() {
|
||||
typedef oatpp::data::share::StringTemplate StringTemplate;
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case1 ...");
|
||||
OATPP_LOGI(TAG, "Case1 ...")
|
||||
StringTemplate t("{} World!", {{0, 1, "p1", nullptr}});
|
||||
auto result = t.format(std::vector<oatpp::String>({"Hello"}));
|
||||
OATPP_ASSERT(result == "Hello World!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello World!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case2 ...");
|
||||
OATPP_LOGI(TAG, "Case2 ...")
|
||||
StringTemplate t("{} World!", {{0, 1, "p1", nullptr}});
|
||||
auto result = t.format(std::unordered_map<oatpp::String, oatpp::String>({{"p1", "Hello"}}));
|
||||
OATPP_ASSERT(result == "Hello World!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello World!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case3 ...");
|
||||
OATPP_LOGI(TAG, "Case3 ...")
|
||||
StringTemplate t("Hello {}", {{6, 7, "p1", nullptr}});
|
||||
auto result = t.format(std::vector<oatpp::String>({"World!"}));
|
||||
OATPP_ASSERT(result == "Hello World!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello World!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case4 ...");
|
||||
OATPP_LOGI(TAG, "Case4 ...")
|
||||
StringTemplate t("Hello {}", {{6, 7, "p1", nullptr}});
|
||||
auto result = t.format(std::unordered_map<oatpp::String, oatpp::String>({{"p1", "World!"}}));
|
||||
OATPP_ASSERT(result == "Hello World!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello World!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case5 ...");
|
||||
OATPP_LOGI(TAG, "Case5 ...")
|
||||
StringTemplate t("Hello {} World!", {{6, 7, "p1", nullptr}});
|
||||
auto result = t.format(std::vector<oatpp::String>({"My"}));
|
||||
OATPP_ASSERT(result == "Hello My World!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello My World!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case6 ...");
|
||||
OATPP_LOGI(TAG, "Case6 ...")
|
||||
StringTemplate t("Hello {} World!", {{6, 7, "p1", nullptr}});
|
||||
auto result = t.format(std::unordered_map<oatpp::String, oatpp::String>({{"p1", "My"}}));
|
||||
OATPP_ASSERT(result == "Hello My World!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello My World!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case7 ...");
|
||||
OATPP_LOGI(TAG, "Case7 ...")
|
||||
StringTemplate t("? ? ?", {{0, 0, "p1", nullptr}, {2, 2, "p2", nullptr}, {4, 4, "p3", nullptr}});
|
||||
auto result = t.format(std::vector<oatpp::String>({"Hello", "World", "Oat++!"}));
|
||||
OATPP_ASSERT(result == "Hello World Oat++!");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Hello World Oat++!")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case8 ...");
|
||||
OATPP_LOGI(TAG, "Case8 ...")
|
||||
StringTemplate t("? ? ?", {{0, 0, "p1", nullptr}, {2, 2, "p2", nullptr}, {4, 4, "p3", nullptr}});
|
||||
auto result = t.format(std::unordered_map<oatpp::String, oatpp::String>({{"p3", "Hello"}, {"p2", "World"}, {"p1", "Oat++!"}}));
|
||||
OATPP_ASSERT(result == "Oat++! World Hello");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "Oat++! World Hello")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case9 ...");
|
||||
OATPP_LOGI(TAG, "Case9 ...")
|
||||
StringTemplate t("? ? ?", {{0, 0, "p1", nullptr}, {2, 2, "p2", nullptr}, {4, 4, "p3", nullptr}});
|
||||
auto result = t.format("A");
|
||||
OATPP_ASSERT(result == "A A A");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "A A A")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
{
|
||||
OATPP_LOGI(TAG, "Case10 ...");
|
||||
OATPP_LOGI(TAG, "Case10 ...")
|
||||
StringTemplate t("? ? ?",
|
||||
{
|
||||
{0, 0, "p1", std::make_shared<oatpp::base::Countable>()},
|
||||
@ -114,8 +114,8 @@ void StringTemplateTest::onRun() {
|
||||
}
|
||||
);
|
||||
auto result = t.format("(A)");
|
||||
OATPP_ASSERT(result == "(A) (A) (A)");
|
||||
OATPP_LOGI(TAG, "OK");
|
||||
OATPP_ASSERT(result == "(A) (A) (A)")
|
||||
OATPP_LOGI(TAG, "OK")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,63 +40,63 @@ void BufferStreamTest::onRun() {
|
||||
stream << "int=" << 1 << ", float=" << 1.1 << ", "
|
||||
<< "bool=" << true << " or " << false;
|
||||
|
||||
OATPP_LOGV(TAG, "str='%s'", stream.toString()->c_str());
|
||||
OATPP_LOGV(TAG, "str='%s'", stream.toString()->c_str())
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << 101;
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(101));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(101))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << static_cast<v_float32>(101.5);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float32ToStr(101.5f));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float32ToStr(101.5f))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << static_cast<v_float64>(101.5f);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float64ToStr(101.5));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float64ToStr(101.5))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << true;
|
||||
OATPP_ASSERT(stream.toString() == "true");
|
||||
OATPP_ASSERT(stream.toString() == "true")
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << false;
|
||||
OATPP_ASSERT(stream.toString() == "false");
|
||||
OATPP_ASSERT(stream.toString() == "false")
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::String("oat++");
|
||||
OATPP_ASSERT(stream.toString() == "oat++");
|
||||
OATPP_ASSERT(stream.toString() == "oat++")
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Int8(8);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(8));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(8))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Int16(16);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(16));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(16))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Int32(32);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(32));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(32))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Int64(64);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(64));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::int32ToStr(64))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Float32(0.32f);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float32ToStr(0.32f));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float32ToStr(0.32f))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Float64(0.64);
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float64ToStr(0.64));
|
||||
OATPP_ASSERT(stream.toString() == oatpp::utils::conversion::float64ToStr(0.64))
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Boolean(true);
|
||||
OATPP_ASSERT(stream.toString() == "true");
|
||||
OATPP_ASSERT(stream.toString() == "true")
|
||||
|
||||
stream.setCurrentPosition(0);
|
||||
stream << oatpp::Boolean(false);
|
||||
OATPP_ASSERT(stream.toString() == "false");
|
||||
OATPP_ASSERT(stream.toString() == "false")
|
||||
|
||||
}
|
||||
|
||||
@ -111,11 +111,11 @@ void BufferStreamTest::onRun() {
|
||||
|
||||
auto wholeText = stream.toString();
|
||||
|
||||
OATPP_ASSERT(wholeText->size() == static_cast<size_t>(fragmentsCount * 10));
|
||||
OATPP_ASSERT(wholeText->size() == static_cast<size_t>(fragmentsCount * 10))
|
||||
|
||||
v_buff_size substringSize = 10;
|
||||
for(v_buff_size i = 0; i < static_cast<v_buff_size>(wholeText->size()) - substringSize; i ++) {
|
||||
OATPP_ASSERT(oatpp::String(&wholeText->data()[i], substringSize) == stream.getSubstring(i, substringSize));
|
||||
OATPP_ASSERT(oatpp::String(&wholeText->data()[i], substringSize) == stream.getSubstring(i, substringSize))
|
||||
}
|
||||
|
||||
}
|
||||
@ -134,13 +134,13 @@ void BufferStreamTest::onRun() {
|
||||
for(v_int32 i = 0; i < 1024; i++ ) {
|
||||
stream << sample;
|
||||
|
||||
OATPP_ASSERT(stream.getCapacity() >= stream.getCurrentPosition());
|
||||
OATPP_ASSERT(stream.getCapacity() >= stream.getCurrentPosition())
|
||||
|
||||
}
|
||||
|
||||
OATPP_ASSERT(text == stream.toString());
|
||||
OATPP_ASSERT(text == stream.toString())
|
||||
|
||||
OATPP_ASSERT(stream.getCapacity() == oatpp::utils::Binary::nextP2(1024 * (10)));
|
||||
OATPP_ASSERT(stream.getCapacity() == oatpp::utils::Binary::nextP2(1024 * (10)))
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,52 +36,52 @@ void CaretTest::onRun() {
|
||||
|
||||
{
|
||||
Caret caret(" \t\n\r\f \t\n\r\f \t\n\r\fhello!\t\n\r\f");
|
||||
OATPP_ASSERT(caret.skipBlankChars());
|
||||
OATPP_ASSERT(caret.isAtChar('h'));
|
||||
OATPP_ASSERT(caret.isAtText("hello!"));
|
||||
OATPP_ASSERT(caret.isAtText("hello!", true));
|
||||
OATPP_ASSERT(caret.skipBlankChars() == false); // false because no other char found
|
||||
OATPP_ASSERT(caret.canContinue() == false);
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize());
|
||||
OATPP_ASSERT(caret.skipBlankChars())
|
||||
OATPP_ASSERT(caret.isAtChar('h'))
|
||||
OATPP_ASSERT(caret.isAtText("hello!"))
|
||||
OATPP_ASSERT(caret.isAtText("hello!", true))
|
||||
OATPP_ASSERT(caret.skipBlankChars() == false) // false because no other char found
|
||||
OATPP_ASSERT(caret.canContinue() == false)
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize())
|
||||
}
|
||||
|
||||
{
|
||||
Caret caret(" \t\n\r\f \t\n\r\f \t\n\r\fhello!\t\n\r\f");
|
||||
OATPP_ASSERT(caret.findText("hello!"));
|
||||
OATPP_ASSERT(caret.isAtText("hello!"));
|
||||
OATPP_ASSERT(caret.isAtTextNCS("HELLO!"));
|
||||
OATPP_ASSERT(caret.isAtTextNCS("HELLO!", true));
|
||||
OATPP_ASSERT(caret.skipBlankChars() == false); // false because no other char found
|
||||
OATPP_ASSERT(caret.canContinue() == false);
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize());
|
||||
OATPP_ASSERT(caret.findText("hello!"))
|
||||
OATPP_ASSERT(caret.isAtText("hello!"))
|
||||
OATPP_ASSERT(caret.isAtTextNCS("HELLO!"))
|
||||
OATPP_ASSERT(caret.isAtTextNCS("HELLO!", true))
|
||||
OATPP_ASSERT(caret.skipBlankChars() == false) // false because no other char found
|
||||
OATPP_ASSERT(caret.canContinue() == false)
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize())
|
||||
}
|
||||
|
||||
{
|
||||
Caret caret(" \t\n\r\f \t\n\r\f \t\n\r\fhello!\t\n\r\f");
|
||||
OATPP_ASSERT(caret.findText("hello world!") == false);
|
||||
OATPP_ASSERT(caret.canContinue() == false);
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize());
|
||||
OATPP_ASSERT(caret.findText("hello world!") == false)
|
||||
OATPP_ASSERT(caret.canContinue() == false)
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize())
|
||||
}
|
||||
|
||||
{
|
||||
Caret caret("\r\n'let\\'s'\r\n'play'");
|
||||
OATPP_ASSERT(caret.findRN());
|
||||
OATPP_ASSERT(caret.skipRN());
|
||||
OATPP_ASSERT(caret.findRN())
|
||||
OATPP_ASSERT(caret.skipRN())
|
||||
|
||||
auto label = caret.parseStringEnclosed('\'', '\'', '\\');
|
||||
OATPP_ASSERT(label);
|
||||
OATPP_ASSERT(label.toString() == "let\\'s");
|
||||
OATPP_ASSERT(label)
|
||||
OATPP_ASSERT(label.toString() == "let\\'s")
|
||||
|
||||
OATPP_ASSERT(caret.skipRN());
|
||||
OATPP_ASSERT(caret.skipRN())
|
||||
|
||||
label = caret.parseStringEnclosed('\'', '\'', '\\');
|
||||
OATPP_ASSERT(label);
|
||||
OATPP_ASSERT(label.toString() == "play");
|
||||
OATPP_ASSERT(label)
|
||||
OATPP_ASSERT(label.toString() == "play")
|
||||
|
||||
OATPP_ASSERT(caret.canContinue() == false);
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize());
|
||||
OATPP_ASSERT(caret.canContinue() == false)
|
||||
OATPP_ASSERT(caret.getPosition() == caret.getDataSize())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}}}
|
||||
}}}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
OATPP_LOGD("Provider", "stop()");
|
||||
OATPP_LOGD("Provider", "stop()")
|
||||
}
|
||||
|
||||
};
|
||||
@ -144,34 +144,34 @@ void PoolTemplateTest::onRun() {
|
||||
const v_int64 maxResources = 1;
|
||||
|
||||
{
|
||||
OATPP_LOGD(TAG, "Synchronously with timeout");
|
||||
OATPP_LOGD(TAG, "Synchronously with timeout")
|
||||
auto poolTemplate = Pool::createShared(provider, maxResources, std::chrono::seconds(10), std::chrono::milliseconds(500));
|
||||
|
||||
oatpp::provider::ResourceHandle<Resource> resource = Pool::get(poolTemplate);
|
||||
OATPP_ASSERT(resource != nullptr);
|
||||
OATPP_ASSERT(Pool::get(poolTemplate) == nullptr);
|
||||
OATPP_ASSERT(resource != nullptr)
|
||||
OATPP_ASSERT(Pool::get(poolTemplate) == nullptr)
|
||||
|
||||
poolTemplate->stop();
|
||||
|
||||
OATPP_ASSERT(Pool::get(poolTemplate) == nullptr);
|
||||
OATPP_ASSERT(Pool::get(poolTemplate) == nullptr)
|
||||
}
|
||||
{
|
||||
OATPP_LOGD(TAG, "Synchronously without timeout");
|
||||
OATPP_LOGD(TAG, "Synchronously without timeout")
|
||||
auto poolTemplate = Pool::createShared(provider, maxResources, std::chrono::seconds(10), std::chrono::milliseconds::zero());
|
||||
|
||||
oatpp::provider::ResourceHandle<Resource> resource = Pool::get(poolTemplate);
|
||||
OATPP_ASSERT(resource != nullptr);
|
||||
OATPP_ASSERT(resource != nullptr)
|
||||
std::future<oatpp::provider::ResourceHandle<Resource>> futureResource = std::async(std::launch::async, [&poolTemplate]() {
|
||||
return Pool::get(poolTemplate);
|
||||
});
|
||||
OATPP_ASSERT(futureResource.wait_for(std::chrono::seconds(1)) == std::future_status::timeout);
|
||||
OATPP_ASSERT(futureResource.wait_for(std::chrono::seconds(1)) == std::future_status::timeout)
|
||||
|
||||
poolTemplate->stop();
|
||||
|
||||
OATPP_ASSERT(Pool::get(poolTemplate) == nullptr);
|
||||
OATPP_ASSERT(Pool::get(poolTemplate) == nullptr)
|
||||
}
|
||||
{
|
||||
OATPP_LOGD(TAG, "Asynchronously with timeout");
|
||||
OATPP_LOGD(TAG, "Asynchronously with timeout")
|
||||
oatpp::async::Executor executor(1, 1, 1);
|
||||
auto poolTemplate = Pool::createShared(provider, maxResources, std::chrono::seconds(10), std::chrono::milliseconds(500));
|
||||
|
||||
@ -181,7 +181,7 @@ void PoolTemplateTest::onRun() {
|
||||
auto future = promise.get_future();
|
||||
executor.execute<ClientCoroutine>(poolTemplate, &promise);
|
||||
resourceHandle = future.get();
|
||||
OATPP_ASSERT(resourceHandle != nullptr);
|
||||
OATPP_ASSERT(resourceHandle != nullptr)
|
||||
OATPP_ASSERT(resourceHandle.object != nullptr)
|
||||
OATPP_ASSERT(resourceHandle.invalidator != nullptr)
|
||||
}
|
||||
@ -190,7 +190,7 @@ void PoolTemplateTest::onRun() {
|
||||
auto future = promise.get_future();
|
||||
executor.execute<ClientCoroutine>(poolTemplate, &promise);
|
||||
resourceHandle = future.get();
|
||||
OATPP_ASSERT(resourceHandle == nullptr);
|
||||
OATPP_ASSERT(resourceHandle == nullptr)
|
||||
OATPP_ASSERT(resourceHandle.object == nullptr)
|
||||
OATPP_ASSERT(resourceHandle.invalidator == nullptr)
|
||||
}
|
||||
@ -200,17 +200,17 @@ void PoolTemplateTest::onRun() {
|
||||
executor.join();
|
||||
}
|
||||
{
|
||||
OATPP_LOGD(TAG, "Asynchronously without timeout");
|
||||
OATPP_LOGD(TAG, "Asynchronously without timeout")
|
||||
oatpp::async::Executor executor(1, 1, 1);
|
||||
auto poolTemplate = Pool::createShared(provider, maxResources, std::chrono::seconds(10), std::chrono::milliseconds::zero());
|
||||
|
||||
oatpp::provider::ResourceHandle<Resource> resource = Pool::get(poolTemplate);
|
||||
OATPP_ASSERT(resource != nullptr);
|
||||
OATPP_ASSERT(resource != nullptr)
|
||||
|
||||
std::promise<oatpp::provider::ResourceHandle<Resource>> promise;
|
||||
auto future = promise.get_future();
|
||||
executor.execute<ClientCoroutine>(poolTemplate, &promise);
|
||||
OATPP_ASSERT(future.wait_for(std::chrono::seconds(1)) == std::future_status::timeout);
|
||||
OATPP_ASSERT(future.wait_for(std::chrono::seconds(1)) == std::future_status::timeout)
|
||||
|
||||
poolTemplate->stop();
|
||||
executor.stop();
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
OATPP_LOGD("Provider", "stop()");
|
||||
OATPP_LOGD("Provider", "stop()")
|
||||
}
|
||||
|
||||
v_int64 getIdCounter() {
|
||||
@ -181,7 +181,7 @@ void PoolTest::onRun() {
|
||||
|
||||
std::list<std::thread> threads;
|
||||
|
||||
OATPP_LOGD(TAG, "Run 1");
|
||||
OATPP_LOGD(TAG, "Run 1")
|
||||
for(v_int32 i = 0; i < 100; i ++ ) {
|
||||
threads.push_back(std::thread(clientMethod, pool, false));
|
||||
executor.execute<ClientCoroutine>(pool, false);
|
||||
@ -189,14 +189,14 @@ void PoolTest::onRun() {
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds (200));
|
||||
|
||||
OATPP_LOGD(TAG, "1) pool->getCounter() == %ld", pool->getCounter());
|
||||
OATPP_ASSERT(pool->getCounter() == 10);
|
||||
OATPP_LOGD(TAG, "Waiting...");
|
||||
OATPP_LOGD(TAG, "1) pool->getCounter() == %ld", pool->getCounter())
|
||||
OATPP_ASSERT(pool->getCounter() == 10)
|
||||
OATPP_LOGD(TAG, "Waiting...")
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
OATPP_LOGD(TAG, "Pool counter=%ld", pool->getCounter());
|
||||
OATPP_ASSERT(pool->getCounter() == 0);
|
||||
OATPP_LOGD(TAG, "Pool counter=%ld", pool->getCounter())
|
||||
OATPP_ASSERT(pool->getCounter() == 0)
|
||||
|
||||
OATPP_LOGD(TAG, "Run 2");
|
||||
OATPP_LOGD(TAG, "Run 2")
|
||||
for(v_int32 i = 0; i < 100; i ++ ) {
|
||||
threads.push_back(std::thread(clientMethod, pool, false));
|
||||
executor.execute<ClientCoroutine>(pool, false);
|
||||
@ -204,12 +204,12 @@ void PoolTest::onRun() {
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds (200));
|
||||
|
||||
OATPP_LOGD(TAG, "2) pool->getCounter() == %ld", pool->getCounter());
|
||||
OATPP_ASSERT(pool->getCounter() == 10);
|
||||
OATPP_LOGD(TAG, "Waiting...");
|
||||
OATPP_LOGD(TAG, "2) pool->getCounter() == %ld", pool->getCounter())
|
||||
OATPP_ASSERT(pool->getCounter() == 10)
|
||||
OATPP_LOGD(TAG, "Waiting...")
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
OATPP_LOGD(TAG, "Pool counter=%ld", pool->getCounter());
|
||||
OATPP_ASSERT(pool->getCounter() == 0);
|
||||
OATPP_LOGD(TAG, "Pool counter=%ld", pool->getCounter())
|
||||
OATPP_ASSERT(pool->getCounter() == 0)
|
||||
|
||||
for(std::thread& thread : threads) {
|
||||
thread.join();
|
||||
@ -217,8 +217,8 @@ void PoolTest::onRun() {
|
||||
|
||||
executor.waitTasksFinished();
|
||||
|
||||
OATPP_LOGD(TAG, "counter=%ld", provider->getIdCounter());
|
||||
OATPP_ASSERT(provider->getIdCounter() == 20);
|
||||
OATPP_LOGD(TAG, "counter=%ld", provider->getIdCounter())
|
||||
OATPP_ASSERT(provider->getIdCounter() == 20)
|
||||
|
||||
pool->stop();
|
||||
|
||||
|
@ -35,17 +35,17 @@ void Base64Test::onRun() {
|
||||
|
||||
{
|
||||
oatpp::String encoded = oatpp::encoding::Base64::encode(message);
|
||||
OATPP_LOGV(TAG, "encoded='%s'", encoded->c_str());
|
||||
OATPP_ASSERT(encoded == messageEncoded);
|
||||
OATPP_LOGV(TAG, "encoded='%s'", encoded->c_str())
|
||||
OATPP_ASSERT(encoded == messageEncoded)
|
||||
oatpp::String decoded = oatpp::encoding::Base64::decode(encoded);
|
||||
OATPP_ASSERT(message == decoded);
|
||||
OATPP_ASSERT(message == decoded)
|
||||
}
|
||||
|
||||
{
|
||||
oatpp::String encoded = oatpp::encoding::Base64::encode(message, oatpp::encoding::Base64::ALPHABET_BASE64_URL_SAFE);
|
||||
OATPP_LOGV(TAG, "encoded='%s'", encoded->c_str());
|
||||
OATPP_LOGV(TAG, "encoded='%s'", encoded->c_str())
|
||||
oatpp::String decoded = oatpp::encoding::Base64::decode(encoded, oatpp::encoding::Base64::ALPHABET_BASE64_URL_SAFE_AUXILIARY_CHARS);
|
||||
OATPP_ASSERT(message == decoded);
|
||||
OATPP_ASSERT(message == decoded)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void writeBinaryInt(v_int32 value){
|
||||
}
|
||||
}
|
||||
|
||||
OATPP_LOGV("bin", "value='%s'", reinterpret_cast<const char*>(&buff));
|
||||
OATPP_LOGV("bin", "value='%s'", reinterpret_cast<const char*>(&buff))
|
||||
|
||||
}
|
||||
|
||||
@ -67,50 +67,50 @@ void UnicodeTest::onRun(){
|
||||
|
||||
for(v_int32 c = 128; c < 2048; c ++){
|
||||
auto size = oatpp::encoding::Unicode::decodeUtf8Char(c, buff);
|
||||
OATPP_ASSERT(size == 2);
|
||||
OATPP_ASSERT(size == 2)
|
||||
auto code = oatpp::encoding::Unicode::encodeUtf8Char(reinterpret_cast<const char*>(buff), cnt);
|
||||
OATPP_ASSERT(cnt == 2);
|
||||
OATPP_ASSERT(code == c);
|
||||
OATPP_ASSERT(cnt == 2)
|
||||
OATPP_ASSERT(code == c)
|
||||
}
|
||||
|
||||
// 3 byte test
|
||||
|
||||
for(v_int32 c = 2048; c < 65536; c ++){
|
||||
auto size = oatpp::encoding::Unicode::decodeUtf8Char(c, buff);
|
||||
OATPP_ASSERT(size == 3);
|
||||
OATPP_ASSERT(size == 3)
|
||||
auto code = oatpp::encoding::Unicode::encodeUtf8Char(reinterpret_cast<const char*>(buff), cnt);
|
||||
OATPP_ASSERT(cnt == 3);
|
||||
OATPP_ASSERT(code == c);
|
||||
OATPP_ASSERT(cnt == 3)
|
||||
OATPP_ASSERT(code == c)
|
||||
}
|
||||
|
||||
// 4 byte test
|
||||
|
||||
for(v_int32 c = 65536; c < 2097152; c ++){
|
||||
auto size = oatpp::encoding::Unicode::decodeUtf8Char(c, buff);
|
||||
OATPP_ASSERT(size == 4);
|
||||
OATPP_ASSERT(size == 4)
|
||||
auto code = oatpp::encoding::Unicode::encodeUtf8Char(reinterpret_cast<const char*>(buff), cnt);
|
||||
OATPP_ASSERT(cnt == 4);
|
||||
OATPP_ASSERT(code == c);
|
||||
OATPP_ASSERT(cnt == 4)
|
||||
OATPP_ASSERT(code == c)
|
||||
}
|
||||
|
||||
// 5 byte test
|
||||
|
||||
for(v_int32 c = 2097152; c < 67108864; c ++){
|
||||
auto size = oatpp::encoding::Unicode::decodeUtf8Char(c, buff);
|
||||
OATPP_ASSERT(size == 5);
|
||||
OATPP_ASSERT(size == 5)
|
||||
auto code = oatpp::encoding::Unicode::encodeUtf8Char(reinterpret_cast<const char*>(buff), cnt);
|
||||
OATPP_ASSERT(cnt == 5);
|
||||
OATPP_ASSERT(code == c);
|
||||
OATPP_ASSERT(cnt == 5)
|
||||
OATPP_ASSERT(code == c)
|
||||
}
|
||||
|
||||
// 6 byte test
|
||||
|
||||
for (v_int64 c = 67108864; c < 2147483647; c = c + 100) {
|
||||
auto size = oatpp::encoding::Unicode::decodeUtf8Char(static_cast<v_int32>(c), buff);
|
||||
OATPP_ASSERT(size == 6);
|
||||
OATPP_ASSERT(size == 6)
|
||||
auto code = oatpp::encoding::Unicode::encodeUtf8Char(reinterpret_cast<const char*>(buff), cnt);
|
||||
OATPP_ASSERT(cnt == 6);
|
||||
OATPP_ASSERT(code == c);
|
||||
OATPP_ASSERT(cnt == 6)
|
||||
OATPP_ASSERT(code == c)
|
||||
}
|
||||
|
||||
// */
|
||||
@ -124,12 +124,12 @@ void UnicodeTest::onRun(){
|
||||
auto check = oatpp::encoding::Unicode::utf16SurrogatePairToCode(high, low);
|
||||
writeBinaryInt(code);
|
||||
writeBinaryInt(check);
|
||||
OATPP_ASSERT(code == check);
|
||||
OATPP_ASSERT(code == check)
|
||||
|
||||
for(v_int32 c = 0x010000; c <= 0x10FFFF; c++) {
|
||||
oatpp::encoding::Unicode::codeToUtf16SurrogatePair(code, high, low);
|
||||
check = oatpp::encoding::Unicode::utf16SurrogatePairToCode(high, low);
|
||||
OATPP_ASSERT(code == check);
|
||||
OATPP_ASSERT(code == check)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ void UrlTest::onRun(){
|
||||
utils::random::Random::randomBytes(reinterpret_cast<p_char8>(const_cast<char*>(buff->data())), static_cast<v_buff_size>(buff->size()));
|
||||
auto encoded = oatpp::encoding::Url::encode(buff, config);
|
||||
auto decoded = oatpp::encoding::Url::decode(encoded);
|
||||
OATPP_ASSERT(decoded == buff);
|
||||
OATPP_ASSERT(decoded == buff)
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ void UrlTest::onRun(){
|
||||
utils::random::Random::randomBytes(reinterpret_cast<p_char8>(const_cast<char*>(buff->data())), static_cast<v_buff_size>(buff->size()));
|
||||
auto encoded = oatpp::encoding::Url::encode(buff, config);
|
||||
auto decoded = oatpp::encoding::Url::decode(encoded);
|
||||
OATPP_ASSERT(decoded == buff);
|
||||
OATPP_ASSERT(decoded == buff)
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,28 +61,28 @@ void UrlTest::onRun(){
|
||||
oatpp::encoding::Url::Config config;
|
||||
config.spaceToPlus = false;
|
||||
auto encoded = oatpp::encoding::Url::encode(" ", config);
|
||||
OATPP_ASSERT_FMT("%s", encoded == "%20");
|
||||
OATPP_ASSERT_FMT("%s", encoded == "%20")
|
||||
}
|
||||
|
||||
{
|
||||
oatpp::encoding::Url::Config config;
|
||||
config.spaceToPlus = true;
|
||||
auto encoded = oatpp::encoding::Url::encode(" ", config);
|
||||
OATPP_ASSERT(encoded == "+");
|
||||
OATPP_ASSERT(encoded == "+")
|
||||
}
|
||||
|
||||
{
|
||||
oatpp::encoding::Url::Config config;
|
||||
config.spaceToPlus = false;
|
||||
auto encoded = oatpp::encoding::Url::encode("Смачна Овсяночка!", config);
|
||||
OATPP_ASSERT_FMT("%s", encoded == "%D0%A1%D0%BC%D0%B0%D1%87%D0%BD%D0%B0%20%D0%9E%D0%B2%D1%81%D1%8F%D0%BD%D0%BE%D1%87%D0%BA%D0%B0%21");
|
||||
OATPP_ASSERT_FMT("%s", encoded == "%D0%A1%D0%BC%D0%B0%D1%87%D0%BD%D0%B0%20%D0%9E%D0%B2%D1%81%D1%8F%D0%BD%D0%BE%D1%87%D0%BA%D0%B0%21")
|
||||
}
|
||||
|
||||
{
|
||||
oatpp::encoding::Url::Config config;
|
||||
config.spaceToPlus = true;
|
||||
auto encoded = oatpp::encoding::Url::encode("Смачна Овсяночка!", config);
|
||||
OATPP_ASSERT_FMT("%s", encoded == "%D0%A1%D0%BC%D0%B0%D1%87%D0%BD%D0%B0+%D0%9E%D0%B2%D1%81%D1%8F%D0%BD%D0%BE%D1%87%D0%BA%D0%B0%21");
|
||||
OATPP_ASSERT_FMT("%s", encoded == "%D0%A1%D0%BC%D0%B0%D1%87%D0%BD%D0%B0+%D0%9E%D0%B2%D1%81%D1%8F%D0%BD%D0%BE%D1%87%D0%BA%D0%B0%21")
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user