2
0

test_common_init.c 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. #include "unity.h"
  2. #include "tools.h" // Assuming tools.h contains init_spiffs and listFiles
  3. #include "test_common_init.h"
  4. #include "tools_spiffs_utils.h"
  5. static const char * TAG = "test_common";
  6. esp_err_t start_ota_return_code=ESP_OK;
  7. void start_ota_set_return(esp_err_t mockreturn){
  8. start_ota_return_code = mockreturn;
  9. }
  10. esp_err_t start_ota(const char * bin_url, char * bin_buffer, uint32_t length) {
  11. ESP_LOGI(TAG,"Received OTA Request url %s/bin buffer size: %d. returning: %s",bin_url,length,esp_err_to_name(start_ota_return_code));
  12. return start_ota_return_code;
  13. }
  14. esp_log_level_t SetLogLevels(esp_log_level_t level) {
  15. esp_log_level_set("*", level);
  16. return esp_log_level_get(TAG);
  17. }
  18. TEST_CASE("Raise Log Level","[test]") {
  19. TEST_ASSERT_TRUE(SetLogLevels(ESP_LOG_DEBUG) == ESP_LOG_DEBUG );
  20. }
  21. TEST_CASE("Lower Log Level","[test]") {
  22. TEST_ASSERT_TRUE(SetLogLevels(ESP_LOG_INFO) == ESP_LOG_INFO );
  23. }
  24. TEST_CASE("List dir content", "[tools]") {
  25. common_test_init();
  26. listFiles("/spiffs");
  27. TEST_ASSERT_TRUE(true);
  28. }