Fix failing tc03_cynara_check_invalid_params test 33/128633/2
authorRadoslaw Bartosiak <r.bartosiak@samsung.com>
Wed, 10 May 2017 16:34:43 +0000 (18:34 +0200)
committerRadoslaw Bartosiak <r.bartosiak@samsung.com>
Mon, 15 May 2017 12:33:21 +0000 (14:33 +0200)
Removed initialization of std::string from nullptr (undefined behaviour)
by function overloading - new version takes const char* args.

Change-Id: I62d3c0b00dcfba6fe2f1acb1e752dae5f4dca961
Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
src/cynara-tests/common/cynara_test_client.cpp
src/cynara-tests/common/cynara_test_client.h

index 373130e..357b66a 100644 (file)
@@ -33,19 +33,24 @@ Client::~Client()
 {
     cynara_finish(m_cynara);
 }
+void Client::check(const char *client, const char *session, const char *user,
+                   const char *privilege, int expectedResult)
+{
+    int ret = cynara_check(m_cynara, client, session, user, privilege);
+    RUNNER_ASSERT_MSG(ret == expectedResult,
+                         "cynara_check returned wrong value: "
+                             << ret << " != " << expectedResult << "."
+                             << " client: " << formatCstr(client) << ","
+                             << " session: " << formatCstr(session) << ","
+                             << " user: " << formatCstr(user) << ","
+                             << " privilege: " << formatCstr(privilege));
+}
 
 void Client::check(const std::string &client, const std::string &session,
                    const std::string &user, const std::string &privilege,
                    int expectedResult)
 {
-    int ret = cynara_check(m_cynara, client.c_str(), session.c_str(), user.c_str(), privilege.c_str());
-    RUNNER_ASSERT_MSG(ret == expectedResult,
-                         "cynara_check returned wrong value: "
-                             << ret << " != " << expectedResult << "."
-                             << " client: " << formatCstr(client.c_str()) << ","
-                             << " session: " << formatCstr(session.c_str()) << ","
-                             << " user: " << formatCstr(user.c_str()) << ","
-                             << " privilege: " << formatCstr(privilege.c_str()));
+    check(client.c_str(), session.c_str(), user.c_str(), privilege.c_str(), expectedResult);
 }
 
 } //namespace CynaraTestClient
index 5e055d1..53687be 100644 (file)
@@ -29,10 +29,11 @@ public:
     Client();
     virtual ~Client();
 
+    void check(const char *client, const char *session, const char *user, const char *privilege,
+               int expectedResult = CYNARA_API_ACCESS_ALLOWED);
     void check(const std::string &client, const std::string &session,
                const std::string &user, const std::string &privilege,
                int expectedResult = CYNARA_API_ACCESS_ALLOWED);
-
 private:
     struct cynara *m_cynara;
 };