Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Base64 tests#1242

Merged
mikepurvis merged 2 commits intoros:lunar-develfrom
trainman419:trainman419/fix_xmlrpcpp_bugs_5
Dec 12, 2017
Merged

Base64 tests#1242
mikepurvis merged 2 commits intoros:lunar-develfrom
trainman419:trainman419/fix_xmlrpcpp_bugs_5

Conversation

@trainman419
Copy link
Copy Markdown
Contributor

I wrote independent tests for the original base64 module; this upstreams them and fixes a few bugs that my original tests exposed in the new base64 library.

Also fix a few bugs that I discovered when running the tests in valgrind, and remove an unused variable in the base64 decoder.

I wrote independent tests for the original base64 module; this
upstreams them and fixes a few bugs that my original tests exposed in
the new base64 library.

Also fix a few bugs that I discovered when running the tests in
valgrind.
@trainman419
Copy link
Copy Markdown
Contributor Author

Ping

@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Dec 1, 2017

@trainman419, just to give you an expectation, @dirk-thomas is still on vacation, perhaps @mikepurvis has some time but I wouldn't expect it to be merged until later next week.

@trainman419
Copy link
Copy Markdown
Contributor Author

Ping. @dirk-thomas or @mikepurvis do you have a moment to take a look at this, #1243 and #1244?

Copy link
Copy Markdown
Member

@mikepurvis mikepurvis left a comment

Choose a reason for hiding this comment

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

LGTM, just nits and questions.

"FiY2RlZmdoaWpr\nbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJ"
"GSk5SVlpeYmZqbnJ2en6Ch\noqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wM"
"HCw8TFxsfIycrLzM3Oz9DR0tPU1dbX\n2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8P"
"Hy8/T19vf4+fr7/P3+/w==\n")));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this a golden test copied from somewhere, eg an online converter? If so, might be worth including an attribution in case someones want to change or reproduce it later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I generated this locally from the binary version of the sequence above, using the base64 program.

{
state_in->step = step_a;
state_in->plainchar = *plainchar;
state_in->plainchar = 0; // no state to save; use default value
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know enough about base64 to understand this change, but I assume it's motivated by something which one of the new tests uncovered?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes; this was uncovered by running these tests in valgrind and prevents an out-of-bounds array access through plainchar.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

char* plainchar = plaintext_out;
char fragment;

if(length_in == 0) return 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if (length_in == 0)
{
  return 0;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.


catkin_add_gtest(test_base64 test_base64.cpp)
target_link_libraries(test_base64 xmlrpcpp)
set_target_properties(test_base64 PROPERTIES COMPILE_FLAGS -std=c++11)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be per-target vs. setting it for the whole package with set_directory_properties?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the only test that needs C++11, so I figured the cleanest thing to do was enable it on this target.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Gotcha.

@mikepurvis
Copy link
Copy Markdown
Member

Looks good to me. Thanks for contributing new tests!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants