2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
17 * @file test-common.cpp
18 * @author Kyungwook Tak (k.tak@samsung.com)
21 #include "test-common.h"
30 std::string bytes_to_hex(const std::vector<unsigned char> &bytes)
36 ss << std::setw(2) << std::setfill('0') << static_cast<int>(b);
41 std::vector<unsigned char> bytearr_to_vec(const unsigned char *bytes, size_t len)
43 if (bytes == nullptr || len == 0)
44 return std::vector<unsigned char>();
46 std::vector<unsigned char> vec;
48 for (size_t i = 0; i < len; ++i)
49 vec.push_back(bytes[i]);