#include "gmock/gmock.h" #include "gtest/gtest.h" #include #include #include #include using namespace std::string_literals; namespace pt = boost::property_tree; TEST(property_tree, put) { pt::ptree p; pt::ptree list; pt::ptree entry; entry.put_value("name1.txt"); entry.put(".type", "file1"); list.push_back(pt::ptree::value_type("listentry", entry)); entry.put_value("name2.txt"); entry.put(".type", "file2"); list.push_back(pt::ptree::value_type("listentry", entry)); p.push_back(pt::ptree::value_type("list", list)); std::stringstream ss; pt::xml_parser::write_xml(ss, p /*, pt::xml_parser::xml_writer_make_settings(' ', 1)*/); EXPECT_EQ(ss.str(), "\nname1.txtname2.txt"); } TEST(string, stoul) { unsigned long l = std::stoul("-1"); EXPECT_EQ(l, std::numeric_limits::max()); } int main(int argc, char* argv[]) { ::testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); }