platformio / platformio/platformio-examples
UnitTesting example calculator file/folder layout seems only to work with single component in native and embedded environment
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 698
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
The unit testing example calculator aims to show how to use unit testing with native and embedded environments (with the Unity testing framework). The suggested file/folder structure and the contents of the test components test_embedded and test_desktop however only seem to work with a single test file - due to the definition of main and setup/loop. When adding multiple test files with that structure we certainly get compilation errors like this:
multiple definition of `main'; .....cpp:(.text+0x5f): first defined here
Besides the setUp and tearDown function will cause duplicates as well. It seems that one would have to move the main function to a separate file and reference all the other tests from there.
I am just pointing this out, as the file/folder structure after such a change would differ greatly from the example and the accompanying documentation. And this - imo - makes it a mediocre example.
I would like to see a unit test example that can easily be extended and be used in a real life project. Maybe I am missing something here, then pls tell me so and I am more than happy to delete/close this issue.
Thank you for your help and support.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the unit-testing/calculator example and inspect test/test_embedded and test/test_desktop, especially their main, setUp, and tearDown definitions. Verify the failure by adding multiple test files, then make the example and accompanying documentation support an extensible layout without duplicate definitions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation, embedded-iot, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100