added makefile to build an example, the documentation and the tests. Startet implementing Tests.
This commit is contained in:
16865
test/framework/catch.hpp
Normal file
16865
test/framework/catch.hpp
Normal file
File diff suppressed because it is too large
Load Diff
26
test/shellmatta_utils/clearInput.cpp
Normal file
26
test/shellmatta_utils/clearInput.cpp
Normal 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);
|
||||
}
|
27
test/shellmatta_utils/insertChars.cpp
Normal file
27
test/shellmatta_utils/insertChars.cpp
Normal 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);
|
||||
}
|
||||
|
11
test/shellmatta_utils/itoa.cpp
Normal file
11
test/shellmatta_utils/itoa.cpp
Normal 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
7
test/test_main.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
// 010-TestCase.cpp
|
||||
|
||||
// Let Catch provide main():
|
||||
#define CATCH_CONFIG_MAIN
|
||||
|
||||
#include "framework/catch.hpp"
|
||||
|
Reference in New Issue
Block a user