6 #include <boost/foreach.hpp> 9 #define BOOST_TEST_MODULE signal_time_dependent 11 #if BOOST_VERSION >= 105900 12 #include <boost/test/tools/output_test_stream.hpp> 14 #include <boost/test/output_test_stream.hpp> 16 #include <boost/test/unit_test.hpp> 18 using boost::test_tools::output_test_stream;
62 std::ostringstream oss;
80 sigString_t sig2(sig4 << sig4 << sig4 << sig6,
"Sig2");
83 sig2 << sig3,
"Sig1");
112 output_test_stream output;
115 output.is_equal(
"-- Sig:Sig1 (Type Fun) (t=0 (/1) )\n" 116 " |-- Sig:Sig3 (Type Fun) (t=0 (/1) )\n" 117 " | |-- Sig:Sig6 (Type Fun) (ready=TRUE)\n" 118 " | |-- Sig:Sig5 (Type Fun) (A)\n" 119 " | `-- Sig:Sig2 (Type Fun) (t=0 (/1) )\n" 120 " | |-- Sig:Sig6 (Type Fun) (ready=TRUE)\n" 121 " | |-- Sig:Sig4 (Type Fun) (t=0 (/1) )\n" 122 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 123 " | |-- Sig:Sig4 (Type Fun) (t=0 (/1) )\n" 124 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 125 " | `-- Sig:Sig4 (Type Fun) (t=0 (/1) )\n" 126 " | `-- Sig:Sig5 (Type Fun) (A)\n" 127 " `-- Sig:Sig2 (Type Fun) (t=0 (/1) )\n" 128 " |-- Sig:Sig6 (Type Fun) (ready=TRUE)\n" 129 " |-- Sig:Sig4 (Type Fun) (t=0 (/1) )\n" 130 " | `-- Sig:Sig5 (Type Fun) (A)\n" 131 " |-- Sig:Sig4 (Type Fun) (t=0 (/1) )\n" 132 " | `-- Sig:Sig5 (Type Fun) (A)\n" 133 " `-- Sig:Sig4 (Type Fun) (t=0 (/1) )\n" 134 " `-- Sig:Sig5 (Type Fun) (A)"));
141 output_test_stream output;
144 output.is_equal(
"-- Sig:Sig1 (Type Fun) (t=2 (/1) )\n" 145 " |-- Sig:Sig3 (Type Fun) (t=2 (/1) )\n" 146 " | |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 147 " | |-- Sig:Sig5 (Type Fun) (A)\n" 148 " | `-- Sig:Sig2 (Type Fun) (t=2 (/1) )\n" 149 " | |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 150 " | |-- Sig:Sig4 (Type Fun) (t=2 (/1) )\n" 151 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 152 " | |-- Sig:Sig4 (Type Fun) (t=2 (/1) )\n" 153 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 154 " | `-- Sig:Sig4 (Type Fun) (t=2 (/1) )\n" 155 " | `-- Sig:Sig5 (Type Fun) (A)\n" 156 " `-- Sig:Sig2 (Type Fun) (t=2 (/1) )\n" 157 " |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 158 " |-- Sig:Sig4 (Type Fun) (t=2 (/1) )\n" 159 " | `-- Sig:Sig5 (Type Fun) (A)\n" 160 " |-- Sig:Sig4 (Type Fun) (t=2 (/1) )\n" 161 " | `-- Sig:Sig5 (Type Fun) (A)\n" 162 " `-- Sig:Sig4 (Type Fun) (t=2 (/1) )\n" 163 " `-- Sig:Sig5 (Type Fun) (A)"));
168 output_test_stream output;
171 output.is_equal(
"-- Sig:Sig1 (Type Fun) (t=2 (/1) )\n" 172 " |-- Sig:Sig3 (Type Fun) (t=2 (/1) )\n" 173 " | |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 174 " | |-- Sig:Sig5 (Type Fun) (A)\n" 175 " | `-- Sig:Sig2 (Type Fun) (t=4 (/1) )\n" 176 " | |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 177 " | |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 178 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 179 " | |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 180 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 181 " | `-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 182 " | `-- Sig:Sig5 (Type Fun) (A)\n" 183 " `-- Sig:Sig2 (Type Fun) (t=4 (/1) )\n" 184 " |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 185 " |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 186 " | `-- Sig:Sig5 (Type Fun) (A)\n" 187 " |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 188 " | `-- Sig:Sig5 (Type Fun) (A)\n" 189 " `-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 190 " `-- Sig:Sig5 (Type Fun) (A)"));
195 output_test_stream output;
198 output.is_equal(
"-- Sig:Sig1 (Type Fun) (t=4 (/1) )\n" 199 " |-- Sig:Sig3 (Type Fun) (t=4 (/1) )\n" 200 " | |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 201 " | |-- Sig:Sig5 (Type Fun) (A)\n" 202 " | `-- Sig:Sig2 (Type Fun) (t=4 (/1) )\n" 203 " | |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 204 " | |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 205 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 206 " | |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 207 " | | `-- Sig:Sig5 (Type Fun) (A)\n" 208 " | `-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 209 " | `-- Sig:Sig5 (Type Fun) (A)\n" 210 " `-- Sig:Sig2 (Type Fun) (t=4 (/1) )\n" 211 " |-- Sig:Sig6 (Type Fun) (ready=FALSE)\n" 212 " |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 213 " | `-- Sig:Sig5 (Type Fun) (A)\n" 214 " |-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 215 " | `-- Sig:Sig5 (Type Fun) (A)\n" 216 " `-- Sig:Sig4 (Type Fun) (t=4 (/1) )\n" 217 " `-- Sig:Sig5 (Type Fun) (A)"));
222 output_test_stream output;
224 BOOST_CHECK(output.is_equal(
""));
228 const double &avalue = sig1(6);
237 std::cout <<
"Message: test \n";
const T & access(const Time &t1)
std::ostream & writeGraph(std::ostream &os) const
A helper class for setting and specifying dependencies between signals.
void setDependencyType(DependencyType dep)
dynamicgraph::SignalArray_const< double > sig
std::list< sigDouble_t * > inputsig
virtual void checkCompatibility()
DummyClass(const std::string &n)
std::list< sigString_t * > inputsigV
virtual void removeDependency(const SignalBase< Time > &signal)
dynamicgraph::SignalTimeDependent< double, int > sigDouble_t
void add(sigString_t &sig)
void add(sigDouble_t &sig)
dynamicgraph::SignalTimeDependent< std::string, int > sigString_t
BOOST_AUTO_TEST_CASE(signaltimedependent)
void setReady(const bool sready=true)
virtual bool needUpdate(const Time &t) const
virtual void setFunction(boost::function2< T &, T &, Time > t, Mutex *mutexref=NULL)
virtual Time getPeriodTime() const
std::ostream & displayDependencies(std::ostream &os, const int depth=-1, std::string space="", std::string next1="", std::string next2="") const
virtual void setPeriodTime(const Time &p)