#include <dpl/test/test_runner.h>
#include <dpl/foreach.h>
#include <dpl/exception.h>
+#include <dpl/optional_typedefs.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <dpl/wrt-dao-ro/wrt_db_types.h>
#include <dpl/string.h>
*/
RUNNER_TEST(widget_interface_dao_test_02_readValue)
{
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
value = dao.getValue("key1_for_2000");
- RUNNER_ASSERT(value == "value_for_key1_2000");
+ RUNNER_ASSERT(value == std::string("value_for_key1_2000"));
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{
*/
RUNNER_TEST(widget_interface_dao_test_02_readValue_badKey)
{
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
value = dao.getValue("key1_for_200011111");
- RUNNER_ASSERT(value.IsNull());
+ RUNNER_ASSERT(!value);
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{
*/
RUNNER_TEST(widget_interface_dao_test_03_setItem)
{
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
value = dao.getValue("key3_for_2000");
- RUNNER_ASSERT(value == "value_for_key3_2000");
+ RUNNER_ASSERT(value == std::string("value_for_key3_2000"));
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{
*/
RUNNER_TEST(widget_interface_dao_test_03_setItem_Exception)
{
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
*/
RUNNER_TEST(widget_interface_dao_test_04_setItem)
{
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
value = dao.getValue("key4_for_2000");
- RUNNER_ASSERT(value == "value_for_key4_2000");
+ RUNNER_ASSERT(value == std::string("value_for_key4_2000"));
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{
{
std::string key;
size_t sizeBefore, sizeAfter;
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
value = dao.getValue("key4_for_2000");
RUNNER_ASSERT(sizeAfter == sizeBefore - 1);
- RUNNER_ASSERT(value.IsNull());
+ RUNNER_ASSERT(!value);
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{
RUNNER_TEST(widget_interface_dao_test_06_removeItem_Exception)
{
WidgetInterfaceDAO* dao = NULL;
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
size_t sizeBefore, sizeAfter;
Try
value = dao->getValue("key3_for_2000");
RUNNER_ASSERT(sizeAfter == sizeBefore);
- RUNNER_ASSERT(value == "value_for_key3_2000");
+ RUNNER_ASSERT(value == std::string("value_for_key3_2000"));
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{
RUNNER_TEST(widget_interface_dao_test_07_clear)
{
size_t sizeBefore, sizeAfter;
- DPL::Optional<std::string> value;
+ DPL::OptionalStdString value;
Try
{
RUNNER_ASSERT(sizeAfter == 1);
RUNNER_ASSERT(sizeAfter < sizeBefore);
- RUNNER_ASSERT(value == "value_for_key3_2000");
+ RUNNER_ASSERT(value == std::string("value_for_key3_2000"));
}
Catch(WidgetInterfaceDAO::Exception::DatabaseError)
{