summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/args.cc34
1 files changed, 21 insertions, 13 deletions
diff --git a/test/args.cc b/test/args.cc
index b60a4a4..a43c59c 100644
--- a/test/args.cc
+++ b/test/args.cc
@@ -2,25 +2,33 @@
#include "args.hh"
+#include <cstddef>
+#include <memory>
+#include <sstream>
+#include <string>
+#include <string_view>
+#include <utility>
+#include <vector>
+
#define SETUP_OPTIONS(args) \
- auto short_only = args->option('a', "", "an option"); \
- auto short_long = args->option('b', "bold", "set font style to bold"); \
- auto long_only = args->option("cold", "use if it is cold outside"); \
- auto short_only_req = args->option_argument('d', "", "", "distance"); \
- auto short_long_req = args->option_argument('e', "eat", "FOOD", \
- "what to order, what to eat?"); \
- auto long_only_req = args->option_argument( \
+ auto short_only = (args)->option('a', "", "an option"); \
+ auto short_long = (args)->option('b', "bold", "set font style to bold"); \
+ auto long_only = (args)->option("cold", "use if it is cold outside"); \
+ auto short_only_req = (args)->option_argument('d', "", "", "distance"); \
+ auto short_long_req = (args)->option_argument( \
+ 'e', "eat", "FOOD", "what to order, what to eat?"); \
+ auto long_only_req = (args)->option_argument( \
"form", "", "circle, shape or something else?"); \
- auto short_only_opt = args->option_argument('g', "", "", "", false); \
- auto short_long_opt = args->option_argument('h', "hold", "", "", false); \
- auto long_only_opt = args->option_argument("invert", "", "", false);
+ auto short_only_opt = (args)->option_argument('g', "", "", "", false); \
+ auto short_long_opt = (args)->option_argument('h', "hold", "", "", false); \
+ auto long_only_opt = (args)->option_argument("invert", "", "", false);
namespace {
class Arguments {
public:
- int c() const { return static_cast<int>(str_.size()); };
- char** v() const { return ptr_.get(); }
+ [[nodiscard]] int c() const { return static_cast<int>(str_.size()); };
+ [[nodiscard]] char** v() const { return ptr_.get(); }
explicit Arguments(std::vector<std::string> str)
: str_(std::move(str)) {
@@ -45,7 +53,7 @@ class Builder {
}
Builder& add(std::string str) {
- str_.push_back(std::move(str));
+ str_.emplace_back(std::move(str));
return *this;
}