mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 20:23:55 +00:00
* docs: fix some Codacity recommendations * chore: update copyright year * style: more codacity fixes * style: fix issues reported by Codacity
30 lines
963 B
C++
30 lines
963 B
C++
// Copyright (c) 2017-2021, 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"
|
|
|
|
TEST_CASE_METHOD(TApp, "True Bool Option", "[bool][flag]") {
|
|
// Strings needed here due to MSVC 2015.
|
|
auto param = GENERATE(as<std::string>{}, "true", "on", "True", "ON");
|
|
bool value{false}; // Not used, but set just in case
|
|
app.add_option("-b,--bool", value);
|
|
args = {"--bool", param};
|
|
run();
|
|
CHECK(app.count("--bool") == 1u);
|
|
CHECK(value);
|
|
}
|
|
|
|
TEST_CASE_METHOD(TApp, "False Bool Option", "[bool][flag]") {
|
|
auto param = GENERATE(as<std::string>{}, "false", "off", "False", "OFF");
|
|
|
|
bool value{true}; // Not used, but set just in case
|
|
app.add_option("-b,--bool", value);
|
|
args = {"--bool", param};
|
|
run();
|
|
CHECK(app.count("--bool") == 1u);
|
|
CHECK_FALSE(value);
|
|
}
|