Skip to content

Commit

Permalink
Merge pull request #377 from jwillemsen/jwi-stringtestext
Browse files Browse the repository at this point in the history
Use a IDL constant string to test also the string generation
  • Loading branch information
jwillemsen authored Apr 12, 2024
2 parents e4f5115 + 03d3d85 commit 35f163c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions tests/string/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ main(int argc, char* argv[])
{
TAOX11_TEST_DEBUG << "Test string type." << std::endl;
std::string getText = hello->get_string ();
if (getText != "Hello there!")
if (getText != test_string)
{
TAOX11_TEST_ERROR << "ERROR: hello->get_string() returned an unexpected value. "
<< "expected <Hello there!>, received <" << getText << ">" << std::endl;
<< "expected <" << test_string << ">, received <" << getText << ">" << std::endl;
++result;
}
hello->set_string ("Hello there!");
hello->set_string (test_string);
}

{
Expand All @@ -75,7 +75,7 @@ main(int argc, char* argv[])

{
TAOX11_TEST_DEBUG << "Test string type inout parameter." << std::endl;
std::string inoutText = "Hello there!";
std::string inoutText = test_string;
hello->inout_string (inoutText);
if (inoutText != "I hear you!")
{
Expand Down
10 changes: 5 additions & 5 deletions tests/string/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Hello::Hello (IDL::traits<CORBA::ORB>::ref_type orb, int& result)
std::string
Hello::get_string ()
{
return "Hello there!";
return test_string;
}

void
Hello::set_string (const std::string& text)
{
if (text != "Hello there!")
if (text != test_string)
{
TAOX11_TEST_ERROR << "ERROR: Hello::set_string received an unexpected value. "
<< "expected <Hello there!>, received <" << text <<">" << std::endl;
<< "expected <" << test_string << ">, received <" << text <<">" << std::endl;
++this->result_;
}
}
Expand All @@ -43,10 +43,10 @@ Hello::out_string (std::string& text)
void
Hello::inout_string (std::string& text)
{
if (text != "Hello there!")
if (text != test_string)
{
TAOX11_TEST_ERROR << "ERROR: Hello::inout_string received an unexpected value. "
<< "expected <Hello there!>, received <" << text << ">" << std::endl;
<< "expected <" << test_string << "!>, received <" << text << ">" << std::endl;
++this->result_;
}
text = "I hear you!";
Expand Down
1 change: 1 addition & 0 deletions tests/string/test.idl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "orb.idl"

const string name = "testing";
const string test_string = "Hello there!";

/// Put the interfaces in a module, to avoid global namespace pollution
module Test
Expand Down

0 comments on commit 35f163c

Please sign in to comment.