test_utils_clearInput.cpp 527 B

1234567891011121314151617181920212223242526
  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. return SHELLMATTA_OK;
  7. }
  8. TEST_CASE( "shellmatta_clearInput normal call" ) {
  9. shellmatta_instance_t inst;
  10. char buffer[20];
  11. inst.buffer = buffer;
  12. inst.bufferSize = 20;
  13. inst.cursor = 10;
  14. inst.inputCount = 10;
  15. inst.write = writeFct;
  16. utils_clearInput(&inst);
  17. CHECK( inst.cursor == 0);
  18. REQUIRE( inst.inputCount == 0);
  19. }