summaryrefslogtreecommitdiff
path: root/src/components/smart_objects/test/BoolSchemaItem_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/smart_objects/test/BoolSchemaItem_test.cc')
-rw-r--r--src/components/smart_objects/test/BoolSchemaItem_test.cc38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/components/smart_objects/test/BoolSchemaItem_test.cc b/src/components/smart_objects/test/BoolSchemaItem_test.cc
index 8e39af8e08..dd6939443c 100644
--- a/src/components/smart_objects/test/BoolSchemaItem_test.cc
+++ b/src/components/smart_objects/test/BoolSchemaItem_test.cc
@@ -63,14 +63,15 @@ TEST(test_no_default_value, test_BoolSchemaItemTest) {
obj = 5;
ASSERT_EQ(5, obj.asInt());
- int resultType = item->validate(obj);
+ std::string errorMessage;
+ int resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
obj = true;
ASSERT_TRUE(obj.asBool());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
@@ -79,12 +80,12 @@ TEST(test_no_default_value, test_BoolSchemaItemTest) {
obj = "Test";
ASSERT_EQ(std::string("Test"), obj.asString());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
}
@@ -109,14 +110,15 @@ TEST(test_item_with_default_value, test_BoolSchemaItemTest) {
obj = 5;
ASSERT_EQ(5, obj.asInt());
- int resultType = item->validate(obj);
+ std::string errorMessage;
+ int resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
obj = true;
ASSERT_TRUE(obj.asBool());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
@@ -125,14 +127,14 @@ TEST(test_item_with_default_value, test_BoolSchemaItemTest) {
obj = "Test";
ASSERT_EQ(std::string("Test"), obj.asString());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_FALSE(obj.asBool());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
EXPECT_FALSE(obj.asBool());
}
@@ -147,10 +149,11 @@ TEST(test_map_validate, test_BoolSchemaItemTest) {
obj["aa"] = true;
ASSERT_TRUE(obj["aa"].asBool());
- int resultType = item->validate(obj["aa"]);
+ std::string errorMessage;
+ int resultType = item->validate(obj["aa"], errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
@@ -162,11 +165,11 @@ TEST(test_map_validate, test_BoolSchemaItemTest) {
EXPECT_TRUE(resDefault);
EXPECT_FALSE(obj.asBool());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
obj["ind"] = true;
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
}
@@ -182,13 +185,14 @@ TEST(test_array_validate, test_BoolSchemaItemTest) {
ASSERT_TRUE(obj[0].asBool());
ASSERT_FALSE(obj[1].asBool());
- int resultType = item->validate(obj[0]);
+ std::string errorMessage;
+ int resultType = item->validate(obj[0], errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
- resultType = item->validate(obj[1]);
+ resultType = item->validate(obj[1], errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
@@ -200,13 +204,13 @@ TEST(test_array_validate, test_BoolSchemaItemTest) {
EXPECT_FALSE(resDefault);
EXPECT_FALSE(obj[1].asBool());
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
resultType);
obj = false;
- resultType = item->validate(obj);
+ resultType = item->validate(obj, errorMessage);
EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
}