#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "opts.h"
Go to the source code of this file.
|
| TEST (CommandLineOptions, parsing) |
|
| TEST (CommandLineOptions, parsing_empty) |
|
| TEST (CommandLineOptions, parsing_float) |
|
| TEST (CommandLineOptions, parsing_int) |
|
◆ TEST() [1/4]
TEST |
( |
CommandLineOptions |
, |
|
|
parsing |
|
|
) |
| |
Definition at line 8 of file ut_opts.cc.
References vw_slim::find_opt().
10 EXPECT_THAT(
find_opt(
"-q abc",
"-q"), ElementsAre(
"abc"));
11 EXPECT_THAT(
find_opt(
"-q a -q b",
"-q"), ElementsAre(
"a",
"b"));
12 EXPECT_THAT(
find_opt(
"-q a -d -q b",
"-q"), ElementsAre(
"a",
"b"));
13 EXPECT_THAT(
find_opt(
"-q a -d -q b -q -q abc",
"-q"), ElementsAre(
"a",
"b",
"abc"));
void find_opt(std::string const &command_line_args, std::string arg_name, std::vector< std::string > &out_values)
◆ TEST() [2/4]
TEST |
( |
CommandLineOptions |
, |
|
|
parsing_empty |
|
|
) |
| |
Definition at line 16 of file ut_opts.cc.
References vw_slim::find_opt().
18 EXPECT_THAT(
find_opt(
"-a b -qd ",
"-q").size(), 0);
19 EXPECT_THAT(
find_opt(
"",
"-q").size(), 0);
20 EXPECT_THAT(
find_opt(
"-a",
"-q").size(), 0);
21 EXPECT_THAT(
find_opt(
"-q",
"-q").size(), 0);
22 EXPECT_THAT(
find_opt(
"-q ",
"-q").size(), 0);
23 EXPECT_THAT(
find_opt(
"-q -d",
"-q").size(), 0);
void find_opt(std::string const &command_line_args, std::string arg_name, std::vector< std::string > &out_values)
◆ TEST() [3/4]
TEST |
( |
CommandLineOptions |
, |
|
|
parsing_float |
|
|
) |
| |
Definition at line 26 of file ut_opts.cc.
References f, and vw_slim::find_opt_float().
30 ASSERT_FLOAT_EQ(0.5
f, value);
33 ASSERT_FLOAT_EQ(-2.
f, value);
36 EXPECT_FALSE(
find_opt_float(
"--epsilon 0.5 --epsilon 0.4",
"--epsilon", value));
bool find_opt_float(std::string const &command_line_args, std::string arg_name, float &value)
◆ TEST() [4/4]
TEST |
( |
CommandLineOptions |
, |
|
|
parsing_int |
|
|
) |
| |
Definition at line 39 of file ut_opts.cc.
References vw_slim::find_opt_int().
46 EXPECT_FALSE(
find_opt_int(
"--bag 2 --bag 3",
"--epsilon", value));
bool find_opt_int(std::string const &command_line_args, std::string arg_name, int &value)