2 * Copyright (c) 2014 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 #include <cynara_test_client.h>
19 #include <tests_common.h>
21 namespace CynaraTestClient {
26 int ret = cynara_initialize(&m_cynara, nullptr);
27 RUNNER_ASSERT_MSG(ret == CYNARA_API_SUCCESS,
28 "cynara_initialize failed. ret: " << ret);
29 RUNNER_ASSERT_MSG(m_cynara != nullptr, "cynara struct was not initialized");
34 cynara_finish(m_cynara);
37 void Client::check(const std::string &client, const std::string &session,
38 const std::string &user, const std::string &privilege,
41 int ret = cynara_check(m_cynara, client.c_str(), session.c_str(), user.c_str(), privilege.c_str());
42 RUNNER_ASSERT_MSG(ret == expectedResult,
43 "cynara_check returned wrong value: "
44 << ret << " != " << expectedResult << "."
45 << " client: " << formatCstr(client.c_str()) << ","
46 << " session: " << formatCstr(session.c_str()) << ","
47 << " user: " << formatCstr(user.c_str()) << ","
48 << " privilege: " << formatCstr(privilege.c_str()));
51 } //namespace CynaraTestClient