mirror of
https://github.com/boostorg/parser.git
synced 2026-01-23 05:42:26 +00:00
Add yaml::value test.
This commit is contained in:
@@ -159,6 +159,15 @@ namespace boost { namespace yaml {
|
||||
template<typename T>
|
||||
bool is() const noexcept
|
||||
{
|
||||
switch (storage_.local_.kind_) {
|
||||
case value::null_k: return std::is_same<T, null_t>::value;
|
||||
case value::boolean_k: return std::is_same<T, bool>::value;
|
||||
case value::int_k: return std::is_same<T, int>::value;
|
||||
case value::double_k: return std::is_same<T, double>::value;
|
||||
case value::local_string_k:
|
||||
return std::is_same<T, std::string>::value;
|
||||
default: break;
|
||||
}
|
||||
return storage_.remote_.ptr_->type_id() == typeindex::type_id<T>();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,15 @@ namespace boost { namespace yaml {
|
||||
|
||||
explicit operator bool() const { return tag_ != "" || anchor_ != ""; }
|
||||
|
||||
bool operator==(properties const & rhs) const noexcept
|
||||
{
|
||||
return tag_ == rhs.tag_ && anchor_ == rhs.anchor_;
|
||||
}
|
||||
bool operator!=(properties const & rhs) const noexcept
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
std::string tag_;
|
||||
std::string anchor_;
|
||||
};
|
||||
|
||||
@@ -48,10 +48,11 @@ add_test_executable(parser_action_with_params)
|
||||
add_test_executable(parser_symbol_table)
|
||||
|
||||
##################################################
|
||||
# Parser tests
|
||||
# YAML/JSON datA type tests
|
||||
##################################################
|
||||
|
||||
add_test_executable(json_value)
|
||||
add_test_executable(yaml_value)
|
||||
|
||||
##################################################
|
||||
# Header-only build test
|
||||
|
||||
1415
test/yaml_value.cpp
Normal file
1415
test/yaml_value.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user