Przeglądaj źródła

fixed some typos and issues in tests

stefan 9 miesięcy temu
rodzic
commit
94c524357f

+ 11 - 11
src/shellmatta_auth.c

@@ -34,7 +34,7 @@
  * @return      #SHELLMATTA_BUSY    => reading in data
  *              #SHELLMATTA_OK      => delimiter (e.g. enter) detected
  */
-shellmatta_retCode_t inputWrapper(shellmatta_instance_t *inst, char data, bool hide)
+static shellmatta_retCode_t inputWrapper(shellmatta_instance_t *inst, char data, bool hide)
 {
     shellmatta_retCode_t ret = SHELLMATTA_BUSY;
     bool echoEnabledBackup = inst->echoEnabled;
@@ -108,7 +108,7 @@ static uint32_t getUserIdFromName(shellmatta_instance_t *inst, const char *usern
  * @param[in]       userId      userId to check the password for
  * @param[in]       password    password to check for - pointer to string
  */
-void checkPassword(shellmatta_handle_t handle, uint32_t userId, char *password)
+static void checkPassword(shellmatta_handle_t handle, uint32_t userId, char *password)
 {
     shellmatta_instance_t   *inst   = (shellmatta_instance_t*)handle;
     uint32_t                approvedUserId  = 0u;
@@ -144,11 +144,11 @@ void checkPassword(shellmatta_handle_t handle, uint32_t userId, char *password)
     /** -# print login result */
     if (0 == approvedUserId)
     {
-        shellmatta_write(handle, "username or password is wrong\r\n", 31);
+        SHELLMATTA_WRITE("username or password is wrong\r\n", 31);
     }
     else
     {
-        shellmatta_write(handle, "login successful\r\n", 18);
+        SHELLMATTA_WRITE("login successful\r\n", 18);
         (void)shellmatta_auth_login(handle, approvedUserId);
     }
 }
@@ -201,7 +201,7 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
                         }
                         break;
                     default:
-                        shellmatta_write(handle, "Unknown option\r\n", 16);
+                        SHELLMATTA_WRITE("Unknown option\r\n", 16);
                         return SHELLMATTA_USE_FAULT;
                         break;
                 }
@@ -220,13 +220,13 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
                 inst->cursor = 0u;
 
                 inst->tmpUserId = getUserIdFromName(handle, username);
-                shellmatta_write(handle, "\r\nenter password:\r\n", 19);
+                SHELLMATTA_WRITE("\r\nenter password:\r\n", 19);
                 inst->loginState = SHELLMATTA_AUTH_PASSWORD;
                 ret = SHELLMATTA_CONTINUE;
             }
             else if (NULL != password)
             {
-                shellmatta_write(handle, "Missing username\r\n", 18);
+                SHELLMATTA_WRITE("Missing username\r\n", 18);
                 ret = SHELLMATTA_USE_FAULT;
             }
             else
@@ -234,7 +234,7 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
                 /** -# no credentials are passed with the command - start the interactive input */
                 inst->inputCount = 0u;
                 inst->cursor = 0u;
-                shellmatta_write(handle, "enter username:\r\n", 17);
+                SHELLMATTA_WRITE("enter username:\r\n", 17);
                 inst->loginState = SHELLMATTA_AUTH_USERNAME;
                 ret = SHELLMATTA_CONTINUE;
             }
@@ -253,7 +253,7 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
                 inst->inputCount = 0u;
                 inst->cursor = 0u;
 
-                shellmatta_write(handle, "\r\nenter password:\r\n", 19);
+                SHELLMATTA_WRITE("\r\nenter password:\r\n", 19);
                 inst->loginState = SHELLMATTA_AUTH_PASSWORD;
             }
             ret = SHELLMATTA_CONTINUE;
@@ -266,7 +266,7 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
             {
                 /** -# check input username and password */
                 inst->buffer[inst->inputCount] = '\0';
-                shellmatta_write(handle, "\r\n", 2);
+                SHELLMATTA_WRITE("\r\n", 2);
                 checkPassword(handle, inst->tmpUserId, inst->buffer);
                 inst->loginState = SHELLMATTA_AUTH_IDLE;
             }
@@ -311,7 +311,7 @@ static shellmatta_retCode_t logoutCmdFct(const shellmatta_handle_t handle, const
     }
 
     shellmatta_auth_logout(handle);
-    shellmatta_write(handle, "good bye\r\n", 10);
+    SHELLMATTA_WRITE("good bye\r\n", 10);
 
     (void)arguments;
     (void)length;

+ 2 - 2
test/integrationtest/test_integration_help.cpp

@@ -55,7 +55,7 @@ static shellmatta_cmd_t cmd3 = {(char*)"cmd3", (char*)"", (char*)"", (char*)"",
 
 SCENARIO("Test the help function")
 {
-    GIVEN("An initialized and empty Shellmatte instance")
+    GIVEN("An initialized and empty Shellmatta instance")
     {
         shellmatta_instance_t inst;
         shellmatta_handle_t handle;
@@ -130,7 +130,7 @@ SCENARIO("Test the help function")
 
 SCENARIO("Test if the help command prints the usage correctly")
 {
-    GIVEN("An initialized and empty Shellmatte instance")
+    GIVEN("An initialized and empty Shellmatta instance")
     {
         shellmatta_instance_t inst;
         shellmatta_handle_t handle;

+ 3 - 3
test/integrationtest/test_integration_history.cpp

@@ -62,7 +62,7 @@ char *commandSequence[] =
 
 SCENARIO("Test the history buffer with a fixed sequence of commands in there")
 {
-    GIVEN("An initialized Shellmatte instance with some commands already in the history buffer")
+    GIVEN("An initialized Shellmatta instance with some commands already in the history buffer")
     {
         shellmatta_instance_t inst;
         shellmatta_handle_t handle;
@@ -244,7 +244,7 @@ SCENARIO("Test the history buffer with a fixed sequence of commands in there")
 
 SCENARIO("Test how the history buffer handles more commands than fits inside the buffer")
 {
-    GIVEN("An initialized Shellmatte instance with some commands already in the history buffer")
+    GIVEN("An initialized Shellmatta instance with some commands already in the history buffer")
     {
         shellmatta_instance_t inst;
         shellmatta_handle_t handle;
@@ -352,7 +352,7 @@ SCENARIO("Test how the history buffer handles more commands than fits inside the
 
 SCENARIO("Test if the history buffer stores changes done during navigating")
 {
-    GIVEN("An initialized Shellmatte instance with some commands already in the history buffer")
+    GIVEN("An initialized Shellmatta instance with some commands already in the history buffer")
     {
         shellmatta_instance_t inst;
         shellmatta_handle_t handle;