Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::ParseFlagsTest Class Reference
Inheritance diagram for testing::ParseFlagsTest:
Collaboration diagram for testing::ParseFlagsTest:

Protected Member Functions

virtual void SetUp ()
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void TearDown ()
 

Static Protected Member Functions

template<typename CharType >
static void AssertStringArrayEq (size_t size1, CharType **array1, size_t size2, CharType **array2)
 
static void CheckFlags (const Flags &expected)
 
template<typename CharType >
static void TestParsingFlags (int argc1, const CharType **argv1, int argc2, const CharType **argv2, const Flags &expected, bool should_print_help)
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 5639 of file gtest_unittest.cc.

Member Function Documentation

◆ AssertStringArrayEq()

template<typename CharType >
static void testing::ParseFlagsTest::AssertStringArrayEq ( size_t size1,
CharType ** array1,
size_t size2,
CharType ** array2 )
inlinestaticprotected

Definition at line 5661 of file gtest_unittest.cc.

5662 {
5663 ASSERT_EQ(size1, size2) << " Array sizes different.";
5664
5665 for (size_t i = 0; i != size1; i++) {
5666 ASSERT_STREQ(array1[i], array2[i]) << " where i == " << i;
5667 }
5668 }
#define ASSERT_EQ(val1, val2)
Definition gtest.h:1988
#define ASSERT_STREQ(s1, s2)
Definition gtest.h:2036
Here is the caller graph for this function:

◆ CheckFlags()

static void testing::ParseFlagsTest::CheckFlags ( const Flags & expected)
inlinestaticprotected

Definition at line 5671 of file gtest_unittest.cc.

5671 {
5672 EXPECT_EQ(expected.also_run_disabled_tests,
5673 GTEST_FLAG(also_run_disabled_tests));
5674 EXPECT_EQ(expected.break_on_failure, GTEST_FLAG(break_on_failure));
5675 EXPECT_EQ(expected.catch_exceptions, GTEST_FLAG(catch_exceptions));
5676 EXPECT_EQ(expected.death_test_use_fork, GTEST_FLAG(death_test_use_fork));
5677 EXPECT_STREQ(expected.filter, GTEST_FLAG(filter).c_str());
5678 EXPECT_EQ(expected.list_tests, GTEST_FLAG(list_tests));
5679 EXPECT_STREQ(expected.output, GTEST_FLAG(output).c_str());
5680 EXPECT_EQ(expected.print_time, GTEST_FLAG(print_time));
5681 EXPECT_EQ(expected.random_seed, GTEST_FLAG(random_seed));
5682 EXPECT_EQ(expected.repeat, GTEST_FLAG(repeat));
5683 EXPECT_EQ(expected.shuffle, GTEST_FLAG(shuffle));
5684 EXPECT_EQ(expected.stack_trace_depth, GTEST_FLAG(stack_trace_depth));
5685 EXPECT_STREQ(expected.stream_result_to,
5686 GTEST_FLAG(stream_result_to).c_str());
5687 EXPECT_EQ(expected.throw_on_failure, GTEST_FLAG(throw_on_failure));
5688 }
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954
#define EXPECT_STREQ(s1, s2)
Definition gtest.h:2027
Here is the caller graph for this function:

◆ SetUp()

virtual void testing::ParseFlagsTest::SetUp ( )
inlineprotectedvirtual

Reimplemented from testing::Test.

Definition at line 5642 of file gtest_unittest.cc.

5642 {
5643 GTEST_FLAG(also_run_disabled_tests) = false;
5644 GTEST_FLAG(break_on_failure) = false;
5645 GTEST_FLAG(catch_exceptions) = false;
5646 GTEST_FLAG(death_test_use_fork) = false;
5647 GTEST_FLAG(filter) = "";
5648 GTEST_FLAG(list_tests) = false;
5649 GTEST_FLAG(output) = "";
5650 GTEST_FLAG(print_time) = true;
5651 GTEST_FLAG(random_seed) = 0;
5652 GTEST_FLAG(repeat) = 1;
5653 GTEST_FLAG(shuffle) = false;
5654 GTEST_FLAG(stack_trace_depth) = kMaxStackTraceDepth;
5655 GTEST_FLAG(stream_result_to) = "";
5656 GTEST_FLAG(throw_on_failure) = false;
5657 }
#define GTEST_FLAG(name)
const int kMaxStackTraceDepth
Definition gtest.h:159

◆ TestParsingFlags()

template<typename CharType >
static void testing::ParseFlagsTest::TestParsingFlags ( int argc1,
const CharType ** argv1,
int argc2,
const CharType ** argv2,
const Flags & expected,
bool should_print_help )
inlinestaticprotected

Definition at line 5694 of file gtest_unittest.cc.

5696 {
5697 const bool saved_help_flag = ::testing::internal::g_help_flag;
5699
5700# if GTEST_HAS_STREAM_REDIRECTION
5701 CaptureStdout();
5702# endif
5703
5704 // Parses the command line.
5705 internal::ParseGoogleTestFlagsOnly(&argc1, const_cast<CharType**>(argv1));
5706
5707# if GTEST_HAS_STREAM_REDIRECTION
5708 const std::string captured_stdout = GetCapturedStdout();
5709# endif
5710
5711 // Verifies the flag values.
5712 CheckFlags(expected);
5713
5714 // Verifies that the recognized flags are removed from the command
5715 // line.
5716 AssertStringArrayEq(argc1 + 1, argv1, argc2 + 1, argv2);
5717
5718 // ParseGoogleTestFlagsOnly should neither set g_help_flag nor print the
5719 // help message for the flags it recognizes.
5720 EXPECT_EQ(should_print_help, ::testing::internal::g_help_flag);
5721
5722# if GTEST_HAS_STREAM_REDIRECTION
5723 const char* const expected_help_fragment =
5724 "This program contains tests written using";
5725 if (should_print_help) {
5726 EXPECT_PRED_FORMAT2(IsSubstring, expected_help_fragment, captured_stdout);
5727 } else {
5728 EXPECT_PRED_FORMAT2(IsNotSubstring,
5729 expected_help_fragment, captured_stdout);
5730 }
5731# endif // GTEST_HAS_STREAM_REDIRECTION
5732
5733 ::testing::internal::g_help_flag = saved_help_flag;
5734 }
static void CheckFlags(const Flags &expected)
static void AssertStringArrayEq(size_t size1, CharType **array1, size_t size2, CharType **array2)
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2)
GTEST_API_ void ParseGoogleTestFlagsOnly(int *argc, char **argv)
Definition gtest.cc:5749
GTEST_API_ bool g_help_flag
Definition gtest.cc:183
GTEST_API_ void CaptureStdout()
GTEST_API_ std::string GetCapturedStdout()
Here is the call graph for this function:

The documentation for this class was generated from the following file: