Refactor RawBuffer hex dumps
[platform/core/security/key-manager.git] / tests / test_common.cpp
index d01b92a..ab51cea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *  Copyright (c) 2016-2019 Samsung Electronics Co., Ltd. All rights reserved
  *
  *  Contact: Kyungwook Tak <k.tak@samsung.com>
  *
@@ -21,7 +21,6 @@
  * @brief
  */
 #include <test_common.h>
-#include <iostream>
 #include <cstdlib>
 #include <time.h>
 
@@ -61,14 +60,5 @@ RawBuffer createRandom(std::size_t size)
 //raw to hex string conversion from SqlConnection
 std::string rawToHexString(const RawBuffer &raw)
 {
-       std::string dump;
-
-       for (auto &e : raw) {
-               char buf[3];
-               snprintf(buf, sizeof(buf), "%02x", (e & 0xff));
-               dump.push_back(buf[0]);
-               dump.push_back(buf[1]);
-       }
-
-       return dump;
+       return hexDump<std::string>(raw);
 }