Commit 70864112 authored by Olivier Stasse's avatar Olivier Stasse

clang format.

parent f9edb95c
Pipeline #8203 passed with stage
in 8 minutes and 16 seconds
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "dynamic-graph/command-setter.h" #include "dynamic-graph/command-setter.h"
#include "dynamic-graph/linear-algebra.h" #include "dynamic-graph/linear-algebra.h"
#include "dynamic-graph/command-setter.h"
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include <sstream> #include <sstream>
......
...@@ -27,17 +27,17 @@ namespace dynamicgraph { ...@@ -27,17 +27,17 @@ namespace dynamicgraph {
/** Enum representing the different kind of messages. /** Enum representing the different kind of messages.
*/ */
enum MsgType { enum MsgType {
MSG_TYPE_TYPE_BITS = 1<<0 | 1<<1 | 1<<2 | 1<<3, // 15 MSG_TYPE_TYPE_BITS = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 3, // 15
MSG_TYPE_STREAM_BIT = 1<<4, // 16 MSG_TYPE_STREAM_BIT = 1 << 4, // 16
MSG_TYPE_DEBUG = 1<<3, // 1 MSG_TYPE_DEBUG = 1 << 3, // 1
MSG_TYPE_INFO = 1<<2, // 2 MSG_TYPE_INFO = 1 << 2, // 2
MSG_TYPE_WARNING = 1<<1, // 4 MSG_TYPE_WARNING = 1 << 1, // 4
MSG_TYPE_ERROR = 1<<0, // 8 MSG_TYPE_ERROR = 1 << 0, // 8
MSG_TYPE_DEBUG_STREAM = MSG_TYPE_DEBUG | MSG_TYPE_STREAM_BIT, // 17 MSG_TYPE_DEBUG_STREAM = MSG_TYPE_DEBUG | MSG_TYPE_STREAM_BIT, // 17
MSG_TYPE_INFO_STREAM = MSG_TYPE_INFO | MSG_TYPE_STREAM_BIT, // 18 MSG_TYPE_INFO_STREAM = MSG_TYPE_INFO | MSG_TYPE_STREAM_BIT, // 18
MSG_TYPE_WARNING_STREAM = MSG_TYPE_WARNING | MSG_TYPE_STREAM_BIT, // 20 MSG_TYPE_WARNING_STREAM = MSG_TYPE_WARNING | MSG_TYPE_STREAM_BIT, // 20
MSG_TYPE_ERROR_STREAM = MSG_TYPE_ERROR | MSG_TYPE_STREAM_BIT // 24 MSG_TYPE_ERROR_STREAM = MSG_TYPE_ERROR | MSG_TYPE_STREAM_BIT // 24
}; };
} // namespace dynamicgraph } // namespace dynamicgraph
...@@ -92,7 +92,6 @@ namespace dynamicgraph { ...@@ -92,7 +92,6 @@ namespace dynamicgraph {
#define DYNAMIC_GRAPH_ENTITY_ERROR_STREAM(entity) \ #define DYNAMIC_GRAPH_ENTITY_ERROR_STREAM(entity) \
_DYNAMIC_GRAPH_ENTITY_MSG(entity, MSG_TYPE_ERROR_STREAM) _DYNAMIC_GRAPH_ENTITY_MSG(entity, MSG_TYPE_ERROR_STREAM)
template <typename T> template <typename T>
std::string toString(const T &v, const int precision = 3, std::string toString(const T &v, const int precision = 3,
const int width = -1) { const int width = -1) {
...@@ -143,11 +142,11 @@ std::string toString(const Eigen::MatrixBase<T> &v, const int precision = 3, ...@@ -143,11 +142,11 @@ std::string toString(const Eigen::MatrixBase<T> &v, const int precision = 3,
} }
enum LoggerVerbosity { enum LoggerVerbosity {
VERBOSITY_ALL = MSG_TYPE_DEBUG, VERBOSITY_ALL = MSG_TYPE_DEBUG,
VERBOSITY_INFO_WARNING_ERROR = MSG_TYPE_INFO, VERBOSITY_INFO_WARNING_ERROR = MSG_TYPE_INFO,
VERBOSITY_WARNING_ERROR = MSG_TYPE_WARNING, VERBOSITY_WARNING_ERROR = MSG_TYPE_WARNING,
VERBOSITY_ERROR = MSG_TYPE_ERROR, VERBOSITY_ERROR = MSG_TYPE_ERROR,
VERBOSITY_NONE = 0 VERBOSITY_NONE = 0
}; };
/// \ingroup debug /// \ingroup debug
...@@ -209,7 +208,7 @@ public: ...@@ -209,7 +208,7 @@ public:
* iterations. * iterations.
* \param lineId typically __FILE__ ":" BOOST_PP_STRINGIZE(__LINE__) * \param lineId typically __FILE__ ":" BOOST_PP_STRINGIZE(__LINE__)
*/ */
RTLoggerStream stream(MsgType type, const std::string& lineId = "") { RTLoggerStream stream(MsgType type, const std::string &lineId = "") {
RealTimeLogger &rtlogger = ::dynamicgraph::RealTimeLogger::instance(); RealTimeLogger &rtlogger = ::dynamicgraph::RealTimeLogger::instance();
if (acceptMsg(type, lineId)) if (acceptMsg(type, lineId))
return rtlogger.front(); return rtlogger.front();
...@@ -221,15 +220,15 @@ public: ...@@ -221,15 +220,15 @@ public:
* stream(type, lineId) << msg << '\n'; * stream(type, lineId) << msg << '\n';
* \endcode * \endcode
*/ */
void sendMsg(std::string msg, MsgType type, const std::string& lineId = ""); void sendMsg(std::string msg, MsgType type, const std::string &lineId = "");
/** \deprecated instead, use /** \deprecated instead, use
* \code * \code
* stream(type, lineId) << msg << '\n'; * stream(type, lineId) << msg << '\n';
* \endcode * \endcode
*/ */
void sendMsg(std::string msg, MsgType type, const std::string& file, void sendMsg(std::string msg, MsgType type, const std::string &file,
int line) DYNAMIC_GRAPH_DEPRECATED; int line) DYNAMIC_GRAPH_DEPRECATED;
/** Set the sampling time at which the method countdown() /** Set the sampling time at which the method countdown()
* is going to be called. */ * is going to be called. */
...@@ -264,28 +263,27 @@ protected: ...@@ -264,28 +263,27 @@ protected:
the collection of streaming messages */ the collection of streaming messages */
StreamCounterMap_t m_stream_msg_counters; StreamCounterMap_t m_stream_msg_counters;
inline bool isStreamMsg(MsgType m) { inline bool isStreamMsg(MsgType m) { return (m & MSG_TYPE_STREAM_BIT); }
return (m & MSG_TYPE_STREAM_BIT);
}
/** Check whether a message of type \m and from \c lineId should be accepted. /** Check whether a message of type \m and from \c lineId should be accepted.
* \note If \c is a stream type, the internal counter associated to \c lineId * \note If \c is a stream type, the internal counter associated to \c lineId
* is updated. * is updated.
*/ */
bool acceptMsg (MsgType m, const std::string& lineId) { bool acceptMsg(MsgType m, const std::string &lineId) {
// If more verbose than the current verbosity level // If more verbose than the current verbosity level
if ((m & MSG_TYPE_TYPE_BITS) > m_lv) if ((m & MSG_TYPE_TYPE_BITS) > m_lv)
return false; return false;
// if print is allowed by current verbosity level // if print is allowed by current verbosity level
if (isStreamMsg(m)) return checkStreamPeriod(lineId); if (isStreamMsg(m))
return checkStreamPeriod(lineId);
return true; return true;
} }
/** Check whether a message from \c lineId should be accepted. /** Check whether a message from \c lineId should be accepted.
* \note The internal counter associated to \c lineId is updated. * \note The internal counter associated to \c lineId is updated.
*/ */
bool checkStreamPeriod (const std::string& lineId); bool checkStreamPeriod(const std::string &lineId);
}; };
} // namespace dynamicgraph } // namespace dynamicgraph
......
...@@ -107,8 +107,8 @@ public: ...@@ -107,8 +107,8 @@ public:
Vector vectorValue() const; Vector vectorValue() const;
Eigen::MatrixXd matrixXdValue() const; Eigen::MatrixXd matrixXdValue() const;
Eigen::Matrix4d matrix4dValue() const; Eigen::Matrix4d matrix4dValue() const;
Values valuesValue () const; Values valuesValue() const;
const Values &constValuesValue () const; const Values &constValuesValue() const;
Type type_; Type type_;
const void *const value_; const void *const value_;
}; };
......
...@@ -82,8 +82,7 @@ Value::Value(const Eigen::MatrixXd &value) ...@@ -82,8 +82,7 @@ Value::Value(const Eigen::MatrixXd &value)
: type_(MATRIX), value_(new Eigen::MatrixXd(value)) {} : type_(MATRIX), value_(new Eigen::MatrixXd(value)) {}
Value::Value(const Eigen::Matrix4d &value) Value::Value(const Eigen::Matrix4d &value)
: type_(MATRIX4D), value_(new Eigen::Matrix4d(value)) {} : type_(MATRIX4D), value_(new Eigen::Matrix4d(value)) {}
Value::Value(const Values &value) Value::Value(const Values &value) : type_(VALUES), value_(new Values(value)) {}
: type_(VALUES), value_(new Values(value)) {}
Value::Value(const Value &value) Value::Value(const Value &value)
: type_(value.type_), value_(copyValue(value)) {} : type_(value.type_), value_(copyValue(value)) {}
...@@ -145,20 +144,33 @@ Value Value::operator=(const Value &value) { ...@@ -145,20 +144,33 @@ Value Value::operator=(const Value &value) {
} }
bool Value::operator==(const Value &other) const { bool Value::operator==(const Value &other) const {
if (type_ != other.type_) return false; if (type_ != other.type_)
return false;
switch (type_) { switch (type_) {
case Value::BOOL: return boolValue() == other.boolValue(); case Value::BOOL:
case Value::UNSIGNED: return unsignedValue() == other.unsignedValue(); return boolValue() == other.boolValue();
case Value::INT: return intValue() == other.intValue(); case Value::UNSIGNED:
case Value::DOUBLE: return doubleValue() == other.doubleValue(); return unsignedValue() == other.unsignedValue();
case Value::FLOAT: return floatValue() == other.floatValue(); case Value::INT:
case Value::STRING: return stringValue() == other.stringValue(); return intValue() == other.intValue();
case Value::VECTOR: return vectorValue() == other.vectorValue(); case Value::DOUBLE:
case Value::MATRIX: return matrixXdValue() == other.matrixXdValue(); return doubleValue() == other.doubleValue();
case Value::MATRIX4D: return matrix4dValue() == other.matrix4dValue(); case Value::FLOAT:
case Value::VALUES: return constValuesValue() == other.constValuesValue(); return floatValue() == other.floatValue();
case Value::NONE: break; case Value::STRING:
default: break; return stringValue() == other.stringValue();
case Value::VECTOR:
return vectorValue() == other.vectorValue();
case Value::MATRIX:
return matrixXdValue() == other.matrixXdValue();
case Value::MATRIX4D:
return matrix4dValue() == other.matrix4dValue();
case Value::VALUES:
return constValuesValue() == other.constValuesValue();
case Value::NONE:
break;
default:
break;
} }
return false; return false;
} }
...@@ -299,15 +311,13 @@ std::ostream &operator<<(std::ostream &os, const Value &value) { ...@@ -299,15 +311,13 @@ std::ostream &operator<<(std::ostream &os, const Value &value) {
case Value::MATRIX4D: case Value::MATRIX4D:
os << value.matrix4dValue(); os << value.matrix4dValue();
break; break;
case Value::VALUES: case Value::VALUES: {
{ const std::vector<Value> &vals = value.constValuesValue();
const std::vector<Value>& vals = value.constValuesValue(); os << "[ ";
os << "[ "; for (std::size_t i = 0; i < vals.size(); ++i)
for (std::size_t i = 0; i < vals.size(); ++i) os << "Value(" << vals[i] << "), ";
os << "Value(" << vals[i] << "), "; os << "]";
os << "]"; } break;
}
break;
default: default:
return os; return os;
} }
......
...@@ -34,65 +34,65 @@ public: ...@@ -34,65 +34,65 @@ public:
logger_.setVerbosity(VERBOSITY_NONE); logger_.setVerbosity(VERBOSITY_NONE);
BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_NONE); BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_NONE);
BOOST_CHECK( logger_.stream(MSG_TYPE_DEBUG ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_DEBUG).isNull());
BOOST_CHECK( logger_.stream(MSG_TYPE_INFO ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_INFO).isNull());
BOOST_CHECK( logger_.stream(MSG_TYPE_WARNING).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_WARNING).isNull());
BOOST_CHECK( logger_.stream(MSG_TYPE_ERROR ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_ERROR).isNull());
logger_.setVerbosity(VERBOSITY_ERROR); logger_.setVerbosity(VERBOSITY_ERROR);
BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_ERROR); BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_ERROR);
BOOST_CHECK( logger_.stream(MSG_TYPE_DEBUG ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_DEBUG).isNull());
BOOST_CHECK( logger_.stream(MSG_TYPE_INFO ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_INFO).isNull());
BOOST_CHECK( logger_.stream(MSG_TYPE_WARNING).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_WARNING).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR).isNull());
logger_.setVerbosity(VERBOSITY_WARNING_ERROR); logger_.setVerbosity(VERBOSITY_WARNING_ERROR);
BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_WARNING_ERROR); BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_WARNING_ERROR);
BOOST_CHECK( logger_.stream(MSG_TYPE_DEBUG ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_DEBUG).isNull());
BOOST_CHECK( logger_.stream(MSG_TYPE_INFO ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_INFO).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_WARNING).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_WARNING).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR).isNull());
logger_.setVerbosity(VERBOSITY_INFO_WARNING_ERROR); logger_.setVerbosity(VERBOSITY_INFO_WARNING_ERROR);
BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_INFO_WARNING_ERROR); BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_INFO_WARNING_ERROR);
BOOST_CHECK( logger_.stream(MSG_TYPE_DEBUG ).isNull()); BOOST_CHECK(logger_.stream(MSG_TYPE_DEBUG).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_INFO ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_INFO).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_WARNING).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_WARNING).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR).isNull());
logger_.setVerbosity(VERBOSITY_ALL); logger_.setVerbosity(VERBOSITY_ALL);
BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_ALL); BOOST_CHECK_EQUAL(logger_.getVerbosity(), VERBOSITY_ALL);
BOOST_CHECK(!logger_.stream(MSG_TYPE_DEBUG ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_DEBUG).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_INFO ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_INFO).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_WARNING).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_WARNING).isNull());
BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR ).isNull()); BOOST_CHECK(!logger_.stream(MSG_TYPE_ERROR).isNull());
} }
~CustomEntity() {} ~CustomEntity() {}
void testDebugTrace() { void testDebugTrace() {
logger_.stream(MSG_TYPE_DEBUG) logger_.stream(MSG_TYPE_DEBUG)
<< "This is a message of level MSG_TYPE_DEBUG\n"; << "This is a message of level MSG_TYPE_DEBUG\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_INFO) logger_.stream(MSG_TYPE_INFO)
<< "This is a message of level MSG_TYPE_INFO\n"; << "This is a message of level MSG_TYPE_INFO\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_WARNING) logger_.stream(MSG_TYPE_WARNING)
<< "This is a message of level MSG_TYPE_WARNING\n"; << "This is a message of level MSG_TYPE_WARNING\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_ERROR) logger_.stream(MSG_TYPE_ERROR)
<< "This is a message of level MSG_TYPE_ERROR\n"; << "This is a message of level MSG_TYPE_ERROR\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_DEBUG_STREAM) logger_.stream(MSG_TYPE_DEBUG_STREAM)
<< "This is a message of level MSG_TYPE_DEBUG_STREAM\n"; << "This is a message of level MSG_TYPE_DEBUG_STREAM\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_INFO_STREAM) logger_.stream(MSG_TYPE_INFO_STREAM)
<< "This is a message of level MSG_TYPE_INFO_STREAM\n"; << "This is a message of level MSG_TYPE_INFO_STREAM\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_WARNING_STREAM) logger_.stream(MSG_TYPE_WARNING_STREAM)
<< "This is a message of level MSG_TYPE_WARNING_STREAM\n"; << "This is a message of level MSG_TYPE_WARNING_STREAM\n";
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_ERROR_STREAM) logger_.stream(MSG_TYPE_ERROR_STREAM)
<< "This is a message of level MSG_TYPE_ERROR_STREAM\n"; << "This is a message of level MSG_TYPE_ERROR_STREAM\n";
/* Add test toString */ /* Add test toString */
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
double q = 1.0; double q = 1.0;
...@@ -103,13 +103,16 @@ public: ...@@ -103,13 +103,16 @@ public:
vq[0] = 1.0; vq[0] = 1.0;
vq[1] = 2.0; vq[1] = 2.0;
vq[2] = 3.0; vq[2] = 3.0;
logger_.stream(MSG_TYPE_INFO) << "Value to display: " << toString(vq) << '\n'; logger_.stream(MSG_TYPE_INFO)
<< "Value to display: " << toString(vq) << '\n';
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.stream(MSG_TYPE_INFO) << "Value to display: " << toString(vq, 3, 10) << '\n'; logger_.stream(MSG_TYPE_INFO)
<< "Value to display: " << toString(vq, 3, 10) << '\n';
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
Eigen::Matrix<double, 3, 3> an_eig_m; Eigen::Matrix<double, 3, 3> an_eig_m;
an_eig_m.setOnes(); an_eig_m.setOnes();
logger_.stream(MSG_TYPE_INFO) << "Value to display: " << toString(an_eig_m) << '\n'; logger_.stream(MSG_TYPE_INFO)
<< "Value to display: " << toString(an_eig_m) << '\n';
dynamicgraph::RealTimeLogger::instance().spinOnce(); dynamicgraph::RealTimeLogger::instance().spinOnce();
logger_.countdown(); logger_.countdown();
} }
......
...@@ -218,13 +218,17 @@ BOOST_AUTO_TEST_CASE(sendMsg) { ...@@ -218,13 +218,17 @@ BOOST_AUTO_TEST_CASE(sendMsg) {
#define __FILELINE__ __FILE__ BOOST_PP_STRINGIZE(__LINE__) #define __FILELINE__ __FILE__ BOOST_PP_STRINGIZE(__LINE__)
entity.logger().stream(dynamicgraph::MSG_TYPE_DEBUG, __FILELINE__) entity.logger().stream(dynamicgraph::MSG_TYPE_DEBUG, __FILELINE__)
<< "Auto Test Case" << " DEBUG" << '\n'; << "Auto Test Case"
<< " DEBUG" << '\n';
entity.logger().stream(dynamicgraph::MSG_TYPE_INFO, __FILELINE__) entity.logger().stream(dynamicgraph::MSG_TYPE_INFO, __FILELINE__)
<< "Auto Test Case" << " INFO" << '\n'; << "Auto Test Case"
<< " INFO" << '\n';
entity.logger().stream(dynamicgraph::MSG_TYPE_WARNING, __FILELINE__) entity.logger().stream(dynamicgraph::MSG_TYPE_WARNING, __FILELINE__)
<< "Auto Test Case" << " WARNING" << '\n'; << "Auto Test Case"
<< " WARNING" << '\n';
entity.logger().stream(dynamicgraph::MSG_TYPE_ERROR, __FILELINE__) entity.logger().stream(dynamicgraph::MSG_TYPE_ERROR, __FILELINE__)
<< "Auto Test Case" << " ERROR" << '\n'; << "Auto Test Case"
<< " ERROR" << '\n';
#undef __FILELINE__ #undef __FILELINE__
}; };
}; };
......
...@@ -210,25 +210,23 @@ BOOST_AUTO_TEST_CASE(signal_caster_basics) { ...@@ -210,25 +210,23 @@ BOOST_AUTO_TEST_CASE(signal_caster_basics) {
/// Unregister a type /// Unregister a type
asig_caster->unregisterCast(typeid(double)); asig_caster->unregisterCast(typeid(double));
/// Unregister the type a second time to generate exception /// Unregister the type a second time to generate exception
bool res= false; bool res = false;
try { try {
asig_caster->unregisterCast(typeid(double)); asig_caster->unregisterCast(typeid(double));
} catch (ExceptionSignal &aes) } catch (ExceptionSignal &aes) {
{
res = (aes.getCode() == ExceptionSignal::GENERIC); res = (aes.getCode() == ExceptionSignal::GENERIC);
} }
BOOST_CHECK(res); BOOST_CHECK(res);
/// Get the type cast to generate exception /// Get the type cast to generate exception
res= false; res = false;
double ad=2.0; double ad = 2.0;
output_test_stream output; output_test_stream output;
try { try {
asig_caster->disp(ad,output); asig_caster->disp(ad, output);
} catch (ExceptionSignal &aes) } catch (ExceptionSignal &aes) {
{
res = (aes.getCode() == ExceptionSignal::BAD_CAST); res = (aes.getCode() == ExceptionSignal::BAD_CAST);
} }
BOOST_CHECK(res); BOOST_CHECK(res);
......
...@@ -376,26 +376,26 @@ BOOST_AUTO_TEST_CASE(value_values) { ...@@ -376,26 +376,26 @@ BOOST_AUTO_TEST_CASE(value_values) {
Value vd1(d1); Value vd1(d1);
Values values; Values values;
values.push_back (vs1); values.push_back(vs1);
values.push_back (vd1); values.push_back(vd1);
Value vvalues (values); Value vvalues(values);
BOOST_CHECK_EQUAL(vvalues.type(), Value::VALUES); BOOST_CHECK_EQUAL(vvalues.type(), Value::VALUES);
{ // Const ref { // Const ref
const Values& vs = vvalues.constValuesValue(); const Values &vs = vvalues.constValuesValue();
BOOST_CHECK_EQUAL(vs.size(), values.size()); BOOST_CHECK_EQUAL(vs.size(), values.size());
BOOST_CHECK(vs == values); BOOST_CHECK(vs == values);
} }
{ // Cast does not work. {
//dg::command::EitherType eitherType (vvalues); // Cast does not work.
//Values vs = static_cast<Values>(eitherType); // dg::command::EitherType eitherType (vvalues);
//BOOST_CHECK_EQUAL(vs.size(), values.size()); // Values vs = static_cast<Values>(eitherType);
//BOOST_CHECK(vs == values); // BOOST_CHECK_EQUAL(vs.size(), values.size());
} // BOOST_CHECK(vs == values);
{ // Constructor } { // Constructor
Value vvs (vvalues); Value vvs(vvalues);
BOOST_CHECK(vvs == vvalues); BOOST_CHECK(vvs == vvalues);
} }
......
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