-
Notifications
You must be signed in to change notification settings - Fork 68
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
Group state locale #44
Group state locale #44
Conversation
#define EXPECT_TRUE(arg) \ | ||
if (!(arg)) \ | ||
throw std::runtime_error("Assertion failed at line " + std::to_string(__LINE__)) | ||
#include <gtest/gtest.h> |
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.
Thanks for migration to gtest
!
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.
Apart from clang-format issues, looks good to me. Thanks for fixing this throughout whole ROS 😉
<env name="LC_ALL" value="C" /> | ||
</test> | ||
<test test-name="test_srdf_parser_cpp_locale" pkg="srdfdom" type="test_cpp"> | ||
<env name="LC_ALL" value="nl_NL.UTF-8" /> |
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.
In order for the first two commits to fail during unit testing somewhere
sudo locale-gen nl_NL.UTF-8
needs to be added, @rhaschke @davetcoleman you probably know where
I don't get this comment. Isn't this env setting correctly setting the locale?
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.
yes, but in order for the env variable to have an effect the locale needs to be created first
see ros/urdfdom@1857a55 for an example without using moveit-ci
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 see. I added an appropriate command to .travis.yml
Could you please squash-in the clang-format fix I pushed (I cannot rebase your branch myself). Then this PR should be ready for merging. |
ac146dc
to
c1723f4
Compare
I squashed/fixuped the two commits marked fixup |
Thanks. Let's wait for Travis now... |
@simonschmeisser Could you please have another look. One unit test failed. |
It works here, I have no idea, sry |
Ok. Needs to postpone this for the weekend then. |
note that localegen needs to be run for this to have any effect sudo locale-gen nl_NL.UTF-8 see urdfdom test for example ros/urdfdom@1857a55
8101c30
to
b3a9408
Compare
Looks like urdfdom-1.0.0 cannot parse with the locale set. Probably you are already using the newer version of urdfdom locally (as I do).
I fixed this issue by temporarily setting the C locale for parsing the URDF. If an unknown locale is set, just a warning is printed, but the test simply passes. There should be at least a warning, e.g. from cmake, that the locale is not available. Otherwise the test is useless.
@simonschmeisser Can you please extend the cmake file accordingly? |
Thanks! Good catch, I'll add a warning on Monday. I should also file a ubuntu bug report to ask for a patch version update now that OSRF finally managed to have releases of urdfdom(_headers) ... |
@rhaschke I searched a bit on Monday but did not find a solution for adding this to cmake. If you know a way please feel invited to add it, otherwise I would suggest to merge and add an issue |
I added a simple check for the locale to be available in cmake and squash-merged. |
thanks! |
when parsing the group state
std::stod
is used to convert fromstring
todouble
which uses thec
locale and thus assumes,
as a decimal separator for some languages.This PR resurrects the cpp unit tests, ports them to gtest, runs them with classic and Dutch locale and finally removes the call to
std::stod
In order for the first two commits to fail during unit testing somewhere
sudo locale-gen nl_NL.UTF-8
needs to be added, @rhaschke @davetcoleman you probably know where