summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSho Amano <samano@xevo.com>2017-08-11 11:59:12 +0900
committerSho Amano <samano@xevo.com>2017-08-11 12:26:28 +0900
commit48ecad1ebf4b1cd7c6c555a3834833bd9f1fa8df (patch)
tree1292a2c899c7969ca045967eb3a9d5ba70a78b6e /src
parentc808f7140d9051250f8f3d1c65d92016edfeb369 (diff)
downloadsdl_core-48ecad1ebf4b1cd7c6c555a3834833bd9f1fa8df.tar.gz
Smarter implementation of ValidateList
Reflecting review comments.
Diffstat (limited to 'src')
-rw-r--r--src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc
index d209a475c5..a6248ed3c4 100644
--- a/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/navi_set_video_config_request_test.cc
@@ -30,6 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
+
#include "application_manager/commands/hmi/navi_set_video_config_request.h"
#include "gtest/gtest.h"
@@ -110,23 +112,9 @@ TEST_F(NaviSetVideoConfigRequestTest, OnEvent_SUCCESS) {
static bool ValidateList(std::vector<std::string>& expected,
std::vector<std::string>& actual) {
- if (expected.size() != actual.size()) {
- return false;
- }
- for (unsigned int i = 0; i < expected.size(); i++) {
- std::string& param = expected[i];
- unsigned int j;
- for (j = 0; j < actual.size(); j++) {
- if (param == actual[j]) {
- break;
- }
- }
- if (j == actual.size()) {
- // not found
- return false;
- }
- }
- return true;
+ std::sort(expected.begin(), expected.end());
+ std::sort(actual.begin(), actual.end());
+ return std::equal(expected.begin(), expected.end(), actual.begin());
}
TEST_F(NaviSetVideoConfigRequestTest, OnEvent_FAILURE) {