Commit a8451161 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux
Browse files

Fix DefaultCastRegisterer<std::string>::cast

  - when signal value contained a space, only the part before the space
    was stored in the signal.
  - add a test on this case.
parent 55bb546f
Pipeline #6438 passed with stage
in 4 minutes and 20 seconds
......@@ -79,8 +79,7 @@ template <>
inline boost::any DefaultCastRegisterer<std::string>::cast
(std::istringstream &iss)
std::string inst ("");
iss >> inst;
std::string inst (iss.str ());
return inst;
......@@ -92,12 +92,21 @@ BOOST_AUTO_TEST_CASE (plug_signal_string)
Signal<std::string, int> outSig("output");
SignalPtr<std::string, int> inSig (NULL, "input");
std::string str ("value");
std::string str ("two words");
inSig.plug (&outSig);
std::ostringstream os;
inSig.get (os);
std::string res (os.str ());
std::ostringstream os1;
inSig.get (os1);
std::string res (os1.str ());
BOOST_CHECK (res == str);
Signal<std::string, int> s ("signal");
std::ostringstream os2;
s.setConstant (str);
os2.clear ();
s.get (os2);
res = os2.str ();
std::cout << "res=" << res << std::endl;
BOOST_CHECK (res == str);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment