13 #include <boost/foreach.hpp> 17 #if BOOST_VERSION >= 105900 18 #include <boost/test/tools/output_test_stream.hpp> 20 #include <boost/test/output_test_stream.hpp> 22 #include <boost/test/unit_test.hpp> 23 #include <boost/test/unit_test_suite.hpp> 26 using boost::test_tools::output_test_stream;
42 : proname(n), res(), call(), timedata() {}
44 T &
fun(T &res,
int t) {
68 res = call * timedata;
73 std::ostringstream oss;
74 oss << call * timedata;
90 cout <<
"Error catch" << std::endl;
116 output_test_stream output;
154 std::string
name =
"sig";
156 std::string test =
"test";
165 sigPtrA.recompute(3);
170 &sigPtrAbstractRef = sigPtrAbstract;
172 sigPtrARef.
plug(&sigRef);
173 sigPtrBRef.plug(&sigPtrARef);
178 sigPtrARef.
plug(&sigstr);
185 sigPtrAbstractRef.plug(&sigRef);
194 }
catch (
const std::exception &e) {
195 std::cout <<
"Standard Exception:" << e.what() << std::endl;
197 std::cout <<
"Anything else: " << std::endl;
199 sigPtrA.needUpdate(5);
202 int ltime = sigPtrA.getTime();
215 std::cout <<
"Code: " << aes.
getCode() << std::endl;
218 std::cout <<
"Anything else with sigPtrAbstract.getAbstractPtr()" 224 sigPtrAbstractRef.plug(0);
234 sigPtrA.setConstantDefault();
236 sigPtrA.setConstant(3.4);
241 sigPtrA.setReference(tab_D, NULL);
243 output_test_stream output;
244 sigPtrA.display(output);
245 sigPtrA.setReferenceNonConstant(tab_D, NULL);
247 sigPtrA.display(output);
250 sigPtrA.operator=(1.2);
252 sigPtrA.displayDependencies(output);
254 cout << t << std::endl;
258 cout <<
"SigPtrA = ";
259 sigPtrARef.
get(cout);
261 cout <<
"SigPtrB = ";
262 sigPtrBRef.get(cout);
275 std::string str(
"two words");
279 std::ostringstream os1;
281 std::string res(os1.str());
282 BOOST_CHECK(res == str);
292 inSigVec.
plug(&outSigVec);
294 output_test_stream output;
295 inSigVec.
get(output);
296 BOOST_CHECK(output.is_equal(
"1 2 3 4 5"));
299 std::ostringstream os2;
304 std::cout <<
"res=" << res << std::endl;
305 BOOST_CHECK(res == str);
311 std::ostringstream os;
313 std::istringstream value(os.str());
316 }
catch (
const std::exception &exc) {
317 std::cout << exc.what() << std::endl;
318 BOOST_CHECK(!(
bool)(
"Tentative to set signal to empty string"));
virtual void getClassName(std::string &aClassName) const
const T & access(const Time &t1)
dynamicgraph::SignalTimeDependent< double, int > sigDouble_t
virtual void setConstantDefault()
dynamicgraph::SignalTimeDependent< std::string, int > sigString_t
virtual void setConstant(const T &t)
dynamicgraph::SignalArray_const< double > sig
virtual void set(std::istringstream &value)
Exceptions raised when an error related to signals happen.
virtual void get(std::ostream &) const
BOOST_AUTO_TEST_CASE(normal_cst_test)
std::list< sigDouble_t * > inputsig
virtual void plug(SignalBase< Time > *ref)
int getCode() const
Access to the error code.
DummyClass(const std::string &n)
std::list< sigString_t * > inputsigV
virtual void checkCompatibility()
virtual void checkCompatibility()
virtual const Time & getTime() const
virtual SignalBase< Time > * getPluged() const
SignalBase< Time > * getAbstractPtr()
virtual bool isPlugged() const
virtual void recompute(const Time &t)
virtual void plug(SignalBase< Time > *sigarg)
void add(sigString_t &sig)
void add(sigDouble_t &sig)
virtual std::ostream & display(std::ostream &os) const
virtual void get(std::ostream &value) const
virtual bool needUpdate(const Time &t) const
virtual const std::string & getExceptionName() const
Signal< T, Time > * getPtr()