2 * Copyright (c) 2015 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 cynara_test_helpers.cpp
18 * @author Aleksander Zdyb <a.zdyb@samsung.com>
20 * @brief Helpers for cynara-helpers
23 #include <dpl/test/test_runner.h>
25 #include <cynara-creds-socket.h>
27 #include "cynara_test_helpers.h"
29 namespace CynaraHelperCredentials {
31 char *socketGetClient(int sock, cynara_client_creds method, int expectedResult) {
33 auto ret = cynara_creds_socket_get_client(sock, method, &buff);
34 RUNNER_ASSERT_MSG(ret == expectedResult,
35 "cynara_creds_socket_get_client failed, ret = " << ret
36 << "; expected = " << expectedResult);
40 char *socketGetUser(int sock, cynara_user_creds method, int expectedResult) {
42 auto ret = cynara_creds_socket_get_user(sock, method, &buff);
43 RUNNER_ASSERT_MSG(ret == expectedResult,
44 "cynara_creds_socket_get_user failed, ret = " << ret
45 << "; expected = " << expectedResult);
49 pid_t socketGetPid(int sock, int expectedResult) {
51 auto ret = cynara_creds_socket_get_pid(sock, &pid);
52 RUNNER_ASSERT_MSG(ret == expectedResult,
53 "cynara_creds_socket_get_pid failed, ret = " << ret << "; expected = "
58 } //namespace CynaraHelperCredentials