added some integration tests

to test the integrated shellmatta using only the external api
This commit is contained in:
prozessorkern
2019-07-28 22:28:54 +02:00
parent d65765371b
commit 5ff3bfa12e
14 changed files with 179 additions and 47 deletions

View File

@@ -44,8 +44,6 @@ set_blocking (int fd, int should_block)
static shellmatta_retCode_t doSomething(shellmatta_handle_t handle, const char *arguments, uint32_t length)
{
//shellmatta_printf(handle, "blubb\n\r");
return SHELLMATTA_OK;
}
shellmatta_cmd_t doSomethingCmd = {"doSomething", "do", "Function does something", "use me, please", doSomething, NULL};
@@ -53,7 +51,6 @@ shellmatta_cmd_t doSomethingCmd = {"doSomething", "do", "Function does something
static shellmatta_retCode_t doSome(shellmatta_handle_t handle, const char *arguments, uint32_t length)
{
//shellmatta_printf(handle, "blubb\n\r");
shellmatta_write(handle, "blubb\r\n", 7u);
return SHELLMATTA_OK;
@@ -63,9 +60,6 @@ shellmatta_cmd_t doSomeCmd = {"adoSome2", "adof2", "Function does something", "u
static shellmatta_retCode_t quit(shellmatta_handle_t handle, const char *arguments, uint32_t length)
{
//shellmatta_printf(handle, "Bye\n\r");
exitRequest = true;
return SHELLMATTA_OK;
@@ -75,13 +69,7 @@ shellmatta_cmd_t quitCommand = {"quit", "q", "Function quits the shell", "", qui
shellmatta_retCode_t writeFct(const char* data, uint32_t length)
{
// for(uint32_t i = 0u; i < length; i ++)
// {
write(f, data, length);
//printf("%c", data[i]);
// }
//fflush(stdout);
write(f, data, length);
return SHELLMATTA_OK;
}
@@ -92,11 +80,7 @@ int main(void)
static char historyBuffer[4096];
static shellmatta_instance_t instance;
// initscr();
// raw();
// keypad(stdscr, TRUE);
// noecho();
f = open("/dev/pts/2", O_RDWR | O_SYNC);
f = open("/dev/pts/3", O_RDWR | O_SYNC);
if (f < 0)
{
@@ -115,9 +99,9 @@ int main(void)
"shellmatta->",
NULL,
writeFct);
shellmatta_addCmd(&instance, &doSomethingCmd);
shellmatta_addCmd(&instance, &doSomeCmd);
shellmatta_addCmd(&instance, &quitCommand);
shellmatta_addCmd(handle, &doSomethingCmd);
shellmatta_addCmd(handle, &doSomeCmd);
shellmatta_addCmd(handle, &quitCommand);
while(exitRequest == false)
{
@@ -129,11 +113,9 @@ int main(void)
fprintf(stdout, "0x%02x \n", c);
fflush(stdout);
shellmatta_processData(&instance, &c, res);
shellmatta_processData(handle, &c, res);
}
// refresh();
// endwin();
close(f);
return 0;