test_utils_insertChars.cpp 546 B

123456789101112131415161718192021222324252627
  1. #include "test/framework/catch.hpp"
  2. #include "src/shellmatta_utils.c"
  3. #include <string.h>
  4. shellmatta_retCode_t writeFct(const char* data, uint32_t length)
  5. {
  6. return SHELLMATTA_OK;
  7. }
  8. TEST_CASE( "shellmatta_insertChars normal call" ) {
  9. shellmatta_instance_t inst;
  10. char buffer[20];
  11. inst.buffer = buffer;
  12. inst.bufferSize = 20;
  13. inst.cursor = 8;
  14. inst.inputCount = 10;
  15. inst.write = writeFct;
  16. utils_insertChars(&inst, "blksdflsd kfjlk", 4);
  17. CHECK( inst.cursor == 12);
  18. REQUIRE( inst.inputCount == 14);
  19. }