Skip to content

Conversation

@Katze719
Copy link
Member

…ialWrite functions

@Katze719 Katze719 marked this pull request as ready for review January 28, 2026 18:19
@Katze719 Katze719 self-assigned this Jan 28, 2026
@Katze719 Katze719 requested a review from Mqxx January 28, 2026 18:20
@Mqxx
Copy link
Member

Mqxx commented Jan 28, 2026

Please refactor to individual files place them next to the corresponding function and suffix the files with .test.cpp

@Mqxx
Copy link
Member

Mqxx commented Jan 28, 2026

One file for all unit tests is way to large

Copy link
Member

@Mqxx Mqxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor

@Katze719
Copy link
Member Author

Please refactor to individual files place them next to the corresponding function and suffix the files with .test.cpp

that feels like bloating the src folder to me, im more used to having tests in a separate test folder

@Katze719
Copy link
Member Author

Please refactor to individual files place them next to the corresponding function and suffix the files with .test.cpp

anyways, where would i place my helper functions / classes that are only needed for tests

…dd new unit tests

- Excluded test files and helpers from library source files in CMakeLists.txt.
- Added unit tests for serialClose, serialOpen, serialRead, and serialWrite functions.
- Introduced error capture mechanism for better error handling in tests.
- Implemented integration tests for serial communication with Arduino and pipe round trips.
- Removed outdated test_serial_functions.cpp file.
@Katze719 Katze719 requested a review from Mqxx January 28, 2026 20:05
@Mqxx
Copy link
Member

Mqxx commented Jan 28, 2026

that feels like bloating the src folder to me, im more used to having tests in a separate test folder

Unit tests should not be seen as "bloat" they are also an important part in the sourcecode even though "the app could exist without them". Putting them in a separate folder would mean that you either put everything into one file, which gets pretty much unmaintainable at some point, or you could try to mimic the folder structure in the test folder of your source folder for every file which gets pretty annoying if you do any thing of refactoring like moving files around even if you don't do it often.

Placing the test files next to the actual files that they test also helps to find them more easily (that's also the reason for the .test.cpp suffix instead of a test_ prefix, because with the prefix, the files would all cluster together at one point between files that start with s and u.

- Cleaned up test files by removing unnecessary commented headers for serialClose, serialOpen, serialWrite, and integration tests.
@Mqxx Mqxx self-requested a review January 28, 2026 20:44
@Katze719 Katze719 merged commit 7e8ae90 into main Jan 28, 2026
5 checks passed
@Katze719 Katze719 deleted the add-unit-tests branch January 28, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants