Skip to content
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

Merged
merged 2 commits into from
May 20, 2020
Merged

Add tests for wstring conversion routines #43

merged 2 commits into from
May 20, 2020

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented May 19, 2020

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added enhancement New feature or request in review Waiting for review (Kanban column) labels May 19, 2020
@cottsay cottsay self-assigned this May 19, 2020
// Force malloc/realloc to fail
auto on_unexpected_operation =
[]() {
throw std::exception();
Copy link
Contributor

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?

Copy link
Member Author

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!");
Copy link
Contributor

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?

Copy link
Member Author

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>
@cottsay
Copy link
Member Author

cottsay commented May 20, 2020

Fresh CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Contributor

@brawner brawner left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants