diff --git a/tests/TrueFalseTest.cpp b/tests/TrueFalseTest.cpp index a93336ed..7c37d456 100644 --- a/tests/TrueFalseTest.cpp +++ b/tests/TrueFalseTest.cpp @@ -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 {}; +struct TApp_TBO : public TApp_base, testing::TestWithParam {}; 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 {}; +struct TApp_FBO : public TApp_base, public ::testing::TestWithParam {}; 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")); diff --git a/tests/app_helper.hpp b/tests/app_helper.hpp index cbbd6117..6b250a42 100644 --- a/tests/app_helper.hpp +++ b/tests/app_helper.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 + #pragma once #ifdef CLI11_SINGLE_FILE @@ -8,13 +14,17 @@ #include "gtest/gtest.h" #include +#include +#include +#include using input_t = std::vector; -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{};