23 #include <glog/logging.h> 31 const auto basename =
"program_options_test_helper";
33 path.remove_filename() /= basename;
34 if (!fs::exists(path)) {
35 path = path.parent_path().parent_path() / basename / basename;
42 std::initializer_list<std::string> args) {
45 std::vector<std::string> allArgs;
46 allArgs.reserve(args.size() + 1);
47 allArgs.push_back(helperPath);
48 allArgs.insert(allArgs.end(), args.begin(), args.end());
50 std::vector<std::string> env;
53 env.push_back(
"PROGRAM_OPTIONS_TEST_STYLE=GNU");
56 env.push_back(
"PROGRAM_OPTIONS_TEST_STYLE=GFLAGS");
60 Subprocess proc(allArgs, Subprocess::Options().pipeStdout(),
nullptr, &env);
61 auto p = proc.communicate();
71 TEST(ProgramOptionsTest, GFlagsStyleDefaultValues) {
80 TEST(ProgramOptionsTest, GFlagsStyleFlagsSet) {
98 TEST(ProgramOptionsTest, GFlagsStyleBoolFlagsNegation) {
101 "flag_bool_false 0\n" 107 "--noflag_bool_true",
108 "--noflag_bool_false",
112 TEST(ProgramOptionsTest, GNUStyleDefaultValues) {
115 "flag-bool-false 0\n" 121 TEST(ProgramOptionsTest, GNUStyleFlagsSet) {
124 "flag-bool-false 1\n" 139 TEST(ProgramOptionsTest, GNUStyleBoolFlagsNegation) {
142 "flag-bool-false 0\n" 148 "--no-flag-bool-true",
149 "--no-flag-bool-false",
153 TEST(ProgramOptionsTest, GNUStyleSubCommand) {
156 "flag-bool-false 1\n" 178 TEST(ProgramOptionsTest, GNUStyleSubCommandUnrecognizedOptionFirst) {
181 "flag-bool-false 1\n"
#define EXPECT_EQ(val1, val2)
—— Concurrent Priority Queue Implementation ——
TEST(ProgramOptionsTest, Errors)