test_utils_clearInput.cpp 561 B

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