File tree 3 files changed +25
-0
lines changed 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ class cmdlinet
35
35
virtual void set (const std::string &option, const std::string &value);
36
36
virtual void clear ();
37
37
38
+ bool has_option (const std::string &option) const
39
+ {
40
+ return getoptnr (option).has_value ();
41
+ }
42
+
38
43
typedef std::vector<std::string> argst;
39
44
argst args;
40
45
std::string unknown_arg;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ SRC += analyses/ai/ai.cpp \
29
29
solvers/refinement/string_refinement/sparse_array.cpp \
30
30
solvers/refinement/string_refinement/substitute_array_list.cpp \
31
31
solvers/refinement/string_refinement/union_find_replace.cpp \
32
+ util/cmdline.cpp \
32
33
util/expr_cast/expr_cast.cpp \
33
34
util/expr.cpp \
34
35
util/file_util.cpp \
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: cmdlinet unit tests
4
+
5
+ Author: Diffblue Ltd.
6
+
7
+ \*******************************************************************/
8
+
9
+ #include < testing-utils/catch.hpp>
10
+ #include < util/cmdline.h>
11
+
12
+ TEST_CASE (" cmdlinet::has_option" , " [core][util][cmdline]" )
13
+ {
14
+ cmdlinet cmdline;
15
+ REQUIRE (!cmdline.parse (0 , nullptr , " (a)(b):" ));
16
+ REQUIRE (cmdline.has_option (" a" ));
17
+ REQUIRE (cmdline.has_option (" b" ));
18
+ REQUIRE (!cmdline.has_option (" c" ));
19
+ }
You can’t perform that action at this time.
0 commit comments