mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Compare commits
14 Commits
release-0.
...
release-0.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fa6a71e37f | ||
![]() |
e5aa599b27 | ||
![]() |
2375f2c66b | ||
![]() |
895af26226 | ||
![]() |
ae42def6cf | ||
![]() |
e0ae477b8f | ||
![]() |
434c6a5697 | ||
![]() |
097ac171c6 | ||
![]() |
0482463569 | ||
![]() |
5dbcf7eeb1 | ||
![]() |
f5418306d6 | ||
![]() |
04937649b7 | ||
![]() |
71f35b1104 | ||
![]() |
c335c8dd75 |
@@ -23,7 +23,7 @@ project(YAML_CPP)
|
|||||||
|
|
||||||
set(YAML_CPP_VERSION_MAJOR "0")
|
set(YAML_CPP_VERSION_MAJOR "0")
|
||||||
set(YAML_CPP_VERSION_MINOR "5")
|
set(YAML_CPP_VERSION_MINOR "5")
|
||||||
set(YAML_CPP_VERSION_PATCH "0")
|
set(YAML_CPP_VERSION_PATCH "1")
|
||||||
set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
|
set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
@@ -55,6 +55,7 @@ namespace YAML
|
|||||||
const char * const AMBIGUOUS_ANCHOR = "cannot assign the same alias to multiple nodes";
|
const char * const AMBIGUOUS_ANCHOR = "cannot assign the same alias to multiple nodes";
|
||||||
const char * const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
|
const char * const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
|
||||||
|
|
||||||
|
const char * const INVALID_NODE = "invalid node; this may result from using a map iterator as a sequence iterator, or vice-versa";
|
||||||
const char * const INVALID_SCALAR = "invalid scalar";
|
const char * const INVALID_SCALAR = "invalid scalar";
|
||||||
const char * const KEY_NOT_FOUND = "key not found";
|
const char * const KEY_NOT_FOUND = "key not found";
|
||||||
const char * const BAD_CONVERSION = "bad conversion";
|
const char * const BAD_CONVERSION = "bad conversion";
|
||||||
@@ -149,6 +150,12 @@ namespace YAML
|
|||||||
return TypedKeyNotFound <T> (mark, key);
|
return TypedKeyNotFound <T> (mark, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InvalidNode: public RepresentationException {
|
||||||
|
public:
|
||||||
|
InvalidNode()
|
||||||
|
: RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
|
||||||
|
};
|
||||||
|
|
||||||
class BadConversion: public RepresentationException {
|
class BadConversion: public RepresentationException {
|
||||||
public:
|
public:
|
||||||
BadConversion()
|
BadConversion()
|
||||||
|
@@ -47,6 +47,21 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// C-strings can only be encoded
|
||||||
|
template<>
|
||||||
|
struct convert<const char *> {
|
||||||
|
static Node encode(const char *&rhs) {
|
||||||
|
return Node(rhs);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<std::size_t N>
|
||||||
|
struct convert<const char[N]> {
|
||||||
|
static Node encode(const char (&rhs)[N]) {
|
||||||
|
return Node(rhs);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct convert<_Null> {
|
struct convert<_Null> {
|
||||||
static Node encode(const _Null& /* rhs */) {
|
static Node encode(const _Null& /* rhs */) {
|
||||||
@@ -58,11 +73,12 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define YAML_DEFINE_CONVERT_STREAMABLE(type)\
|
#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op)\
|
||||||
template<>\
|
template<>\
|
||||||
struct convert<type> {\
|
struct convert<type> {\
|
||||||
static Node encode(const type& rhs) {\
|
static Node encode(const type& rhs) {\
|
||||||
std::stringstream stream;\
|
std::stringstream stream;\
|
||||||
|
stream.precision(std::numeric_limits<type>::digits10 + 1);\
|
||||||
stream << rhs;\
|
stream << rhs;\
|
||||||
return Node(stream.str());\
|
return Node(stream.str());\
|
||||||
}\
|
}\
|
||||||
@@ -80,7 +96,7 @@ namespace YAML
|
|||||||
rhs = std::numeric_limits<type>::infinity();\
|
rhs = std::numeric_limits<type>::infinity();\
|
||||||
return true;\
|
return true;\
|
||||||
} else if(conversion::IsNegativeInfinity(input)) {\
|
} else if(conversion::IsNegativeInfinity(input)) {\
|
||||||
rhs = -std::numeric_limits<type>::infinity();\
|
rhs = negative_op std::numeric_limits<type>::infinity();\
|
||||||
return true;\
|
return true;\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
@@ -94,22 +110,30 @@ namespace YAML
|
|||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(int);
|
#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type)\
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(unsigned);
|
YAML_DEFINE_CONVERT_STREAMABLE(type, -)
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(short);
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(unsigned short);
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(long);
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(unsigned long);
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(long long);
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(unsigned long long);
|
|
||||||
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(char);
|
#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type)\
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(unsigned char);
|
YAML_DEFINE_CONVERT_STREAMABLE(type, +)
|
||||||
|
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(float);
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int);
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(double);
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short);
|
||||||
YAML_DEFINE_CONVERT_STREAMABLE(long double);
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long);
|
||||||
|
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char);
|
||||||
|
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double);
|
||||||
|
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double);
|
||||||
|
|
||||||
|
#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED
|
||||||
|
#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED
|
||||||
#undef YAML_DEFINE_CONVERT_STREAMABLE
|
#undef YAML_DEFINE_CONVERT_STREAMABLE
|
||||||
|
|
||||||
// bool
|
// bool
|
||||||
@@ -200,6 +224,38 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// std::pair
|
||||||
|
template<typename T, typename U>
|
||||||
|
struct convert<std::pair<T, U> > {
|
||||||
|
static Node encode(const std::pair<T, U>& rhs) {
|
||||||
|
Node node(NodeType::Sequence);
|
||||||
|
node.push_back(rhs.first);
|
||||||
|
node.push_back(rhs.second);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool decode(const Node& node, std::pair<T, U>& rhs) {
|
||||||
|
if(!node.IsSequence())
|
||||||
|
return false;
|
||||||
|
if (node.size() != 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && __GNUC__ < 4
|
||||||
|
//workaround for GCC 3:
|
||||||
|
rhs.first = node[0].template as<T>();
|
||||||
|
#else
|
||||||
|
rhs.first = node[0].as<T>();
|
||||||
|
#endif
|
||||||
|
#if defined(__GNUC__) && __GNUC__ < 4
|
||||||
|
//workaround for GCC 3:
|
||||||
|
rhs.second = node[1].template as<U>();
|
||||||
|
#else
|
||||||
|
rhs.second = node[1].as<U>();
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
template<>
|
template<>
|
||||||
struct convert<Binary> {
|
struct convert<Binary> {
|
||||||
|
@@ -22,7 +22,7 @@ namespace YAML
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key>
|
template<typename Key>
|
||||||
struct get_idx<Key, typename boost::enable_if<boost::is_unsigned<Key> >::type> {
|
struct get_idx<Key, typename boost::enable_if_c<boost::is_unsigned<Key>::value && !boost::is_same<Key, bool>::value>::type> {
|
||||||
static node *get(const std::vector<node *>& sequence, const Key& key, shared_memory_holder /* pMemory */) {
|
static node *get(const std::vector<node *>& sequence, const Key& key, shared_memory_holder /* pMemory */) {
|
||||||
return key < sequence.size() ? sequence[key] : 0;
|
return key < sequence.size() ? sequence[key] : 0;
|
||||||
}
|
}
|
||||||
@@ -149,6 +149,11 @@ namespace YAML
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool node_data::equals(node& node, const char *rhs, shared_memory_holder pMemory)
|
||||||
|
{
|
||||||
|
return equals<std::string>(node, rhs, pMemory);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline node& node_data::convert_to_node(const T& rhs, shared_memory_holder pMemory)
|
inline node& node_data::convert_to_node(const T& rhs, shared_memory_holder pMemory)
|
||||||
{
|
{
|
||||||
|
@@ -77,6 +77,7 @@ namespace YAML
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static bool equals(node& node, const T& rhs, shared_memory_holder pMemory);
|
static bool equals(node& node, const T& rhs, shared_memory_holder pMemory);
|
||||||
|
static bool equals(node& node, const char *rhs, shared_memory_holder pMemory);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
||||||
|
@@ -15,30 +15,34 @@
|
|||||||
|
|
||||||
namespace YAML
|
namespace YAML
|
||||||
{
|
{
|
||||||
inline Node::Node(): m_pNode(NULL)
|
inline Node::Node(): m_isValid(true), m_pNode(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Node::Node(NodeType::value type): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
|
inline Node::Node(NodeType::value type): m_isValid(true), m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
|
||||||
{
|
{
|
||||||
m_pNode->set_type(type);
|
m_pNode->set_type(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline Node::Node(const T& rhs): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
|
inline Node::Node(const T& rhs): m_isValid(true), m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
|
||||||
{
|
{
|
||||||
Assign(rhs);
|
Assign(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Node::Node(const detail::iterator_value& rhs): m_pMemory(rhs.m_pMemory), m_pNode(rhs.m_pNode)
|
inline Node::Node(const detail::iterator_value& rhs): m_isValid(rhs.m_isValid), m_pMemory(rhs.m_pMemory), m_pNode(rhs.m_pNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Node::Node(const Node& rhs): m_pMemory(rhs.m_pMemory), m_pNode(rhs.m_pNode)
|
inline Node::Node(const Node& rhs): m_isValid(rhs.m_isValid), m_pMemory(rhs.m_pMemory), m_pNode(rhs.m_pNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory): m_pMemory(pMemory), m_pNode(&node)
|
inline Node::Node(Zombie): m_isValid(false), m_pNode(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory): m_isValid(true), m_pMemory(pMemory), m_pNode(&node)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +52,8 @@ namespace YAML
|
|||||||
|
|
||||||
inline void Node::EnsureNodeExists() const
|
inline void Node::EnsureNodeExists() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
if(!m_pNode) {
|
if(!m_pNode) {
|
||||||
m_pMemory.reset(new detail::memory_holder);
|
m_pMemory.reset(new detail::memory_holder);
|
||||||
m_pNode = &m_pMemory->create_node();
|
m_pNode = &m_pMemory->create_node();
|
||||||
@@ -57,11 +63,15 @@ namespace YAML
|
|||||||
|
|
||||||
inline bool Node::IsDefined() const
|
inline bool Node::IsDefined() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? m_pNode->is_defined() : true;
|
return m_pNode ? m_pNode->is_defined() : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NodeType::value Node::Type() const
|
inline NodeType::value Node::Type() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? m_pNode->type() : NodeType::Null;
|
return m_pNode ? m_pNode->type() : NodeType::Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,27 +138,37 @@ namespace YAML
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline const T Node::as() const
|
inline const T Node::as() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return as_if<T, void>(*this)();
|
return as_if<T, void>(*this)();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename S>
|
template<typename T, typename S>
|
||||||
inline const T Node::as(const S& fallback) const
|
inline const T Node::as(const S& fallback) const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return as_if<T, S>(*this)(fallback);
|
return as_if<T, S>(*this)(fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::string& Node::Scalar() const
|
inline const std::string& Node::Scalar() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
|
return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::string& Node::Tag() const
|
inline const std::string& Node::Tag() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
|
return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Node::SetTag(const std::string& tag)
|
inline void Node::SetTag(const std::string& tag)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
m_pNode->set_tag(tag);
|
m_pNode->set_tag(tag);
|
||||||
}
|
}
|
||||||
@@ -156,6 +176,8 @@ namespace YAML
|
|||||||
// assignment
|
// assignment
|
||||||
inline bool Node::is(const Node& rhs) const
|
inline bool Node::is(const Node& rhs) const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !rhs.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
if(!m_pNode || !rhs.m_pNode)
|
if(!m_pNode || !rhs.m_pNode)
|
||||||
return false;
|
return false;
|
||||||
return m_pNode->is(*rhs.m_pNode);
|
return m_pNode->is(*rhs.m_pNode);
|
||||||
@@ -164,42 +186,57 @@ namespace YAML
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline Node& Node::operator=(const T& rhs)
|
inline Node& Node::operator=(const T& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
Assign(rhs);
|
Assign(rhs);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Node::clear()
|
inline void Node::reset(const YAML::Node& rhs)
|
||||||
{
|
{
|
||||||
m_pNode = NULL;
|
if(!m_isValid || !rhs.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
|
m_pMemory = rhs.m_pMemory;
|
||||||
|
m_pNode = rhs.m_pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void Node::Assign(const T& rhs)
|
inline void Node::Assign(const T& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
AssignData(convert<T>::encode(rhs));
|
AssignData(convert<T>::encode(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void Node::Assign(const std::string& rhs)
|
inline void Node::Assign(const std::string& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
m_pNode->set_scalar(rhs);
|
m_pNode->set_scalar(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Node::Assign(const char *rhs)
|
inline void Node::Assign(const char *rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
m_pNode->set_scalar(rhs);
|
m_pNode->set_scalar(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Node::Assign(char *rhs)
|
inline void Node::Assign(char *rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
m_pNode->set_scalar(rhs);
|
m_pNode->set_scalar(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Node& Node::operator=(const Node& rhs)
|
inline Node& Node::operator=(const Node& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !rhs.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
if(is(rhs))
|
if(is(rhs))
|
||||||
return *this;
|
return *this;
|
||||||
AssignNode(rhs);
|
AssignNode(rhs);
|
||||||
@@ -208,6 +245,8 @@ namespace YAML
|
|||||||
|
|
||||||
inline void Node::AssignData(const Node& rhs)
|
inline void Node::AssignData(const Node& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !rhs.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
rhs.EnsureNodeExists();
|
rhs.EnsureNodeExists();
|
||||||
|
|
||||||
@@ -217,6 +256,8 @@ namespace YAML
|
|||||||
|
|
||||||
inline void Node::AssignNode(const Node& rhs)
|
inline void Node::AssignNode(const Node& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !rhs.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
rhs.EnsureNodeExists();
|
rhs.EnsureNodeExists();
|
||||||
|
|
||||||
if(!m_pNode) {
|
if(!m_pNode) {
|
||||||
@@ -233,26 +274,36 @@ namespace YAML
|
|||||||
// size/iterator
|
// size/iterator
|
||||||
inline std::size_t Node::size() const
|
inline std::size_t Node::size() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? m_pNode->size() : 0;
|
return m_pNode ? m_pNode->size() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const_iterator Node::begin() const
|
inline const_iterator Node::begin() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory) : const_iterator();
|
return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory) : const_iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline iterator Node::begin()
|
inline iterator Node::begin()
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator();
|
return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const_iterator Node::end() const
|
inline const_iterator Node::end() const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator();
|
return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline iterator Node::end()
|
inline iterator Node::end()
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator();
|
return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,11 +311,15 @@ namespace YAML
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline void Node::push_back(const T& rhs)
|
inline void Node::push_back(const T& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
push_back(Node(rhs));
|
push_back(Node(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Node::push_back(const Node& rhs)
|
inline void Node::push_back(const Node& rhs)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !rhs.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
rhs.EnsureNodeExists();
|
rhs.EnsureNodeExists();
|
||||||
|
|
||||||
@@ -321,6 +376,8 @@ namespace YAML
|
|||||||
template<typename Key>
|
template<typename Key>
|
||||||
inline const Node Node::operator[](const Key& key) const
|
inline const Node Node::operator[](const Key& key) const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
detail::node& value = static_cast<const detail::node&>(*m_pNode).get(detail::to_value(key), m_pMemory);
|
detail::node& value = static_cast<const detail::node&>(*m_pNode).get(detail::to_value(key), m_pMemory);
|
||||||
return Node(value, m_pMemory);
|
return Node(value, m_pMemory);
|
||||||
@@ -329,6 +386,8 @@ namespace YAML
|
|||||||
template<typename Key>
|
template<typename Key>
|
||||||
inline Node Node::operator[](const Key& key)
|
inline Node Node::operator[](const Key& key)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
|
detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
|
||||||
return Node(value, m_pMemory);
|
return Node(value, m_pMemory);
|
||||||
@@ -337,12 +396,16 @@ namespace YAML
|
|||||||
template<typename Key>
|
template<typename Key>
|
||||||
inline bool Node::remove(const Key& key)
|
inline bool Node::remove(const Key& key)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
return m_pNode->remove(detail::to_value(key), m_pMemory);
|
return m_pNode->remove(detail::to_value(key), m_pMemory);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Node Node::operator[](const Node& key) const
|
inline const Node Node::operator[](const Node& key) const
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !key.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
key.EnsureNodeExists();
|
key.EnsureNodeExists();
|
||||||
detail::node& value = static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
|
detail::node& value = static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
|
||||||
@@ -351,6 +414,8 @@ namespace YAML
|
|||||||
|
|
||||||
inline Node Node::operator[](const Node& key)
|
inline Node Node::operator[](const Node& key)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !key.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
key.EnsureNodeExists();
|
key.EnsureNodeExists();
|
||||||
detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
|
detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
|
||||||
@@ -359,6 +424,8 @@ namespace YAML
|
|||||||
|
|
||||||
inline bool Node::remove(const Node& key)
|
inline bool Node::remove(const Node& key)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid || !key.m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
key.EnsureNodeExists();
|
key.EnsureNodeExists();
|
||||||
return m_pNode->remove(*key.m_pNode, m_pMemory);
|
return m_pNode->remove(*key.m_pNode, m_pMemory);
|
||||||
@@ -368,6 +435,8 @@ namespace YAML
|
|||||||
template<typename Key, typename Value>
|
template<typename Key, typename Value>
|
||||||
inline void Node::force_insert(const Key& key, const Value& value)
|
inline void Node::force_insert(const Key& key, const Value& value)
|
||||||
{
|
{
|
||||||
|
if(!m_isValid)
|
||||||
|
throw InvalidNode();
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
m_pNode->force_insert(detail::to_value(key), detail::to_value(value), m_pMemory);
|
m_pNode->force_insert(detail::to_value(key), detail::to_value(value), m_pMemory);
|
||||||
}
|
}
|
||||||
|
@@ -19,8 +19,8 @@ namespace YAML
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
struct iterator_value: public Node, std::pair<Node, Node> {
|
struct iterator_value: public Node, std::pair<Node, Node> {
|
||||||
iterator_value() {}
|
iterator_value() {}
|
||||||
explicit iterator_value(const Node& rhs): Node(rhs) {}
|
explicit iterator_value(const Node& rhs): Node(rhs), std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
|
||||||
explicit iterator_value(const Node& key, const Node& value): std::pair<Node, Node>(key, value) {}
|
explicit iterator_value(const Node& key, const Node& value): Node(Node::ZombieNode), std::pair<Node, Node>(key, value) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ namespace YAML
|
|||||||
public:
|
public:
|
||||||
friend class NodeBuilder;
|
friend class NodeBuilder;
|
||||||
friend class NodeEvents;
|
friend class NodeEvents;
|
||||||
|
friend struct detail::iterator_value;
|
||||||
friend class detail::node_data;
|
friend class detail::node_data;
|
||||||
template<typename> friend class detail::iterator_base;
|
template<typename> friend class detail::iterator_base;
|
||||||
template<typename T, typename S> friend struct as_if;
|
template<typename T, typename S> friend struct as_if;
|
||||||
@@ -56,7 +57,7 @@ namespace YAML
|
|||||||
bool is(const Node& rhs) const;
|
bool is(const Node& rhs) const;
|
||||||
template<typename T> Node& operator=(const T& rhs);
|
template<typename T> Node& operator=(const T& rhs);
|
||||||
Node& operator=(const Node& rhs);
|
Node& operator=(const Node& rhs);
|
||||||
void clear();
|
void reset(const Node& rhs = Node());
|
||||||
|
|
||||||
// size/iterator
|
// size/iterator
|
||||||
std::size_t size() const;
|
std::size_t size() const;
|
||||||
@@ -85,6 +86,8 @@ namespace YAML
|
|||||||
void force_insert(const Key& key, const Value& value);
|
void force_insert(const Key& key, const Value& value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum Zombie { ZombieNode };
|
||||||
|
explicit Node(Zombie);
|
||||||
explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
|
explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
|
||||||
|
|
||||||
void EnsureNodeExists() const;
|
void EnsureNodeExists() const;
|
||||||
@@ -97,6 +100,7 @@ namespace YAML
|
|||||||
void AssignNode(const Node& rhs);
|
void AssignNode(const Node& rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_isValid;
|
||||||
mutable detail::shared_memory_holder m_pMemory;
|
mutable detail::shared_memory_holder m_pMemory;
|
||||||
mutable detail::node *m_pNode;
|
mutable detail::node *m_pNode;
|
||||||
};
|
};
|
||||||
|
@@ -19,8 +19,8 @@ namespace YAML
|
|||||||
m_seqFmt.set(Block);
|
m_seqFmt.set(Block);
|
||||||
m_mapFmt.set(Block);
|
m_mapFmt.set(Block);
|
||||||
m_mapKeyFmt.set(Auto);
|
m_mapKeyFmt.set(Auto);
|
||||||
m_floatPrecision.set(6);
|
m_floatPrecision.set(std::numeric_limits<float>::digits10 + 1);
|
||||||
m_doublePrecision.set(15);
|
m_doublePrecision.set(std::numeric_limits<double>::digits10 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitterState::~EmitterState()
|
EmitterState::~EmitterState()
|
||||||
@@ -367,7 +367,7 @@ namespace YAML
|
|||||||
|
|
||||||
bool EmitterState::SetFloatPrecision(int value, FmtScope::value scope)
|
bool EmitterState::SetFloatPrecision(int value, FmtScope::value scope)
|
||||||
{
|
{
|
||||||
if(value < 0 || value > std::numeric_limits<float>::digits10)
|
if(value < 0 || value > std::numeric_limits<float>::digits10 + 1)
|
||||||
return false;
|
return false;
|
||||||
_Set(m_floatPrecision, value, scope);
|
_Set(m_floatPrecision, value, scope);
|
||||||
return true;
|
return true;
|
||||||
@@ -375,7 +375,7 @@ namespace YAML
|
|||||||
|
|
||||||
bool EmitterState::SetDoublePrecision(int value, FmtScope::value scope)
|
bool EmitterState::SetDoublePrecision(int value, FmtScope::value scope)
|
||||||
{
|
{
|
||||||
if(value < 0 || value > std::numeric_limits<double>::digits10)
|
if(value < 0 || value > std::numeric_limits<double>::digits10 + 1)
|
||||||
return false;
|
return false;
|
||||||
_Set(m_doublePrecision, value, scope);
|
_Set(m_doublePrecision, value, scope);
|
||||||
return true;
|
return true;
|
||||||
|
@@ -76,6 +76,12 @@ namespace YAML
|
|||||||
|
|
||||||
const Token& token = m_scanner.peek();
|
const Token& token = m_scanner.peek();
|
||||||
|
|
||||||
|
if(token.type == Token::PLAIN_SCALAR && token.value == "null") {
|
||||||
|
eventHandler.OnNull(mark, anchor);
|
||||||
|
m_scanner.pop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// add non-specific tags
|
// add non-specific tags
|
||||||
if(tag.empty())
|
if(tag.empty())
|
||||||
tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?");
|
tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?");
|
||||||
@@ -256,6 +262,7 @@ namespace YAML
|
|||||||
throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP_FLOW);
|
throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP_FLOW);
|
||||||
|
|
||||||
Token& token = m_scanner.peek();
|
Token& token = m_scanner.peek();
|
||||||
|
const Mark mark = token.mark;
|
||||||
// first check for end
|
// first check for end
|
||||||
if(token.type == Token::FLOW_MAP_END) {
|
if(token.type == Token::FLOW_MAP_END) {
|
||||||
m_scanner.pop();
|
m_scanner.pop();
|
||||||
@@ -267,7 +274,7 @@ namespace YAML
|
|||||||
m_scanner.pop();
|
m_scanner.pop();
|
||||||
HandleNode(eventHandler);
|
HandleNode(eventHandler);
|
||||||
} else {
|
} else {
|
||||||
eventHandler.OnNull(token.mark, NullAnchor);
|
eventHandler.OnNull(mark, NullAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now grab value (optional)
|
// now grab value (optional)
|
||||||
@@ -275,7 +282,7 @@ namespace YAML
|
|||||||
m_scanner.pop();
|
m_scanner.pop();
|
||||||
HandleNode(eventHandler);
|
HandleNode(eventHandler);
|
||||||
} else {
|
} else {
|
||||||
eventHandler.OnNull(token.mark, NullAnchor);
|
eventHandler.OnNull(mark, NullAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_scanner.empty())
|
if(m_scanner.empty())
|
||||||
|
@@ -28,6 +28,18 @@ namespace Test
|
|||||||
EXPECT_DOC_END();
|
EXPECT_DOC_END();
|
||||||
DONE();
|
DONE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST NullStringScalar()
|
||||||
|
{
|
||||||
|
HANDLE("foo: null");
|
||||||
|
EXPECT_DOC_START();
|
||||||
|
EXPECT_MAP_START("?", 0);
|
||||||
|
EXPECT_SCALAR("?", 0, "foo");
|
||||||
|
EXPECT_NULL(0);
|
||||||
|
EXPECT_MAP_END();
|
||||||
|
EXPECT_DOC_END();
|
||||||
|
DONE();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -57,6 +69,7 @@ namespace Test
|
|||||||
int total = 0;
|
int total = 0;
|
||||||
RunParserTest(&Parser::NoEndOfMapFlow, "No end of map flow", passed, total);
|
RunParserTest(&Parser::NoEndOfMapFlow, "No end of map flow", passed, total);
|
||||||
RunParserTest(&Parser::PlainScalarStartingWithQuestionMark, "Plain scalar starting with question mark", passed, total);
|
RunParserTest(&Parser::PlainScalarStartingWithQuestionMark, "Plain scalar starting with question mark", passed, total);
|
||||||
|
RunParserTest(&Parser::NullStringScalar, "Null string scalar", passed, total);
|
||||||
|
|
||||||
std::cout << "Parser tests: " << passed << "/" << total << " passed\n";
|
std::cout << "Parser tests: " << passed << "/" << total << " passed\n";
|
||||||
return passed == total;
|
return passed == total;
|
||||||
|
@@ -8,15 +8,33 @@ namespace {
|
|||||||
TEST(): ok(false) {}
|
TEST(): ok(false) {}
|
||||||
TEST(bool ok_): ok(ok_) {}
|
TEST(bool ok_): ok(ok_) {}
|
||||||
TEST(const char *error_): ok(false), error(error_) {}
|
TEST(const char *error_): ok(false), error(error_) {}
|
||||||
|
TEST(const std::string& error_): ok(false), error(error_) {}
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
std::string error;
|
std::string error;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YAML_ASSERT(cond) do { if(!(cond)) return " Assert failed: " #cond; } while(false)
|
#define YAML_ASSERT(cond)\
|
||||||
|
do {\
|
||||||
|
if(!(cond))\
|
||||||
|
return " Assert failed: " #cond;\
|
||||||
|
} while(false)
|
||||||
|
|
||||||
#define YAML_ASSERT_THROWS(cond, exc) do { try { (cond); return " Expression did not throw: " #cond; } catch(const exc&) {} catch(...) { return " Expression threw something other than " #exc ": " #cond; } } while(false)
|
#define YAML_ASSERT_THROWS(cond, exc)\
|
||||||
|
do {\
|
||||||
|
try {\
|
||||||
|
(cond);\
|
||||||
|
return " Expression did not throw: " #cond;\
|
||||||
|
} catch(const exc&) {\
|
||||||
|
} catch(const std::runtime_error& e) {\
|
||||||
|
std::stringstream stream;\
|
||||||
|
stream << " Expression threw runtime error ther than " #exc ":\n " #cond "\n " << e.what();\
|
||||||
|
return stream.str();\
|
||||||
|
} catch(...) {\
|
||||||
|
return " Expression threw unknown exception, other than " #exc ":\n " #cond;\
|
||||||
|
}\
|
||||||
|
} while(false)
|
||||||
|
|
||||||
namespace Test
|
namespace Test
|
||||||
{
|
{
|
||||||
@@ -168,6 +186,18 @@ namespace Test
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST StdPair()
|
||||||
|
{
|
||||||
|
std::pair<int, std::string> p;
|
||||||
|
p.first = 5;
|
||||||
|
p.second = "five";
|
||||||
|
|
||||||
|
YAML::Node node;
|
||||||
|
node["pair"] = p;
|
||||||
|
YAML_ASSERT((node["pair"].as<std::pair<int, std::string> >() == p));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
TEST SimpleAlias()
|
TEST SimpleAlias()
|
||||||
{
|
{
|
||||||
YAML::Node node;
|
YAML::Node node;
|
||||||
@@ -307,7 +337,7 @@ namespace Test
|
|||||||
YAML::Node node = YAML::Load("[1.5, 1, .nan, .inf, -.inf, 0x15, 015]");
|
YAML::Node node = YAML::Load("[1.5, 1, .nan, .inf, -.inf, 0x15, 015]");
|
||||||
YAML_ASSERT(node[0].as<float>() == 1.5f);
|
YAML_ASSERT(node[0].as<float>() == 1.5f);
|
||||||
YAML_ASSERT(node[0].as<double>() == 1.5);
|
YAML_ASSERT(node[0].as<double>() == 1.5);
|
||||||
YAML_ASSERT_THROWS(node[0].as<int>(), std::runtime_error);
|
YAML_ASSERT_THROWS(node[0].as<int>(), YAML::TypedBadConversion<int>);
|
||||||
YAML_ASSERT(node[1].as<int>() == 1);
|
YAML_ASSERT(node[1].as<int>() == 1);
|
||||||
YAML_ASSERT(node[1].as<float>() == 1.0f);
|
YAML_ASSERT(node[1].as<float>() == 1.0f);
|
||||||
YAML_ASSERT(node[2].as<float>() != node[2].as<float>());
|
YAML_ASSERT(node[2].as<float>() != node[2].as<float>());
|
||||||
@@ -444,12 +474,36 @@ namespace Test
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST ClearNode()
|
TEST ResetNode()
|
||||||
{
|
{
|
||||||
YAML::Node node = YAML::Load("[1, 2, 3]");
|
YAML::Node node = YAML::Load("[1, 2, 3]");
|
||||||
YAML_ASSERT(!node.IsNull());
|
YAML_ASSERT(!node.IsNull());
|
||||||
node.clear();
|
YAML::Node other = node;
|
||||||
|
node.reset();
|
||||||
YAML_ASSERT(node.IsNull());
|
YAML_ASSERT(node.IsNull());
|
||||||
|
YAML_ASSERT(!other.IsNull());
|
||||||
|
node.reset(other);
|
||||||
|
YAML_ASSERT(!node.IsNull());
|
||||||
|
YAML_ASSERT(other == node);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST DereferenceIteratorError()
|
||||||
|
{
|
||||||
|
YAML::Node node = YAML::Load("[{a: b}, 1, 2]");
|
||||||
|
YAML_ASSERT_THROWS(node.begin()->first.as<int>(), YAML::InvalidNode);
|
||||||
|
YAML_ASSERT((*node.begin()).IsMap() == true);
|
||||||
|
YAML_ASSERT(node.begin()->IsMap() == true);
|
||||||
|
YAML_ASSERT_THROWS((*node.begin()->begin()).IsDefined(), YAML::InvalidNode);
|
||||||
|
YAML_ASSERT_THROWS(node.begin()->begin()->IsDefined(), YAML::InvalidNode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST FloatingPrecision()
|
||||||
|
{
|
||||||
|
const double x = 0.123456789;
|
||||||
|
YAML::Node node = YAML::Node(x);
|
||||||
|
YAML_ASSERT(node.as<double>() == x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,8 +512,9 @@ namespace Test
|
|||||||
TEST ret;
|
TEST ret;
|
||||||
try {
|
try {
|
||||||
ret = test();
|
ret = test();
|
||||||
} catch(...) {
|
} catch(const std::exception& e) {
|
||||||
ret.ok = false;
|
ret.ok = false;
|
||||||
|
ret.error = e.what();
|
||||||
}
|
}
|
||||||
if(ret.ok) {
|
if(ret.ok) {
|
||||||
passed++;
|
passed++;
|
||||||
@@ -487,6 +542,7 @@ namespace Test
|
|||||||
RunNodeTest(&Node::StdVector, "std::vector", passed, total);
|
RunNodeTest(&Node::StdVector, "std::vector", passed, total);
|
||||||
RunNodeTest(&Node::StdList, "std::list", passed, total);
|
RunNodeTest(&Node::StdList, "std::list", passed, total);
|
||||||
RunNodeTest(&Node::StdMap, "std::map", passed, total);
|
RunNodeTest(&Node::StdMap, "std::map", passed, total);
|
||||||
|
RunNodeTest(&Node::StdPair, "std::pair", passed, total);
|
||||||
RunNodeTest(&Node::SimpleAlias, "simple alias", passed, total);
|
RunNodeTest(&Node::SimpleAlias, "simple alias", passed, total);
|
||||||
RunNodeTest(&Node::AliasAsKey, "alias as key", passed, total);
|
RunNodeTest(&Node::AliasAsKey, "alias as key", passed, total);
|
||||||
RunNodeTest(&Node::SelfReferenceSequence, "self reference sequence", passed, total);
|
RunNodeTest(&Node::SelfReferenceSequence, "self reference sequence", passed, total);
|
||||||
@@ -510,7 +566,9 @@ namespace Test
|
|||||||
RunNodeTest(&Node::CloneMap, "clone map", passed, total);
|
RunNodeTest(&Node::CloneMap, "clone map", passed, total);
|
||||||
RunNodeTest(&Node::CloneAlias, "clone alias", passed, total);
|
RunNodeTest(&Node::CloneAlias, "clone alias", passed, total);
|
||||||
RunNodeTest(&Node::ForceInsertIntoMap, "force insert into map", passed, total);
|
RunNodeTest(&Node::ForceInsertIntoMap, "force insert into map", passed, total);
|
||||||
RunNodeTest(&Node::ClearNode, "clear node", passed, total);
|
RunNodeTest(&Node::ResetNode, "reset node", passed, total);
|
||||||
|
RunNodeTest(&Node::DereferenceIteratorError, "dereference iterator error", passed, total);
|
||||||
|
RunNodeTest(&Node::FloatingPrecision, "floating precision", passed, total);
|
||||||
|
|
||||||
std::cout << "Node tests: " << passed << "/" << total << " passed\n";
|
std::cout << "Node tests: " << passed << "/" << total << " passed\n";
|
||||||
return passed == total;
|
return passed == total;
|
||||||
|
Reference in New Issue
Block a user