summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kutsan <akutsan@luxoft.com>2017-07-24 11:13:21 +0300
committerAlex Kutsan <akutsan@luxoft.com>2017-07-24 11:29:11 +0300
commit7ff2c88d13288b2e5dd2a1438806be3d932935f3 (patch)
tree5a4c03314d4b512ac7c6e82cffb159f896cb00a5
parent0139dbcaaad45c69ba5baea478358c877841a9c9 (diff)
downloadsdl_core-7ff2c88d13288b2e5dd2a1438806be3d932935f3.tar.gz
Remove redundant, not related to code unit tests
-rw-r--r--src/components/can_cooperation/test/CMakeLists.txt1
-rw-r--r--src/components/can_cooperation/test/src/vehicle_data_subscription_test.cc142
2 files changed, 0 insertions, 143 deletions
diff --git a/src/components/can_cooperation/test/CMakeLists.txt b/src/components/can_cooperation/test/CMakeLists.txt
index f7510ba7f0..f114f31a27 100644
--- a/src/components/can_cooperation/test/CMakeLists.txt
+++ b/src/components/can_cooperation/test/CMakeLists.txt
@@ -18,7 +18,6 @@ set (SOURCES
src/can_module_test.cc
src/can_app_extension_test.cc
#src/can_library_test.cc
- src/vehicle_data_subscription_test.cc
${CMAKE_SOURCE_DIR}/src/components/application_manager/test/mock_message_helper.cc
)
diff --git a/src/components/can_cooperation/test/src/vehicle_data_subscription_test.cc b/src/components/can_cooperation/test/src/vehicle_data_subscription_test.cc
deleted file mode 100644
index 4e366d5bca..0000000000
--- a/src/components/can_cooperation/test/src/vehicle_data_subscription_test.cc
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gtest/gtest.h"
-#include "json/json.h"
-
-namespace can_cooperation {
-
-TEST(VehicleDataSubscription, CompareSuccess) {
- std::string json_str1 =
- "{\"jsonrpc\": \"2.0\", \"method\": \"RC.OnInteriorVehicleData\",\
- \"params\": {\"moduleData\": {\"moduleType\": \"CLIMATE\"}}}";
- std::string json_str2 =
- "{\"method\": \"RC.OnInteriorVehicleData\",\
- \"params\": {\"moduleData\": {\
- \"moduleType\": \"CLIMATE\" }},\
- \"jsonrpc\": \"2.0\"}";
-
- Json::Value json1;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_str1, json1, false));
- Json::Value json2;
- ASSERT_TRUE(reader.parse(json_str1, json2, false));
-
- ASSERT_FALSE(json1 < json2 || json2 < json1);
-
- ASSERT_TRUE(reader.parse(json_str2, json2, false));
-
- ASSERT_FALSE(json1 < json2 || json2 < json1);
-
- std::set<Json::Value> subscribed;
- subscribed.insert(json1["params"]["moduleData"]);
- subscribed.insert(json2["params"]["moduleData"]);
-
- ASSERT_FALSE(subscribed.end() ==
- subscribed.find(json2["params"]["moduleData"]));
-}
-
-TEST(VehicleDataSubscription, CompareNull) {
- std::string json_str1 =
- "{\"jsonrpc\": \"2.0\", \"method\": \"RC.OnInteriorVehicleData\",\
- \"params\": {\"moduleData\": {\"moduleType\": \"CLIMATE\"}}}";
- Json::Value json1;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_str1, json1, false));
- Json::Value json2(Json::ValueType::nullValue);
-
- ASSERT_FALSE(json1 < json2);
- // -- Pay attention: null value is less then object:
- // doesn't work: ASSERT_FALSE(json2 < json1);
-}
-
-TEST(VehicleDataSubscription, CompareDifferentTypes) {
- std::string json_str1 =
- "{\"jsonrpc\": \"2.0\", \"method\": \"RC.OnInteriorVehicleData\",\
- \"params\": {\"moduleData\": {\"moduleType\": \"CLIMATE\"}}}";
- std::string json_str2 = "\"method\": \"RC.OnInteriorVehicleData\"";
-
- Json::Value json1;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_str1, json1, false));
- ASSERT_TRUE(json1.type() == Json::ValueType::objectValue);
- Json::Value json2;
- ASSERT_TRUE(reader.parse(json_str2, json2, false));
- ASSERT_TRUE(json2.type() == Json::ValueType::stringValue);
-
- ASSERT_FALSE(json1 < json2);
- // -- Pay attention: string type is less than object
- // doesn't work: ASSERT_FALSE(json2 < json1);
-}
-
-TEST(VehicleDataSubscription, CompareDifferentNesting) {
- std::string json_str1 =
- "{\"jsonrpc\": \"2.0\", \"method\": \"RC.OnInteriorVehicleData\",\
- \"params\": {\"moduleData\": {\"moduleType\": \"CLIMATE\"}}}";
- std::string json_str2 = "{\"moduleData\": {\"moduleType\": \"CLIMATE\"}}";
-
- Json::Value json1;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_str1, json1, false));
- Json::Value json2;
- ASSERT_TRUE(reader.parse(json_str2, json2, false));
-
- ASSERT_TRUE(json2 < json1);
-}
-
-TEST(VehicleDataSubscription, CompareModuleTypes) {
- Json::Value json1;
- json1["moduleType"] = "RADIO";
-
- Json::Value json2;
- json2["moduleData"] = Json::Value(Json::ValueType::objectValue);
- json2["moduleData"]["radioControlData"] =
- Json::Value(Json::ValueType::objectValue);
- json2["moduleData"]["moduleType"] = "RADIO";
-
- ASSERT_FALSE(json1["moduleType"] == json2["moduleData"]);
-
- Json::Value json3;
- json3["moduleType"] = json2["moduleData"]["moduleType"];
-
- ASSERT_TRUE(json1["moduleType"] == json3);
-
- std::set<Json::Value> subscribed;
- subscribed.insert(json1["moduleType"]);
- Json::Value null_val(Json::ValueType::nullValue);
- subscribed.insert(null_val);
- ASSERT_FALSE(subscribed.end() == subscribed.find(json3));
-
- ASSERT_FALSE(subscribed.end() == subscribed.find(Json::Value()));
-}
-
-} // namespace can_cooperation