#ifdef CLI_SINGLE_FILE #include "CLI11.hpp" #else #include "CLI/CLI.hpp" #endif #include "gtest/gtest.h" #include #include TEST(StringBased, First) { std::stringstream ofile; ofile << "one=three" << std::endl; ofile << "two=four" << std::endl; ofile.seekg(0, std::ios::beg); std::vector output = CLI::detail::parse_ini(ofile); std::vector answer = {"--one=three", "--two=four"}; EXPECT_EQ(answer, output); } TEST(StringBased, Sections) { std::stringstream ofile; ofile << "one=three" << std::endl; ofile << "[second]" << std::endl; ofile << " two=four" << std::endl; ofile.seekg(0, std::ios::beg); std::vector output = CLI::detail::parse_ini(ofile); std::vector answer = {"--one=three", "--second.two=four"}; EXPECT_EQ(answer, output); } TEST(StringBased, SpacesSections) { std::stringstream ofile; ofile << "one=three" << std::endl; ofile << std::endl; ofile << "[second]" << std::endl; ofile << " " << std::endl; ofile << " two=four" << std::endl; ofile.seekg(0, std::ios::beg); std::vector output = CLI::detail::parse_ini(ofile); std::vector answer = {"--one=three", "--second.two=four"}; EXPECT_EQ(answer, output); }