mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-01-15 22:58:02 +00:00
Compare commits
10 Commits
27da2f952e
...
7432ab264d
Author | SHA1 | Date | |
---|---|---|---|
|
7432ab264d | ||
|
a1ef417b8d | ||
|
e85eaecf85 | ||
|
286cd0f0e2 | ||
|
534792577d | ||
|
35816a4eee | ||
|
0c8a391072 | ||
|
863541ff1c | ||
|
3ab92ad454 | ||
|
5b28c1407e |
@ -2,6 +2,7 @@ set noparent
|
||||
linelength=120 # As in .clang-format
|
||||
|
||||
# Unused filters
|
||||
filter=-build/c++11 # Reports e.g. chrono and thread, which overlap with Chromium's API. Not applicable to general C++ projects.
|
||||
filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers
|
||||
filter=-readability/nolint # Conflicts with clang-tidy
|
||||
filter=-runtime/references # Requires fundamental change of API, don't see need for this
|
||||
|
@ -36,7 +36,7 @@ jobs:
|
||||
vmImage: 'ubuntu-latest'
|
||||
container: sharaku/cpplint:latest
|
||||
steps:
|
||||
- bash: cpplint --counting=detailed --recursive examples include/CLI
|
||||
- bash: cpplint --counting=detailed --recursive examples include/CLI tests
|
||||
displayName: Checking against google style guide
|
||||
|
||||
# TODO: Fix macOS error and windows warning in c++17 mode
|
||||
|
@ -13,7 +13,7 @@
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <chrono> // NOLINT(build/c++11)
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include <complex>
|
||||
#include <cstdint>
|
||||
@ -605,7 +611,7 @@ TEST_F(TApp, BoolOnlyFlag) {
|
||||
|
||||
TEST_F(TApp, ShortOpts) {
|
||||
|
||||
unsigned long long funnyint{0};
|
||||
std::uint64_t funnyint{0};
|
||||
std::string someopt;
|
||||
app.add_flag("-z", funnyint);
|
||||
app.add_option("-y", someopt);
|
||||
@ -618,7 +624,7 @@ TEST_F(TApp, ShortOpts) {
|
||||
|
||||
EXPECT_EQ(2u, app.count("-z"));
|
||||
EXPECT_EQ(1u, app.count("-y"));
|
||||
EXPECT_EQ((unsigned long long)2, funnyint);
|
||||
EXPECT_EQ(std::uint64_t{2}, funnyint);
|
||||
EXPECT_EQ("zyz", someopt);
|
||||
EXPECT_EQ(app.count_all(), 3u);
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
@ -11,13 +17,14 @@
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
using namespace boost::container;
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
template <class T> class TApp_container_single_boost : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_single_boost() : TApp(){};
|
||||
TApp_container_single_boost() : TApp() {}
|
||||
};
|
||||
|
||||
using containerTypes_single_boost =
|
||||
@ -47,7 +54,7 @@ template <class T> class TApp_container_pair_boost : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_pair_boost() : TApp(){};
|
||||
TApp_container_pair_boost() : TApp() {}
|
||||
};
|
||||
|
||||
using isp = std::pair<int, std::string>;
|
||||
@ -75,7 +82,7 @@ template <class T> class TApp_container_tuple_boost : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_tuple_boost() : TApp(){};
|
||||
TApp_container_tuple_boost() : TApp() {}
|
||||
};
|
||||
|
||||
using tup_obj = std::tuple<int, std::string, double>;
|
||||
@ -119,7 +126,7 @@ template <class T> class TApp_container_container_boost : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_container_boost() : TApp(){};
|
||||
TApp_container_container_boost() : TApp() {}
|
||||
};
|
||||
|
||||
TYPED_TEST_SUITE(TApp_container_container_boost, containerTypes_container_boost, );
|
||||
@ -139,3 +146,6 @@ TYPED_TEST(TApp_container_container_boost, containerContainer_boost) {
|
||||
TApp::run();
|
||||
EXPECT_EQ(cv.size(), 4u);
|
||||
}
|
||||
|
||||
} // namespace container
|
||||
} // namespace boost
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include "gmock/gmock.h"
|
||||
#include <complex>
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
@ -1838,7 +1844,7 @@ TEST_F(TApp, ConfigWriteReadWrite) {
|
||||
EXPECT_EQ(config1, config2);
|
||||
}
|
||||
|
||||
///////INI output tests
|
||||
/////// INI output tests
|
||||
|
||||
TEST_F(TApp, IniOutputSimple) {
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include <cstdlib>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#ifdef CLI11_SINGLE_FILE
|
||||
#include "CLI11.hpp"
|
||||
#else
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#ifdef CLI11_SINGLE_FILE
|
||||
#include "CLI11.hpp"
|
||||
#else
|
||||
@ -455,7 +461,7 @@ TEST(THelp, Subcom) {
|
||||
char y[] = "sub2";
|
||||
|
||||
std::vector<char *> args = {x, y};
|
||||
app.parse((int)args.size(), args.data());
|
||||
app.parse(static_cast<int>(args.size()), args.data());
|
||||
|
||||
help = app.help();
|
||||
EXPECT_THAT(help, HasSubstr("Usage: ./myprogram sub2"));
|
||||
@ -467,7 +473,7 @@ TEST(THelp, MasterName) {
|
||||
char x[] = "./myprogram";
|
||||
|
||||
std::vector<char *> args = {x};
|
||||
app.parse((int)args.size(), args.data());
|
||||
app.parse(static_cast<int>(args.size()), args.data());
|
||||
|
||||
EXPECT_THAT(app.help(), HasSubstr("Usage: MyRealName"));
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include <array>
|
||||
@ -896,7 +902,7 @@ TEST(Types, TypeName) {
|
||||
std::string int_name = CLI::detail::type_name<int>();
|
||||
EXPECT_EQ("INT", int_name);
|
||||
|
||||
std::string int2_name = CLI::detail::type_name<short>();
|
||||
std::string int2_name = CLI::detail::type_name<std::int16_t>();
|
||||
EXPECT_EQ("INT", int2_name);
|
||||
|
||||
std::string uint_name = CLI::detail::type_name<unsigned char>();
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include "gmock/gmock.h"
|
||||
#include <complex>
|
||||
@ -526,7 +532,7 @@ template <class T> class SimpleWrapper {
|
||||
public:
|
||||
SimpleWrapper() : val_{} {};
|
||||
explicit SimpleWrapper(const T &initial) : val_{initial} {};
|
||||
T &getRef() { return val_; };
|
||||
T &getRef() { return val_; }
|
||||
using value_type = T;
|
||||
|
||||
private:
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include <complex>
|
||||
#include <cstdint>
|
||||
@ -644,7 +650,7 @@ template <class T> class TApp_container_single : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_single() : TApp(){};
|
||||
TApp_container_single() : TApp() {}
|
||||
};
|
||||
|
||||
using containerTypes_single =
|
||||
@ -674,7 +680,7 @@ template <class T> class TApp_container_pair : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_pair() : TApp(){};
|
||||
TApp_container_pair() : TApp() {}
|
||||
};
|
||||
|
||||
using isp = std::pair<int, std::string>;
|
||||
@ -706,7 +712,7 @@ template <class T> class TApp_container_tuple : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_tuple() : TApp(){};
|
||||
TApp_container_tuple() : TApp() {}
|
||||
};
|
||||
|
||||
using tup_obj = std::tuple<int, std::string, double>;
|
||||
@ -756,7 +762,7 @@ template <class T> class TApp_container_container : public TApp {
|
||||
public:
|
||||
using container_type = T;
|
||||
container_type cval{};
|
||||
TApp_container_container() : TApp(){};
|
||||
TApp_container_container() : TApp() {}
|
||||
};
|
||||
|
||||
TYPED_TEST_SUITE(TApp_container_container, containerTypes_container, );
|
||||
@ -798,7 +804,7 @@ TEST_F(TApp, unknownContainerWrapper) {
|
||||
class vopt {
|
||||
public:
|
||||
vopt() = default;
|
||||
vopt(const std::vector<double> &vdub) : val_{vdub} {};
|
||||
explicit vopt(const std::vector<double> &vdub) : val_{vdub} {};
|
||||
std::vector<double> val_{};
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include <complex>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include <map>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#ifdef CLI11_SINGLE_FILE
|
||||
#include "CLI11.hpp"
|
||||
#else
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "CLI/Timer.hpp"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
#include <array>
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
|
||||
/// This allows a set of strings to be run over by a test
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "app_helper.hpp"
|
||||
#include <Windows.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef CLI11_SINGLE_FILE
|
||||
@ -8,6 +14,9 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using input_t = std::vector<std::string>;
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#ifdef CLI11_SINGLE_FILE
|
||||
#include "CLI11.hpp"
|
||||
#else
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "CLI/CLI.hpp"
|
||||
#include "CLI/Timer.hpp"
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include "CLI/CLI.hpp"
|
||||
#include "CLI/Timer.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
// Copyright (c) 2017-2020, University of Cincinnati, developed by Henry Schreiner
|
||||
// under NSF AWARD 1414736 and by the respective contributors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#include <CLI/CLI.hpp>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
Loading…
Reference in New Issue
Block a user