added makefile to build an example, the documentation and the tests. Startet implementing Tests.

This commit is contained in:
prozessorkern
2019-06-25 23:37:13 +02:00
parent 4dd1b0638f
commit adcce55e83
9 changed files with 19721 additions and 0 deletions

16865
test/framework/catch.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
#include "test/framework/catch.hpp"
#include "src/shellmatta_utils.c"
#include <string.h>
shellmatta_retCode_t writeFct(const char* data, uint32_t length)
{
return SHELLMATTA_OK;
}
TEST_CASE( "shellmatta_clearInput normal call" ) {
shellmatta_instance_t inst;
char buffer[20];
inst.buffer = buffer;
inst.bufferSize = 20;
inst.cursor = 10;
inst.inputCount = 10;
inst.write = writeFct;
utils_clearInput(&inst);
CHECK( inst.cursor == 0);
REQUIRE( inst.inputCount == 0);
}

View File

@@ -0,0 +1,27 @@
#include "test/framework/catch.hpp"
#include "src/shellmatta_utils.c"
#include <string.h>
shellmatta_retCode_t writeFct(const char* data, uint32_t length)
{
return SHELLMATTA_OK;
}
TEST_CASE( "shellmatta_insertChars normal call" ) {
shellmatta_instance_t inst;
char buffer[20];
inst.buffer = buffer;
inst.bufferSize = 20;
inst.cursor = 8;
inst.inputCount = 10;
inst.write = writeFct;
utils_insertChars(&inst, "blksdflsd kfjlk", 4);
CHECK( inst.cursor == 4);
REQUIRE( inst.inputCount == 4);
}

View File

@@ -0,0 +1,11 @@
#include "test/framework/catch.hpp"
#include "src/shellmatta_utils.c"
#include <string.h>
TEST_CASE( "shellmatta_utils.c itoa - 123456" ) {
char buffer[64];
memset(buffer, 0, sizeof(buffer));
CHECK( utils_shellItoa(123456, buffer, 16) == 5 );
CHECK( "12345" == "12345");
REQUIRE( strcmp(buffer, "123456") == 0);
}

7
test/test_main.cpp Normal file
View File

@@ -0,0 +1,7 @@
// 010-TestCase.cpp
// Let Catch provide main():
#define CATCH_CONFIG_MAIN
#include "framework/catch.hpp"