summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Nosach <ANosach@luxoft.com>2016-06-08 15:47:34 +0300
committerArtem Nosach <ANosach@luxoft.com>2016-06-08 15:47:34 +0300
commit28831d7fe0fc18b8332576d41aef81894bc6843c (patch)
tree911d1432066c86f3498ee310e7697ad76809ca90
parent55d6f5126c244b80b722e2c313fb7d1f9d82a887 (diff)
parent7bd00d2c81f46261832adf4ea7c0c712cb16700a (diff)
downloadsdl_core-28831d7fe0fc18b8332576d41aef81894bc6843c.tar.gz
Merge pull request #51 from anosach-luxoft/fix/Enable-posix-tests
Enable posix tests
-rw-r--r--src/components/config_profile/src/ini_file.cc27
-rw-r--r--src/components/config_profile/test/ini_file_test.cc10
-rw-r--r--src/components/connection_handler/test/heart_beat_monitor_test.cc48
-rw-r--r--src/components/formatters/test/CFormatterJsonBase_test.cc117
-rw-r--r--src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc13
-rw-r--r--src/components/formatters/test/formatter_json_rpc_test.cc10
-rw-r--r--src/components/resumption/test/last_state_test.cc4
-rw-r--r--src/components/security_manager/test/crypto_manager_impl_test.cc17
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_object.h11
-rw-r--r--src/components/smart_objects/src/smart_object.cc10
-rw-r--r--src/components/utils/test/custom_string_test.cc4
11 files changed, 113 insertions, 158 deletions
diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc
index babf83115d..553cd38626 100644
--- a/src/components/config_profile/src/ini_file.cc
+++ b/src/components/config_profile/src/ini_file.cc
@@ -186,23 +186,22 @@ char ini_write_value(const char* fname,
#if USE_MKSTEMP
{
- char* temp_str;
+ char const* temp_str;
int32_t fd = -1;
temp_str = static_cast<char*>(getenv("TMPDIR"));
- if (temp_str) {
- snprintf(temp_fname, PATH_MAX, "%s/ini.XXXXXX", temp_str);
+ if (!temp_str) {
+ temp_str = "/var/tmp";
+ }
+ snprintf(temp_fname, PATH_MAX, "%s/ini.XXXXXX", temp_str);
- fd = mkstemp(temp_fname);
- if (-1 == fd) {
- return FALSE;
- }
- wr_fp = fdopen(fd, "w");
- if (NULL == wr_fp) {
- unlink(temp_fname);
- close(fd);
- return FALSE;
- }
- } else {
+ fd = mkstemp(temp_fname);
+ if (-1 == fd) {
+ return FALSE;
+ }
+ wr_fp = fdopen(fd, "w");
+ if (NULL == wr_fp) {
+ unlink(temp_fname);
+ close(fd);
return FALSE;
}
}
diff --git a/src/components/config_profile/test/ini_file_test.cc b/src/components/config_profile/test/ini_file_test.cc
index bd5d844851..0443f061a2 100644
--- a/src/components/config_profile/test/ini_file_test.cc
+++ b/src/components/config_profile/test/ini_file_test.cc
@@ -40,7 +40,7 @@ namespace profile_test {
using namespace ::profile;
-TEST(IniFileTest, DISABLED_WriteItemReadItem) {
+TEST(IniFileTest, WriteItemReadItem) {
// Write line in chapter
const char* fname = "./test_ini_file.ini";
const char* chapter = "Chapter";
@@ -58,7 +58,7 @@ TEST(IniFileTest, DISABLED_WriteItemReadItem) {
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_WriteItemWithoutValueReadItem) {
+TEST(IniFileTest, WriteItemWithoutValueReadItem) {
// Write line in chapter
const char* fname = "./test_ini_file.ini";
const char* chapter = "Chapter";
@@ -79,7 +79,7 @@ TEST(IniFileTest, DISABLED_WriteItemWithoutValueReadItem) {
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_WriteSameItemInDifferentChapters) {
+TEST(IniFileTest, WriteSameItemInDifferentChapters) {
// Write line in chapter
const char* fname = "./test_ini_file.ini";
const char* chapter1 = "Chapter1";
@@ -111,7 +111,7 @@ TEST(IniFileTest, DISABLED_WriteSameItemInDifferentChapters) {
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_RewriteItem) {
+TEST(IniFileTest, RewriteItem) {
// Write line in chapter
const char* fname = "./test_ini_file.ini";
const char* chapter = "Chapter";
@@ -141,7 +141,7 @@ TEST(IniFileTest, DISABLED_RewriteItem) {
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_WriteTwoItemsInOneChapter) {
+TEST(IniFileTest, WriteTwoItemsInOneChapter) {
// Write line in chapter
const char* fname = "./test_ini_file.ini";
const char* chapter = "Chapter";
diff --git a/src/components/connection_handler/test/heart_beat_monitor_test.cc b/src/components/connection_handler/test/heart_beat_monitor_test.cc
index 421f68e583..5049a31fc2 100644
--- a/src/components/connection_handler/test/heart_beat_monitor_test.cc
+++ b/src/components/connection_handler/test/heart_beat_monitor_test.cc
@@ -85,19 +85,19 @@ TEST_F(HeartBeatMonitorTest, TimerNotStarted) {
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
conn->AddNewSession();
- testing::Mock::AsyncVerifyAndClearExpectations(
- kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout +
+ MILLISECONDS_IN_SECOND);
}
-TEST_F(HeartBeatMonitorTest, DISABLED_TimerNotElapsed) {
+TEST_F(HeartBeatMonitorTest, TimerNotElapsed) {
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
const uint32_t session = conn->AddNewSession();
conn->StartHeartBeat(session);
- testing::Mock::AsyncVerifyAndClearExpectations(
- kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout -
+ MILLISECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, TimerElapsed) {
@@ -109,29 +109,29 @@ TEST_F(HeartBeatMonitorTest, TimerElapsed) {
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, session));
conn->StartHeartBeat(session);
- testing::Mock::AsyncVerifyAndClearExpectations(
- 2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(2 * kTimeout +
+ MILLISECONDS_IN_SECOND);
}
// TODO(OHerasym) : test don't finishing on Windows platform
-TEST_F(HeartBeatMonitorTest, DISABLED_KeptAlive) {
+TEST_F(HeartBeatMonitorTest, KeptAlive) {
EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
const uint32_t session = conn->AddNewSession();
conn->StartHeartBeat(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
conn->KeepAlive(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
conn->KeepAlive(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
conn->KeepAlive(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
}
// TODO(OHerasym) : test don't finishing on Windows platform
-TEST_F(HeartBeatMonitorTest, DISABLED_NotKeptAlive) {
+TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
const uint32_t session = conn->AddNewSession();
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, session));
@@ -140,13 +140,13 @@ TEST_F(HeartBeatMonitorTest, DISABLED_NotKeptAlive) {
EXPECT_CALL(connection_handler_mock, CloseConnection(_));
conn->StartHeartBeat(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
conn->KeepAlive(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
conn->KeepAlive(session);
- sleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ sleep(kTimeout - MILLISECONDS_IN_SECOND);
conn->KeepAlive(session);
- sleep(2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ sleep(2 * kTimeout + MILLISECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
@@ -163,8 +163,8 @@ TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
conn->StartHeartBeat(kSession1);
conn->StartHeartBeat(kSession2);
- testing::Mock::AsyncVerifyAndClearExpectations(
- 2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(2 * kTimeout +
+ MILLISECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
@@ -174,12 +174,11 @@ TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
- const uint32_t kNewTimeout = kTimeout + MICROSECONDS_IN_MILLISECONDS;
+ const uint32_t kNewTimeout = kTimeout + MILLISECONDS_IN_SECOND;
conn->StartHeartBeat(kSession);
conn->SetHeartBeatTimeout(kNewTimeout, kSession);
// new timeout greater by old timeout so mock object shouldn't be invoked
- testing::Mock::AsyncVerifyAndClearExpectations(kTimeout *
- MICROSECONDS_IN_MILLISECONDS);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout);
}
TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
@@ -190,12 +189,11 @@ TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
EXPECT_CALL(connection_handler_mock, CloseConnection(_));
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession));
- const uint32_t kNewTimeout = kTimeout - MICROSECONDS_IN_MILLISECONDS;
+ const uint32_t kNewTimeout = kTimeout - MILLISECONDS_IN_SECOND;
conn->StartHeartBeat(kSession);
conn->SetHeartBeatTimeout(kNewTimeout, kSession);
// new timeout less than old timeout so mock object should be invoked
- testing::Mock::AsyncVerifyAndClearExpectations(kTimeout * 2 *
- MICROSECONDS_IN_MILLISECONDS);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout * 2);
}
} // namespace connection_handler_test
diff --git a/src/components/formatters/test/CFormatterJsonBase_test.cc b/src/components/formatters/test/CFormatterJsonBase_test.cc
index faed61ae26..5f8fc8ff71 100644
--- a/src/components/formatters/test/CFormatterJsonBase_test.cc
+++ b/src/components/formatters/test/CFormatterJsonBase_test.cc
@@ -32,9 +32,7 @@
#include <string>
#include <algorithm>
-#include "json/value.h"
#include "gtest/gtest.h"
-#include "json/reader.h"
#include "formatters/CFormatterJsonBase.h"
#include "formatters/generic_json_formatter.h"
#include "utils/json_utils.h"
@@ -57,7 +55,6 @@ TEST(CFormatterJsonBaseTest, JSonStringValueToSmartObj_ExpectSuccessful) {
SmartObject object;
// Convert json to smart object
const JsonValueRef json_value_ref = json_value;
-
CFormatterJsonBase::jsonValueToObj(json_value_ref, object);
// Check conversion was successful
EXPECT_EQ(string_val, object.asString());
@@ -75,11 +72,10 @@ TEST(CFormatterJsonBaseTest, JSonDoubleValueToSmartObj_ExpectSuccessful) {
EXPECT_DOUBLE_EQ(dval, object.asDouble());
}
-// TODO(OHerasym) : DCHECK on QT platform
TEST(CFormatterJsonBaseTest, JSonMinIntValueToSmartObj_ExpectSuccessful) {
// Arrange value
- const Json::Int ival = Json::Value::minInt;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ival));
+ const JsonValue::Int ival = std::numeric_limits<JsonValue::Int>::min();
+ const JsonValue json_value(ival);
SmartObject object;
// Convert json to smart object
const JsonValueRef json_value_ref = json_value;
@@ -88,11 +84,10 @@ TEST(CFormatterJsonBaseTest, JSonMinIntValueToSmartObj_ExpectSuccessful) {
EXPECT_EQ(ival, object.asInt());
}
-// TODO(OHerasym) : DCHECK on QT platform
TEST(CFormatterJsonBaseTest, JSonNullIntValueToSmartObj_ExpectSuccessful) {
// Arrange value
- const Json::Int ival = Json::nullValue;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ival));
+ const JsonValue::Int ival = utils::json::ValueType::NULL_VALUE;
+ const JsonValue json_value(ival);
SmartObject object;
// Convert json to smart object
const JsonValueRef json_value_ref = json_value;
@@ -101,11 +96,10 @@ TEST(CFormatterJsonBaseTest, JSonNullIntValueToSmartObj_ExpectSuccessful) {
EXPECT_EQ(ival, object.asInt());
}
-// TODO(OHerasym) : DCHECK on QT platform
TEST(CFormatterJsonBaseTest, JSonSignedMaxIntValueToSmartObj_ExpectSuccessful) {
// Arrange value
- const Json::Int ival = Json::Value::maxInt;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ival));
+ const JsonValue::Int ival = std::numeric_limits<JsonValue::Int>::max();
+ const JsonValue json_value(ival);
SmartObject object;
// Convert json to smart object
const JsonValueRef json_value_ref = json_value;
@@ -114,12 +108,12 @@ TEST(CFormatterJsonBaseTest, JSonSignedMaxIntValueToSmartObj_ExpectSuccessful) {
EXPECT_EQ(ival, object.asInt());
}
-// TODO(OHerasym) : DCHECK on QT platform
+// TODO (ANosach): SmartObject does not support uint64_t correctly
TEST(CFormatterJsonBaseTest,
- JSonUnsignedMaxIntValueToSmartObj_ExpectSuccessful) {
+ DISABLED_JSonUnsignedMaxIntValueToSmartObj_ExpectSuccessful) {
// Arrange value
- const Json::UInt ui_val = Json::Value::maxUInt;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ui_val));
+ const JsonValue::UInt ui_val = std::numeric_limits<JsonValue::UInt>::max();
+ const JsonValue json_value(ui_val);
SmartObject object;
// Convert json to smart object
const JsonValueRef json_value_ref = json_value;
@@ -128,38 +122,6 @@ TEST(CFormatterJsonBaseTest,
EXPECT_EQ(ui_val, object.asUInt());
}
-// TODO(OHerasym) : jsoncpp/src/lib_json/json_value.cpp:1073 assert fails
-TEST(CFormatterJsonBaseTest,
- DISABLED_JSonSignedMaxInt64ValueToSmartObj_ExpectSuccess) {
- // Arrange value
- const Json::Int64 ival = Json::Value::maxInt64;
- // Json value from maximum possible signed int
- JsonValue json_value(ival);
- SmartObject object;
- // Convert json to smart object
- JsonValueRef json_value_ref = json_value;
- json_value_ref.Append(json_value);
- CFormatterJsonBase::jsonValueToObj(json_value_ref, object);
- // Check conversion was successful
- EXPECT_EQ(ival, object.asInt());
-}
-
-// TODO(OHerasym) : jsoncpp/src/lib_json/json_value.cpp:1073 assert fails
-TEST(CFormatterJsonBaseTest,
- DISABLED_JSonUnsignedMaxInt64ValueToSmartObj_ExpectFailed) {
- // Arrange value
- const Json::UInt64 ival = Json::Value::maxUInt64;
- // Json value from max possible unsigned int
- const JsonValue json_value(ival);
- SmartObject object;
- // Convert json to smart object
- JsonValueRef json_value_ref = json_value;
- json_value_ref.Append(json_value);
- CFormatterJsonBase::jsonValueToObj(json_value_ref, object);
- // Check conversion was not successful as there is no such conversion
- EXPECT_EQ(invalid_int64_value, object.asInt());
-}
-
TEST(CFormatterJsonBaseTest, JSonBoolValueToSmartObj_ExpectSuccessful) {
// Arrange value
const bool bval1 = true;
@@ -225,7 +187,7 @@ TEST(CFormatterJsonBaseTest, JSonObjectValueToSmartObj_ExpectSuccessful) {
std::set<std::string> keys = object.enumerate();
std::set<std::string>::iterator it1 = keys.begin();
// Get members names(keys) from Json object
- Json::Value::Members mems = json_value.GetMemberNames();
+ JsonValue::Members mems = json_value.GetMemberNames();
std::vector<std::string>::iterator it;
// Compare sizes
EXPECT_EQ(mems.size(), keys.size());
@@ -243,8 +205,7 @@ TEST(CFormatterJsonBaseTest, StringSmartObjectToJSon_ExpectSuccessful) {
// Arrange value
const std::string string_val("test_string");
SmartObject object(string_val);
- const JsonValue json_value(string_val);
- // Json value from string
+ const JsonValue json_value;
// Convert smart object to json
const JsonValueRef json_value_ref = json_value;
CFormatterJsonBase::objToJsonValue(object, json_value_ref);
@@ -255,50 +216,47 @@ TEST(CFormatterJsonBaseTest, StringSmartObjectToJSon_ExpectSuccessful) {
TEST(CFormatterJsonBaseTest, DoubleSmartObjectToJSon_ExpectSuccessful) {
// Arrange value
const double dval = 3.512;
- const JsonValue json_value(dval);
- // Json value from double
SmartObject object(dval);
- // Convert json to smart object
+ const JsonValue json_value;
+ // Convert smart object to json
const JsonValueRef json_value_ref = json_value;
CFormatterJsonBase::objToJsonValue(object, json_value_ref);
// Check conversion was successful
EXPECT_DOUBLE_EQ(dval, json_value.AsDouble());
}
-// TODO(OHerasym) : DCHECK on QT platform
TEST(CFormatterJsonBaseTest, ZeroIntSmartObjectToJSon_ExpectSuccessful) {
// Arrange value
- const Json::Int ival = Json::nullValue;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ival));
- // Json value from zero int
- SmartObject object(ival);
- // Convert json to smart object
+ const JsonValue::Int ival = utils::json::ValueType::NULL_VALUE;
+ SmartObject object(utils::ConvertLongLongIntToInt64(ival));
+ const JsonValue json_value;
+ // Convert smart object to json
const JsonValueRef json_value_ref = json_value;
CFormatterJsonBase::objToJsonValue(object, json_value_ref);
// Check conversion was successful
EXPECT_EQ(ival, json_value.AsInt());
}
-// TODO(OHerasym) : DCHECK on QT platform
TEST(CFormatterJsonBaseTest, MinIntSmartObjectToJSon_ExpectSuccessful) {
// Arrange value
- const Json::Int ival = Json::Value::minInt;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ival));
- SmartObject object(ival);
- // Convert json to smart object
+ const JsonValue::Int ival = std::numeric_limits<JsonValue::Int>::min();
+ SmartObject object(utils::ConvertLongLongIntToInt64(ival));
+ const JsonValue json_value;
+ // Convert smart object to json
const JsonValueRef json_value_ref = json_value;
CFormatterJsonBase::objToJsonValue(object, json_value_ref);
// Check conversion was successful
EXPECT_EQ(ival, json_value.AsInt());
}
-// TODO(OHerasym) : assert (convert <= std::numeric_limits<int32_t>::max())
-TEST(CFormatterJsonBaseTest, UnsignedMaxIntSmartObjectToJSon_ExpectSuccessful) {
+// TODO (ANosach): SmartObject does not support uint64_t correctly
+TEST(CFormatterJsonBaseTest,
+ DISABLED_UnsignedMaxIntSmartObjectToJSon_ExpectSuccessful) {
// Arrange value
- const Json::UInt ui_val = Json::Value::maxUInt;
- const JsonValue json_value(utils::ConvertInt64ToLongLongInt(ui_val));
- SmartObject object(ui_val);
- // Convert json to smart object
+ const JsonValue::UInt ui_val = std::numeric_limits<JsonValue::UInt>::max();
+ SmartObject object(utils::ConvertLongLongUIntToUInt64(ui_val));
+ const JsonValue json_value;
+ // Convert smart object to json
const JsonValueRef json_value_ref = json_value;
CFormatterJsonBase::objToJsonValue(object, json_value_ref);
// Check conversion was successful
@@ -313,7 +271,7 @@ TEST(CFormatterJsonBaseTest, BoolSmartObjectToJSon_ExpectSuccessful) {
const JsonValue json_value2;
SmartObject object1(bval1);
SmartObject object2(bval2);
- // Convert json to smart object
+ // Convert smart object to json
const JsonValueRef json_value_ref1 = json_value1;
const JsonValueRef json_value_ref2 = json_value2;
CFormatterJsonBase::objToJsonValue(object1, json_value_ref1);
@@ -323,19 +281,6 @@ TEST(CFormatterJsonBaseTest, BoolSmartObjectToJSon_ExpectSuccessful) {
EXPECT_FALSE(json_value2.AsBool());
}
-// TODO(OHerasym() : no CSTRING method in JsonValue
-TEST(CFormatterJsonBaseTest, CStringSmartObjectToJSon_ExpectSuccessful) {
- // Arrange value
- const char* cstr_val = "cstring_test";
- const JsonValue json_value(cstr_val); // Json value from const char*
- SmartObject object(cstr_val);
- // Convert json to smart object
- const JsonValueRef json_value_ref = json_value;
- CFormatterJsonBase::objToJsonValue(object, json_value_ref);
- // Check conversion was successful
- // EXPECT_STREQ(cstr_val, json_value.asCString());
-}
-
TEST(CFormatterJsonBaseTest, ArraySmartObjectToJSon_ExpectSuccessful) {
// Arrange value
const char* json_array =
@@ -378,7 +323,7 @@ TEST(CFormatterJsonBaseTest, JSonObjectValueToObj_ExpectSuccessful) {
std::set<std::string> keys = object.enumerate();
std::set<std::string>::iterator it1 = keys.begin();
// Get members names(keys) from Json object
- Json::Value::Members mems = result.GetMemberNames();
+ JsonValue::Members mems = result.GetMemberNames();
std::vector<std::string>::iterator it;
// Compare sizes
EXPECT_EQ(mems.size(), keys.size());
diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
index bc6529fc19..9360aec402 100644
--- a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
+++ b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
@@ -39,7 +39,7 @@ namespace test {
namespace components {
namespace formatters {
-TEST(CFormatterJsonSDLRPCv2Test, DISABLED_EmptySmartObjectToString) {
+TEST(CFormatterJsonSDLRPCv2Test, EmptySmartObjectToString) {
SmartObject srcObj;
EXPECT_EQ(Errors::eType::OK, srcObj.validate());
@@ -49,13 +49,12 @@ TEST(CFormatterJsonSDLRPCv2Test, DISABLED_EmptySmartObjectToString) {
EXPECT_TRUE(result);
- std::string expectOutputJsonString = "null";
+ std::string expectOutputJsonString = "\"\"";
CompactJson(jsonString);
EXPECT_EQ(expectOutputJsonString, jsonString);
}
-TEST(CFormatterJsonSDLRPCv2Test,
- DISABLED_SmObjWithRequestWithoutMsgNotValid_ToString) {
+TEST(CFormatterJsonSDLRPCv2Test, SmObjWithRequestWithoutMsgNotValid_ToString) {
SmartObject srcObj;
CSmartSchema schema = initObjectSchema();
srcObj.setSchema(schema);
@@ -72,7 +71,7 @@ TEST(CFormatterJsonSDLRPCv2Test,
bool result = CFormatterJsonSDLRPCv2::toString(srcObj, jsonString);
EXPECT_TRUE(result);
- std::string expectOutputJsonString = "null";
+ std::string expectOutputJsonString = "\"\"";
CompactJson(jsonString);
EXPECT_EQ(expectOutputJsonString, jsonString);
}
@@ -220,7 +219,7 @@ TEST(CFormatterJsonSDLRPCv2Test, SmObjWithResponseToString) {
}
TEST(CFormatterJsonSDLRPCv2Test,
- DISABLED_SmObjWithResponseWithoutSchemaWithoutParamsToString) {
+ SmObjWithResponseWithoutSchemaWithoutParamsToString) {
SmartObject srcObj;
srcObj[S_PARAMS][S_MESSAGE_TYPE] = MessageTypeTest::response;
std::string jsonString;
@@ -229,7 +228,7 @@ TEST(CFormatterJsonSDLRPCv2Test,
EXPECT_TRUE(result);
- std::string expectOutputJsonString = "null";
+ std::string expectOutputJsonString = "\"\"";
CompactJson(jsonString);
EXPECT_EQ(expectOutputJsonString, jsonString);
}
diff --git a/src/components/formatters/test/formatter_json_rpc_test.cc b/src/components/formatters/test/formatter_json_rpc_test.cc
index 5677d81e23..4a6d8adb61 100644
--- a/src/components/formatters/test/formatter_json_rpc_test.cc
+++ b/src/components/formatters/test/formatter_json_rpc_test.cc
@@ -122,10 +122,7 @@ TEST(FormatterJsonRPCTest, CorrectRPCv2Request_ToString_Success) {
EXPECT_EQ(json_string, result);
}
-// TODO(OHerasym) : assertion failed: (convert <=
-// std::numeric_limits<int32_t>::max())
-TEST(FormatterJsonRPCTest,
- DISABLED_UpperBoundValuesInSystemRequest_ToString_Success) {
+TEST(FormatterJsonRPCTest, UpperBoundValuesInSystemRequest_ToString_Success) {
// Create SmartObject
SmartObject obj;
obj[S_PARAMS][S_FUNCTION_ID] =
@@ -400,10 +397,7 @@ TEST(FormatterJsonRPCTest, ResponseToSmartObject_Success) {
EXPECT_EQ(2, obj["params"]["protocol_version"].asInt());
}
-// TODO(OHerasym) : Assertion failed: (convert <=
-// std::numeric_limits<int32_t>::max())
-TEST(FormatterJsonRPCTest,
- DISABLED_StringWithUpperBoundValueToSmartObject_Success) {
+TEST(FormatterJsonRPCTest, StringWithUpperBoundValueToSmartObject_Success) {
// Source Json string
const std::string json_string(
"{\"jsonrpc\":\"2.0\",\"method\":\"BasicCommunication.OnSystemRequest\","
diff --git a/src/components/resumption/test/last_state_test.cc b/src/components/resumption/test/last_state_test.cc
index 6998e0911f..533445d95c 100644
--- a/src/components/resumption/test/last_state_test.cc
+++ b/src/components/resumption/test/last_state_test.cc
@@ -67,12 +67,12 @@ class LastStateTest : public ::testing::Test {
resumption::LastState last_state_;
};
-TEST_F(LastStateTest, DISABLED_Basic) {
+TEST_F(LastStateTest, Basic) {
utils::json::JsonValue& dictionary = last_state_.dictionary();
EXPECT_EQ("null\n", dictionary.ToJson(true));
}
-TEST_F(LastStateTest, DISABLED_SetGetData) {
+TEST_F(LastStateTest, SetGetData) {
{
utils::json::JsonValue& dictionary = last_state_.dictionary();
utils::json::JsonValue bluetooth_info =
diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc
index 944b96df7f..ee30bf81da 100644
--- a/src/components/security_manager/test/crypto_manager_impl_test.cc
+++ b/src/components/security_manager/test/crypto_manager_impl_test.cc
@@ -134,20 +134,27 @@ TEST_F(CryptoManagerTest, UsingBeforeInit) {
crypto_manager_->LastError());
}
-TEST_F(CryptoManagerTest, DISABLED_WrongInit) {
+TEST_F(CryptoManagerTest, WrongInit) {
// We have to cast (-1) to security_manager::Protocol Enum to be accepted by
// crypto_manager_->Init(...)
// Unknown protocol version
- security_manager::Protocol UNKNOWN =
+ const security_manager::Protocol UNKNOWN =
static_cast<security_manager::Protocol>(-1);
+ const std::string cert_path = "";
EXPECT_CALL(*mock_security_manager_settings_, security_manager_mode())
.WillRepeatedly(Return(security_manager::SERVER));
EXPECT_CALL(*mock_security_manager_settings_,
- security_manager_protocol_name()).WillOnce(Return(UNKNOWN));
- EXPECT_FALSE(crypto_manager_->Init());
+ security_manager_protocol_name())
+ .WillRepeatedly(Return(UNKNOWN));
+ EXPECT_CALL(*mock_security_manager_settings_, verify_peer())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_security_manager_settings_, ca_cert_path())
+ .WillRepeatedly(ReturnRef(cert_path));
+ EXPECT_FALSE(crypto_manager_->Init());
EXPECT_NE(std::string(), crypto_manager_->LastError());
+
// Unexistent cipher value
const std::string invalid_cipher = "INVALID_UNKNOWN_CIPHER";
EXPECT_CALL(*mock_security_manager_settings_,
@@ -157,8 +164,8 @@ TEST_F(CryptoManagerTest, DISABLED_WrongInit) {
.WillOnce(ReturnRef(certificate_data_base64_));
EXPECT_CALL(*mock_security_manager_settings_, ciphers_list())
.WillRepeatedly(ReturnRef(invalid_cipher));
- EXPECT_FALSE(crypto_manager_->Init());
+ EXPECT_FALSE(crypto_manager_->Init());
EXPECT_NE(std::string(), crypto_manager_->LastError());
}
diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h
index a320359b35..c3f95eca6b 100644
--- a/src/components/smart_objects/include/smart_objects/smart_object.h
+++ b/src/components/smart_objects/include/smart_objects/smart_object.h
@@ -230,14 +230,21 @@ class SmartObject FINAL {
**/
bool operator==(const int32_t Value) const;
- // Support of type: uint32_t
/**
- * @brief Constructor for creating object of type: int32_t
+ * @brief Constructor for creating object of type: uint32_t
*
* @param InitialValue Initial object value
**/
explicit SmartObject(const uint32_t InitialValue);
+ // Support of type: uint64_t
+ /**
+ * @brief Constructor for creating object of type: uint64_t
+ *
+ * @param InitialValue Initial object value
+ **/
+ explicit SmartObject(const uint64_t InitialValue);
+
/**
* @brief Returns current object converted to uint64_t
*
diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc
index eae2bc3ffe..d18f377a65 100644
--- a/src/components/smart_objects/src/smart_object.cc
+++ b/src/components/smart_objects/src/smart_object.cc
@@ -178,8 +178,8 @@ int64_t SmartObject::asInt() const {
if (invalid_int64_value == convert) {
return invalid_int_value;
}
- DCHECK(convert >= std::numeric_limits<int32_t>::min());
- DCHECK(convert <= std::numeric_limits<int32_t>::max());
+ DCHECK(convert >= std::numeric_limits<int64_t>::min());
+ DCHECK(convert <= std::numeric_limits<int64_t>::max());
return static_cast<int64_t>(convert);
}
@@ -278,6 +278,12 @@ bool SmartObject::operator==(const int64_t Value) const {
return comp == Value;
}
+SmartObject::SmartObject(const uint64_t InitialValue)
+ : m_type(SmartType_Null), m_schema() {
+ m_data.str_value = NULL;
+ set_value_integer(InitialValue);
+}
+
SmartObject& SmartObject::operator=(const uint64_t NewValue) {
if (m_type != SmartType_Invalid) {
set_value_integer(NewValue);
diff --git a/src/components/utils/test/custom_string_test.cc b/src/components/utils/test/custom_string_test.cc
index 706aee5f21..0b58902f4b 100644
--- a/src/components/utils/test/custom_string_test.cc
+++ b/src/components/utils/test/custom_string_test.cc
@@ -257,7 +257,7 @@ TEST_F(
}
TEST_F(CustomStringTest,
- DISABLED_AddUTF8StringToCustomString_ExpectCorrectConvertingToWString) {
+ AddUTF8StringToCustomString_ExpectCorrectConvertingToWString) {
custom_str::CustomString obj(CustomStringTest::mbstring1_);
custom_str::CustomString obj1(CustomStringTest::mbstring2_);
std::wstring wstr1(L"Тест");
@@ -298,7 +298,7 @@ TEST_F(
TEST_F(
CustomStringTest,
- DISABLED_AddSameMultiByteStringsToCustomString_ExpectCorrectCaseInsensitiveComparing) {
+ AddSameMultiByteStringsToCustomString_ExpectCorrectCaseInsensitiveComparing) {
const size_t kSizeStr = 8;
uint8_t array[] = {0xD1,
0x82,