test_app_main.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include "unity.h"
  7. #include "unity_test_runner.h"
  8. #include "unity_test_utils.h"
  9. #include "esp_heap_caps.h"
  10. // Some resources are lazy allocated in RMT driver, so we reserved this threadhold when checking memory leak
  11. // A better way to check a potential memory leak is running a same case by twice, for the second time, the memory usage delta should be zero
  12. #define TEST_MEMORY_LEAK_THRESHOLD (400)
  13. void setUp(void)
  14. {
  15. unity_utils_record_free_mem();
  16. }
  17. void tearDown(void)
  18. {
  19. esp_reent_cleanup(); //clean up some of the newlib's lazy allocations
  20. unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD);
  21. }
  22. void app_main(void)
  23. {
  24. // ____ __ __ _____ _____ _
  25. // | _ \| \/ |_ _| |_ _|__ ___| |_
  26. // | |_) | |\/| | | | | |/ _ \/ __| __|
  27. // | _ <| | | | | | | | __/\__ \ |_
  28. // |_| \_\_| |_| |_| |_|\___||___/\__|
  29. printf(" ____ __ __ _____ _____ _\r\n");
  30. printf("| _ \\| \\/ |_ _| |_ _|__ ___| |_\r\n");
  31. printf("| |_) | |\\/| | | | | |/ _ \\/ __| __|\r\n");
  32. printf("| _ <| | | | | | | | __/\\__ \\ |_\r\n");
  33. printf("|_| \\_\\_| |_| |_| |_|\\___||___/\\__|\r\n");
  34. unity_run_menu();
  35. }