From a784e31d0c3d836487eb7ff9e99f87a71b62681a Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 19 Apr 2017 13:38:01 +0900 Subject: [PATCH] update test --- test.cpp | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/test.cpp b/test.cpp index d017195..317c110 100644 --- a/test.cpp +++ b/test.cpp @@ -14,7 +14,12 @@ int main() std::cout << "v2: " << v2.type() << " = " << v2.cast() << std::endl; std::cout << "v3: " << v3.type() << " = " << v3.cast() << std::endl; std::cout << "v4: " << v4.type() << " = " << v4.cast() << std::endl; - v1.reset(f); + v1.cast() += 1; + std::cout << "v1: " << v1.type() << " = " << v1.cast() << std::endl; + v4.cast() += " piyo"; + std::cout << "v4: " << v4.type() << " = " << v4.cast() << std::endl; + + v1 = f; std::cout << "v1: " << v1.type() << " = " << v1.cast() << std::endl; toml::Table tab; @@ -31,9 +36,38 @@ int main() arr.emplace_back(5); toml::value v5(tab); - std::cout << "v5: " << v5.type() << std::endl; + std::cout << "v5: " << v5.type() << " = {" << std::endl; + const auto& v5t = v5.cast(); + std::cout << "v5t[v1] = " << v5t.at("v1").cast() << std::endl; + std::cout << "v5t[v2] = " << v5t.at("v2").cast() << std::endl; + std::cout << "v5t[v3] = " << v5t.at("v3").cast() << std::endl; + std::cout << "v5t[v4] = " << v5t.at("v4").cast() << std::endl; + std::cout << "}" << std::endl; + toml::value v6(arr); - std::cout << "v6: " << v6.type() << std::endl; + std::cout << "v6: " << v6.type() << " = "; + for(auto&& item : v6.cast()) + { + std::cout << item.cast() << ", "; + } + std::cout << std::endl; + + std::string piyo("piyo"); + std::swap(v4.cast(), piyo); + std::cout << "v4: " << v4.type() << " = " << v4.cast() << std::endl; + + toml::value v7(v4); + std::cout << "v7: " << v7.type() << " = " << v7.cast() << std::endl; + + toml::value v8(std::move(v4)); + std::cout << "v8: " << v8.type() << " = " << v8.cast() << std::endl; + + std::cout << toml::is_castable::value << std::endl; + std::cout << toml::is_castable, toml::value_t::Array>::value << std::endl; + std::cout << toml::is_castable::value << std::endl; + std::cout << toml::is_castable, toml::value_t::Table>::value << std::endl; + std::cout << toml::is_castable::value << std::endl; + std::cout << toml::is_castable, toml::value_t::Table>::value << std::endl; return 0; }