tesseract v5.3.3.20231005
gtest_xml_output_unittest_.cc File Reference
#include "gtest/gtest.h"

Go to the source code of this file.

Classes

class  SuccessfulTest
 
class  FailedTest
 
class  DisabledTest
 
class  SkippedTest
 
class  PropertyRecordingTest
 
class  ValueParamTest
 
class  TypedTest< T >
 
class  TypeParameterizedTestSuite< T >
 

Typedefs

typedef testing::Types< int, long > TypedTestTypes
 
typedef testing::Types< int, long > TypeParameterizedTestSuiteTypes
 

Functions

 TEST_F (SuccessfulTest, Succeeds)
 
 TEST_F (FailedTest, Fails)
 
 TEST_F (DisabledTest, DISABLED_test_not_run)
 
 TEST_F (SkippedTest, Skipped)
 
 TEST_F (SkippedTest, SkippedWithMessage)
 
 TEST_F (SkippedTest, SkippedAfterFailure)
 
 TEST (MixedResultTest, Succeeds)
 
 TEST (MixedResultTest, Fails)
 
 TEST (MixedResultTest, DISABLED_test)
 
 TEST (XmlQuotingTest, OutputsCData)
 
 TEST (InvalidCharactersTest, InvalidCharactersInMessage)
 
 TEST_F (PropertyRecordingTest, OneProperty)
 
 TEST_F (PropertyRecordingTest, IntValuedProperty)
 
 TEST_F (PropertyRecordingTest, ThreeProperties)
 
 TEST_F (PropertyRecordingTest, TwoValuesForOneKeyUsesLastValue)
 
 TEST (NoFixtureTest, RecordProperty)
 
void ExternalUtilityThatCallsRecordProperty (const std::string &key, int value)
 
void ExternalUtilityThatCallsRecordProperty (const std::string &key, const std::string &value)
 
 TEST (NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty)
 
 TEST (NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty)
 
 TEST_P (ValueParamTest, HasValueParamAttribute)
 
 TEST_P (ValueParamTest, AnotherTestThatHasValueParamAttribute)
 
 INSTANTIATE_TEST_SUITE_P (Single, ValueParamTest, Values(33, 42))
 
 TYPED_TEST_SUITE (TypedTest, TypedTestTypes)
 
 TYPED_TEST (TypedTest, HasTypeParamAttribute)
 
 TYPED_TEST_SUITE_P (TypeParameterizedTestSuite)
 
 TYPED_TEST_P (TypeParameterizedTestSuite, HasTypeParamAttribute)
 
 REGISTER_TYPED_TEST_SUITE_P (TypeParameterizedTestSuite, HasTypeParamAttribute)
 
 INSTANTIATE_TYPED_TEST_SUITE_P (Single, TypeParameterizedTestSuite, TypeParameterizedTestSuiteTypes)
 
int main (int argc, char **argv)
 

Typedef Documentation

◆ TypedTestTypes

typedef testing::Types<int, long> TypedTestTypes

Definition at line 169 of file gtest_xml_output_unittest_.cc.

◆ TypeParameterizedTestSuiteTypes

Definition at line 180 of file gtest_xml_output_unittest_.cc.

Function Documentation

◆ ExternalUtilityThatCallsRecordProperty() [1/2]

void ExternalUtilityThatCallsRecordProperty ( const std::string &  key,
const std::string &  value 
)

Definition at line 146 of file gtest_xml_output_unittest_.cc.

147 {
149}
int value
static void RecordProperty(const std::string &key, const std::string &value)
Definition: gtest.cc:2442

◆ ExternalUtilityThatCallsRecordProperty() [2/2]

void ExternalUtilityThatCallsRecordProperty ( const std::string &  key,
int  value 
)

Definition at line 142 of file gtest_xml_output_unittest_.cc.

142 {
144}

◆ INSTANTIATE_TEST_SUITE_P()

INSTANTIATE_TEST_SUITE_P ( Single  ,
ValueParamTest  ,
Values(33, 42)   
)

◆ INSTANTIATE_TYPED_TEST_SUITE_P()

INSTANTIATE_TYPED_TEST_SUITE_P ( Single  ,
TypeParameterizedTestSuite  ,
TypeParameterizedTestSuiteTypes   
)

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 184 of file gtest_xml_output_unittest_.cc.

184 {
185 InitGoogleTest(&argc, argv);
186
187 if (argc > 1 && strcmp(argv[1], "--shut_down_xml") == 0) {
188 TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
189 delete listeners.Release(listeners.default_xml_generator());
190 }
191 testing::Test::RecordProperty("ad_hoc_property", "42");
192 return RUN_ALL_TESTS();
193}
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:2489
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: gtest.cc:6660

◆ REGISTER_TYPED_TEST_SUITE_P()

REGISTER_TYPED_TEST_SUITE_P ( TypeParameterizedTestSuite  ,
HasTypeParamAttribute   
)

◆ TEST() [1/8]

TEST ( InvalidCharactersTest  ,
InvalidCharactersInMessage   
)

Definition at line 107 of file gtest_xml_output_unittest_.cc.

107 {
108 FAIL() << "Invalid characters in brackets [\x1\x2]";
109}
#define FAIL()
Definition: gtest.h:1928

◆ TEST() [2/8]

TEST ( MixedResultTest  ,
DISABLED_test   
)

Definition at line 96 of file gtest_xml_output_unittest_.cc.

96 {
97 FAIL() << "Unexpected failure: Disabled test should not be run";
98}

◆ TEST() [3/8]

TEST ( MixedResultTest  ,
Fails   
)

Definition at line 91 of file gtest_xml_output_unittest_.cc.

91 {
92 EXPECT_EQ(1, 2);
93 ASSERT_EQ(2, 3);
94}
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:2073
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:2043

◆ TEST() [4/8]

TEST ( MixedResultTest  ,
Succeeds   
)

Definition at line 86 of file gtest_xml_output_unittest_.cc.

86 {
87 EXPECT_EQ(1, 1);
88 ASSERT_EQ(1, 1);
89}

◆ TEST() [5/8]

TEST ( NoFixtureTest  ,
ExternalUtilityThatCallsRecordIntValuedProperty   
)

Definition at line 151 of file gtest_xml_output_unittest_.cc.

151 {
152 ExternalUtilityThatCallsRecordProperty("key_for_utility_int", 1);
153}
void ExternalUtilityThatCallsRecordProperty(const std::string &key, int value)

◆ TEST() [6/8]

TEST ( NoFixtureTest  ,
ExternalUtilityThatCallsRecordStringValuedProperty   
)

Definition at line 155 of file gtest_xml_output_unittest_.cc.

155 {
156 ExternalUtilityThatCallsRecordProperty("key_for_utility_string", "1");
157}

◆ TEST() [7/8]

TEST ( NoFixtureTest  ,
RecordProperty   
)

Definition at line 138 of file gtest_xml_output_unittest_.cc.

138 {
139 RecordProperty("key", "1");
140}

◆ TEST() [8/8]

TEST ( XmlQuotingTest  ,
OutputsCData   
)

Definition at line 100 of file gtest_xml_output_unittest_.cc.

100 {
101 FAIL() << "XML output: "
102 "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>";
103}

◆ TEST_F() [1/10]

TEST_F ( DisabledTest  ,
DISABLED_test_not_run   
)

Definition at line 66 of file gtest_xml_output_unittest_.cc.

66 {
67 FAIL() << "Unexpected failure: Disabled test should not be run";
68}

◆ TEST_F() [2/10]

TEST_F ( FailedTest  ,
Fails   
)

Definition at line 59 of file gtest_xml_output_unittest_.cc.

59 {
60 ASSERT_EQ(1, 2);
61}

◆ TEST_F() [3/10]

TEST_F ( PropertyRecordingTest  ,
IntValuedProperty   
)

Definition at line 123 of file gtest_xml_output_unittest_.cc.

123 {
124 RecordProperty("key_int", 1);
125}

◆ TEST_F() [4/10]

TEST_F ( PropertyRecordingTest  ,
OneProperty   
)

Definition at line 119 of file gtest_xml_output_unittest_.cc.

119 {
120 RecordProperty("key_1", "1");
121}

◆ TEST_F() [5/10]

TEST_F ( PropertyRecordingTest  ,
ThreeProperties   
)

Definition at line 127 of file gtest_xml_output_unittest_.cc.

127 {
128 RecordProperty("key_1", "1");
129 RecordProperty("key_2", "2");
130 RecordProperty("key_3", "3");
131}

◆ TEST_F() [6/10]

TEST_F ( PropertyRecordingTest  ,
TwoValuesForOneKeyUsesLastValue   
)

Definition at line 133 of file gtest_xml_output_unittest_.cc.

133 {
134 RecordProperty("key_1", "1");
135 RecordProperty("key_1", "2");
136}

◆ TEST_F() [7/10]

TEST_F ( SkippedTest  ,
Skipped   
)

Definition at line 73 of file gtest_xml_output_unittest_.cc.

73 {
74 GTEST_SKIP();
75}
#define GTEST_SKIP()
Definition: gtest.h:1889

◆ TEST_F() [8/10]

TEST_F ( SkippedTest  ,
SkippedAfterFailure   
)

Definition at line 81 of file gtest_xml_output_unittest_.cc.

81 {
82 EXPECT_EQ(1, 2);
83 GTEST_SKIP() << "It is good practice to tell why you skip a test.";
84}

◆ TEST_F() [9/10]

TEST_F ( SkippedTest  ,
SkippedWithMessage   
)

Definition at line 77 of file gtest_xml_output_unittest_.cc.

77 {
78 GTEST_SKIP() << "It is good practice to tell why you skip a test.";
79}

◆ TEST_F() [10/10]

TEST_F ( SuccessfulTest  ,
Succeeds   
)

Definition at line 51 of file gtest_xml_output_unittest_.cc.

51 {
52 SUCCEED() << "This is a success.";
53 ASSERT_EQ(1, 1);
54}
#define SUCCEED()
Definition: gtest.h:1937

◆ TEST_P() [1/2]

TEST_P ( ValueParamTest  ,
AnotherTestThatHasValueParamAttribute   
)

Definition at line 163 of file gtest_xml_output_unittest_.cc.

163{}

◆ TEST_P() [2/2]

TEST_P ( ValueParamTest  ,
HasValueParamAttribute   
)

Definition at line 162 of file gtest_xml_output_unittest_.cc.

162{}

◆ TYPED_TEST()

TYPED_TEST ( TypedTest  ,
HasTypeParamAttribute   
)

Definition at line 171 of file gtest_xml_output_unittest_.cc.

171{}

◆ TYPED_TEST_P()

TYPED_TEST_P ( TypeParameterizedTestSuite  ,
HasTypeParamAttribute   
)

Definition at line 178 of file gtest_xml_output_unittest_.cc.

178{}

◆ TYPED_TEST_SUITE()

TYPED_TEST_SUITE ( TypedTest  ,
TypedTestTypes   
)

◆ TYPED_TEST_SUITE_P()

TYPED_TEST_SUITE_P ( TypeParameterizedTestSuite  )