Skip to content

Commit

Permalink
Merge pull request #446 from jwillemsen/jwi-idlconvstringtest
Browse files Browse the repository at this point in the history
Extend sequence of string tests
  • Loading branch information
jwillemsen authored Oct 1, 2024
2 parents 9859c4e + 96dada2 commit aa3a740
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module Example {
typedef B51 B55;
typedef string B56[6][5];
typedef sequence<string> B57;
typedef sequence<unsigned long long> B57_stringlength;
typedef string<512> B58;
typedef sequence<B58> B59;
typedef B59 B60;
Expand Down Expand Up @@ -169,6 +170,7 @@ module Example {
B55 b_55;
B56 b_56;
B57 b_57;
B57_stringlength b_57_stringlength;
B59 b_59;
B60 b_60;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,7 @@ namespace IDL_Conversion_Test_Receiver_Impl
{
for (uint16_t y = 0; y < 5; ++y)
{
const std::string expected (
std::to_string (x + y + datum.iteration ()));
const std::string expected (std::to_string (x + y + datum.iteration ()));
if (datum.b_56 ()[x][y] != expected)
{
DDS4CCM_TEST_ERROR << "Receiver check - ERROR: unexpected value for "
Expand All @@ -454,12 +453,18 @@ namespace IDL_Conversion_Test_Receiver_Impl
const std::string expected ("VALUE_"+std::to_string (datum.iteration () + c));
if (val != expected)
{
if (datum.b_57_stringlength()[c] != expected.length())
{
DDS4CCM_TEST_ERROR << "Receiver check - ERROR: string length of "
<< "datum.b_57[" << c << "] is not " << expected.length()
<< " but " << datum.b_57_stringlength()[c] << std::endl;
}
if (!val.empty ())
{
if (val.back() == 0)
{
DDS4CCM_TEST_ERROR << "Receiver check - ERROR: last character of "
<< "datum.b_57[" << c << "] is 0" << std::endl;
<< "datum.b_57[" << c << "] is 0" << std::endl;
}
}
DDS4CCM_TEST_ERROR << "Receiver check - ERROR: unexpected value for "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,12 @@ namespace IDL_Conversion_Test_Sender_Impl
}

Example::B57 b57;
Example::B57_stringlength b57_stringlength;
for (uint16_t val = this->last_iteration_; val < this->last_iteration_ + 100; ++val)
{
b57.push_back ("VALUE_"+std::to_string (val));
std::string tosend = "VALUE_"+std::to_string (val);
b57.push_back (tosend);
b57_stringlength.push_back (tosend.length ());
}

Example::B59 b59;
Expand Down Expand Up @@ -487,6 +490,7 @@ namespace IDL_Conversion_Test_Sender_Impl
b55,
b56,
b57,
b57_stringlength,
b59,
b60,
a_13 ? Example::B70::B70_1 : Example::B70::B70_2,
Expand Down

0 comments on commit aa3a740

Please sign in to comment.