|
@@ -21,9 +21,6 @@ extern "C" {
|
|
static uint32_t write_callCnt = 0u;
|
|
static uint32_t write_callCnt = 0u;
|
|
static char write_data[1024];
|
|
static char write_data[1024];
|
|
static uint32_t write_length;
|
|
static uint32_t write_length;
|
|
-static uint32_t busyCallCnt;
|
|
|
|
-static uint32_t notBusyCallCnt;
|
|
|
|
-static bool suspendBusy;
|
|
|
|
|
|
|
|
static shellmatta_retCode_t writeFct(const char* data, uint32_t length)
|
|
static shellmatta_retCode_t writeFct(const char* data, uint32_t length)
|
|
{
|
|
{
|
|
@@ -61,7 +58,6 @@ static shellmatta_retCode_t privateCmdFct(shellmatta_handle_t handle, const char
|
|
}
|
|
}
|
|
shellmatta_cmd_t privateCmd = {(char*)"private", (char*)"r", NULL, NULL, privateCmdFct, NULL, NULL};
|
|
shellmatta_cmd_t privateCmd = {(char*)"private", (char*)"r", NULL, NULL, privateCmdFct, NULL, NULL};
|
|
|
|
|
|
-
|
|
|
|
TEST_CASE( "check unauthenticated help" ) {
|
|
TEST_CASE( "check unauthenticated help" ) {
|
|
|
|
|
|
shellmatta_retCode_t ret;
|
|
shellmatta_retCode_t ret;
|
|
@@ -69,7 +65,14 @@ TEST_CASE( "check unauthenticated help" ) {
|
|
shellmatta_handle_t handle;
|
|
shellmatta_handle_t handle;
|
|
char buffer[1024] = {0};
|
|
char buffer[1024] = {0};
|
|
char historyBuffer[1024] = {0};
|
|
char historyBuffer[1024] = {0};
|
|
- char *dummyData = (char*) "";
|
|
|
|
|
|
+ char *dummyData = (char*) "help\r\n"
|
|
|
|
+ "help ? help [command] - print help or usage information\r\n"
|
|
|
|
+ "login li Login command\r\n"
|
|
|
|
+ "logout lo Logout command\r\n"
|
|
|
|
+ "private r\r\n"
|
|
|
|
+ "public p\r\n"
|
|
|
|
+ "\r\n"
|
|
|
|
+ "shellmatta->";
|
|
|
|
|
|
shellmatta_doInit( &inst,
|
|
shellmatta_doInit( &inst,
|
|
&handle,
|
|
&handle,
|
|
@@ -81,22 +84,18 @@ TEST_CASE( "check unauthenticated help" ) {
|
|
NULL,
|
|
NULL,
|
|
writeFct);
|
|
writeFct);
|
|
|
|
|
|
- busyCallCnt = 0u;
|
|
|
|
- notBusyCallCnt = 0u;
|
|
|
|
|
|
+ shellmatta_auth_init(handle, NULL, 0, NULL, 0, false, NULL, NULL);
|
|
|
|
+
|
|
write_callCnt = 0u;
|
|
write_callCnt = 0u;
|
|
memset(write_data, 0, sizeof(write_data));
|
|
memset(write_data, 0, sizeof(write_data));
|
|
write_length = 0u;
|
|
write_length = 0u;
|
|
- suspendBusy = false;
|
|
|
|
|
|
|
|
shellmatta_addCmd(handle, &publicCmd);
|
|
shellmatta_addCmd(handle, &publicCmd);
|
|
shellmatta_addCmd(handle, &privateCmd);
|
|
shellmatta_addCmd(handle, &privateCmd);
|
|
|
|
|
|
- do
|
|
|
|
- {
|
|
|
|
- ret = shellmatta_processData(handle, (char*)"help\r", 5);
|
|
|
|
-
|
|
|
|
- } while (SHELLMATTA_BUSY == ret);
|
|
|
|
|
|
+ ret = shellmatta_processData(handle, (char*)"help\r", 5);
|
|
|
|
|
|
- CHECK( write_length == strlen(dummyData));
|
|
|
|
|
|
+ CHECK(ret == SHELLMATTA_OK);
|
|
|
|
+ CHECK(write_length == strlen(dummyData));
|
|
REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
|
|
REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
|
|
}
|
|
}
|