-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add tests for wstring conversion routines #43
Conversation
cottsay
commented
May 19, 2020
- Linux
- Linux-aarch64
- macOS
- Windows
Signed-off-by: Scott K Logan <logans@cottsay.net>
// Force malloc/realloc to fail | ||
auto on_unexpected_operation = | ||
[]() { | ||
throw std::exception(); |
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.
If this throws the developer will get a backtrace so they can know whether it was line 41 or 42 yah?
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.
This isn't straightforward, but osrf_testing_tools_cpp::memory_tools
will catch this exception, print an error message, and make the memory operation return nullptr
. We should never see the backtrace.
|
||
TEST(test_wstring_conversion, wstring_round_trip) | ||
{ | ||
std::wstring wstring(L"¡Hola, Mundo!"); |
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.
Add tests for empty string, and default constructed string. Are there any other potential failure cases that would need to be checked?
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.
I can think of no more than what you mentioned. Added in 38986f0.
Signed-off-by: Scott K Logan <logans@cottsay.net>
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.
Looks good, pending CI