-
Notifications
You must be signed in to change notification settings - Fork 34
Adding several serial functions and unit tests for all print and println functions #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added function Serial_::available() Added mocking for functions Added tests for read and available Added tests for all print and println functions
…eral Serial calls. * Added more tests for stringCapture class
* tests in test/serial_unittest.cc | ||
* | ||
*/ | ||
class stringCapture { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need stringCapture
here?
I think ... it is not mock for Arduino.
It is a helper class for our UnitTest, isn't it? If so, please move this one to '/test' directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ikeasu, I wrote a longer response below. The stringCapture stuff is supposed to be used by external testers. The naming is a bit bad, any thoughts on a new name?
Good job! |
Hi Ikeyasu! Thanks! I really appreciate the project fyi, I've been looking for a good mocking system of the arduino platform for a long time as it is fairly hard to test on the platform itself :). Anyways, back to topic, the stringCapture class is supposed to be used by external users. I'm currently using it in a private project to verify functions which calls Serial::write arbitrary number of times and where I don't want to rely on the internal implementation of the function, but the outcoming stream format is really important. In this testcase, I encode it using the arduino functions, then I decode it using the PC side decoder within the unit test/mock framework. |
Thank you for your reply.
You mean you are using it as a library for your Arduino project? |
Fair enough. I've moved the functions into a file called serialHelper.cc/h and serialHelper_unittest.cc. Makefiles have been updated. Is this better? |
Adding several serial functions and unit tests for all print and println functions Conflicts: test/Makefile
LGTM. It was merged manually. |
Thank you :) |
Added mocking for:
Unit tests are added for almost all functionality, and also updated to cover all print/println functions.