ESP-IDF Unit Testing of files in main/

kaspernyhus
Posts: 22
Joined: Tue Mar 01, 2022 7:38 am

ESP-IDF Unit Testing of files in main/

Postby kaspernyhus » Fri Jan 20, 2023 2:46 pm

Hi,

Is there a way to use the ESP-IDF way of unit testing, to test functions within the main application and not within a component in components folder?

Example:
I would like to unit test a function inside 'add_four.c'

Project structure:

Code: Select all

main	
  test
    CMakeLists.txt
    component.mk
    test_add_four.c	- has TEST_CASE{TEST_ASSERT_EQUAL(9, add_four(5))}
  add_four.c
  add_four.h
  CMakeLists.txt
  main.c		- main application app_main()

test
  main
    CMakeLists.txt
    main_test.c		-  test application app_main()
  CMakeLists.txt

kaspernyhus
Posts: 22
Joined: Tue Mar 01, 2022 7:38 am

Re: ESP-IDF Unit Testing of files in main/

Postby kaspernyhus » Mon Feb 13, 2023 1:57 pm

I might have a solution: https://github.com/kaspernyhus/esp32_unit_tests

Thanks

Who is online

Users browsing this forum: Baidu [Spider] and 85 guests