mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 05:03:52 +00:00
Updates for TrueFalse test
This commit is contained in:
parent
5188ede219
commit
de117cf1e5
@ -1,7 +1,13 @@
|
||||
// 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
|
||||
struct TApp_TBO : public TApp, public ::testing::WithParamInterface<const char *> {};
|
||||
struct TApp_TBO : public TApp_base, testing::TestWithParam<const char *> {};
|
||||
|
||||
TEST_P(TApp_TBO, TrueBoolOption) {
|
||||
bool value{false}; // Not used, but set just in case
|
||||
@ -13,10 +19,10 @@ TEST_P(TApp_TBO, TrueBoolOption) {
|
||||
}
|
||||
|
||||
// Change to INSTANTIATE_TEST_SUITE_P in GTest master
|
||||
INSTANTIATE_TEST_CASE_P(TrueBoolOptions, TApp_TBO, ::testing::Values("true", "on", "True", "ON"), );
|
||||
INSTANTIATE_TEST_SUITE_P(TrueBoolOptions_test, TApp_TBO, testing::Values("true", "on", "True", "ON"));
|
||||
|
||||
/// This allows a set of strings to be run over by a test
|
||||
struct TApp_FBO : public TApp, public ::testing::WithParamInterface<const char *> {};
|
||||
struct TApp_FBO : public TApp_base, public ::testing::TestWithParam<const char *> {};
|
||||
|
||||
TEST_P(TApp_FBO, FalseBoolOptions) {
|
||||
bool value{true}; // Not used, but set just in case
|
||||
@ -27,4 +33,4 @@ TEST_P(TApp_FBO, FalseBoolOptions) {
|
||||
EXPECT_FALSE(value);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FalseBoolOptions, TApp_FBO, ::testing::Values("false", "off", "False", "OFF"), );
|
||||
INSTANTIATE_TEST_SUITE_P(FalseBoolOptions_test, TApp_FBO, ::testing::Values("false", "off", "False", "OFF"));
|
||||
|
@ -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,13 +14,17 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using input_t = std::vector<std::string>;
|
||||
|
||||
struct TApp : public ::testing::Test {
|
||||
class TApp_base {
|
||||
public:
|
||||
CLI::App app{"My Test Program"};
|
||||
input_t args{};
|
||||
|
||||
virtual ~TApp_base() = default;
|
||||
void run() {
|
||||
// It is okay to re-parse - clear is called automatically before a parse.
|
||||
input_t newargs = args;
|
||||
@ -23,6 +33,8 @@ struct TApp : public ::testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
class TApp : public TApp_base, public ::testing::Test {};
|
||||
|
||||
class TempFile {
|
||||
std::string _name{};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user