| 1 |
// Copyright 2008, Google Inc.cxx . . $ `<file>/Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/gtest-test-part.h`/ |
| 2 |
// All rights reserved. |
| 3 |
// |
| 4 |
// Redistribution and use in source and binary forms, with or without |
| 5 |
// modification, are permitted provided that the following conditions are |
| 6 |
// met: |
| 7 |
// |
| 8 |
// * Redistributions of source code must retain the above copyright |
| 9 |
// notice, this list of conditions and the following disclaimer. |
| 10 |
// * Redistributions in binary form must reproduce the above |
| 11 |
// copyright notice, this list of conditions and the following disclaimer |
| 12 |
// in the documentation and/or other materials provided with the |
| 13 |
// distribution. |
| 14 |
// * Neither the name of Google Inc. nor the names of its |
| 15 |
// contributors may be used to endorse or promote products derived from |
| 16 |
// this software without specific prior written permission. |
| 17 |
// |
| 18 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
|
| 30 |
// IWYU pragma: private, include "gtest/gtest.h" |
| 31 |
// IWYU pragma: friend gtest/.* |
| 32 |
// IWYU pragma: friend gmock/.* |
| 33 |
|
| 34 |
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ |
| 35 |
#define GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/gtest-test-part.h:35:9`! |
| 36 |
|
| 37 |
#include <iosfwd> |
| 38 |
#include <ostream> |
| 39 |
#include <string> |
| 40 |
#include <vector> |
| 41 |
|
| 42 |
#include "gtest/internal/gtest-internal.h"cxx . . $ `<file>/Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-internal.h`/ |
| 43 |
#include "gtest/internal/gtest-string.h"cxx . . $ `<file>/Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-string.h`/ |
| 44 |
|
| 45 |
GTEST_DISABLE_MSC_WARNINGS_PUSH_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-port.h:343:9`!(4251 \ |
| 46 |
/* class A needs to have dll-interface to be used by clients of class B */) |
| 47 |
|
| 48 |
namespace testingcxx . . $ testing/ { |
| 49 |
|
| 50 |
// A copyable object representing the result of a test part (i.e. an |
| 51 |
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). |
| 52 |
// |
| 53 |
// Don't inherit from TestPartResult as its destructor is not virtual. |
| 54 |
class GTEST_API_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-port.h:787:9`! TestPartResultcxx . . $ testing/TestPartResult# { |
| 55 |
public: |
| 56 |
// The possible outcomes of a test part (i.e. an assertion or an |
| 57 |
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()). |
| 58 |
enum Typecxx . . $ testing/TestPartResult#Type# { |
| 59 |
kSuccesscxx . . $ testing/TestPartResult#kSuccess., // Succeeded. |
| 60 |
kNonFatalFailurecxx . . $ testing/TestPartResult#kNonFatalFailure., // Failed but the test can continue. |
| 61 |
kFatalFailurecxx . . $ testing/TestPartResult#kFatalFailure., // Failed and the test should be terminated. |
| 62 |
kSkipcxx . . $ testing/TestPartResult#kSkip. // Skipped. |
| 63 |
}; |
| 64 |
|
| 65 |
// C'tor. TestPartResult does NOT have a default constructor. |
| 66 |
// Always use this constructor (with parameters) to create a |
| 67 |
// TestPartResult object. |
| 68 |
TestPartResultcxx . . $ testing/TestPartResult#TestPartResult(78ea96465f6608b5).(Typecxx . . $ testing/TestPartResult#Type# a_type, const char* a_file_name, int a_line_number, |
| 69 |
const char* a_message) |
| 70 |
: type_cxx . . $ testing/TestPartResult#type_.(a_type), |
| 71 |
file_name_cxx . . $ testing/TestPartResult#file_name_.(a_file_name == nullptr ? "" : a_file_name), |
| 72 |
line_number_cxx . . $ testing/TestPartResult#line_number_.(a_line_number), |
| 73 |
summary_cxx . . $ testing/TestPartResult#summary_.(ExtractSummarycxx . . $ testing/TestPartResult#ExtractSummary(d06bf7adff8c4caf).(a_message)), |
| 74 |
message_cxx . . $ testing/TestPartResult#message_.(a_message) {} |
| 75 |
|
| 76 |
// Gets the outcome of the test part. |
| 77 |
Typecxx . . $ testing/TestPartResult#Type# typecxx . . $ testing/TestPartResult#type(3cb87a6bc0e6e470).() const { return type_cxx . . $ testing/TestPartResult#type_.; } |
| 78 |
|
| 79 |
// Gets the name of the source file where the test part took place, or |
| 80 |
// NULL if it's unknown. |
| 81 |
const char* file_namecxx . . $ testing/TestPartResult#file_name(a9f41ea0e82d88cf).() const { |
| 82 |
return file_name_cxx . . $ testing/TestPartResult#file_name_..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() ? nullptr : file_name_cxx . . $ testing/TestPartResult#file_name_..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); |
| 83 |
} |
| 84 |
|
| 85 |
// Gets the line in the source file where the test part took place, |
| 86 |
// or -1 if it's unknown. |
| 87 |
int line_numbercxx . . $ testing/TestPartResult#line_number(455f465bc33b4cdf).() const { return line_number_cxx . . $ testing/TestPartResult#line_number_.; } |
| 88 |
|
| 89 |
// Gets the summary of the failure message. |
| 90 |
const char* summarycxx . . $ testing/TestPartResult#summary(a9f41ea0e82d88cf).() const { return summary_cxx . . $ testing/TestPartResult#summary_..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); } |
| 91 |
|
| 92 |
// Gets the message associated with the test part. |
| 93 |
const char* messagecxx . . $ testing/TestPartResult#message(a9f41ea0e82d88cf).() const { return message_cxx . . $ testing/TestPartResult#message_..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); } |
| 94 |
|
| 95 |
// Returns true if and only if the test part was skipped. |
| 96 |
bool skippedcxx . . $ testing/TestPartResult#skipped(50ce9a9e25b4a850).() const { return type_cxx . . $ testing/TestPartResult#type_. == kSkipcxx . . $ testing/TestPartResult#kSkip.; } |
| 97 |
|
| 98 |
// Returns true if and only if the test part passed. |
| 99 |
bool passedcxx . . $ testing/TestPartResult#passed(50ce9a9e25b4a850).() const { return type_cxx . . $ testing/TestPartResult#type_. == kSuccesscxx . . $ testing/TestPartResult#kSuccess.; } |
| 100 |
|
| 101 |
// Returns true if and only if the test part non-fatally failed. |
| 102 |
bool nonfatally_failedcxx . . $ testing/TestPartResult#nonfatally_failed(50ce9a9e25b4a850).() const { return type_cxx . . $ testing/TestPartResult#type_. == kNonFatalFailurecxx . . $ testing/TestPartResult#kNonFatalFailure.; } |
| 103 |
|
| 104 |
// Returns true if and only if the test part fatally failed. |
| 105 |
bool fatally_failedcxx . . $ testing/TestPartResult#fatally_failed(50ce9a9e25b4a850).() const { return type_cxx . . $ testing/TestPartResult#type_. == kFatalFailurecxx . . $ testing/TestPartResult#kFatalFailure.; } |
| 106 |
|
| 107 |
// Returns true if and only if the test part failed. |
| 108 |
bool failedcxx . . $ testing/TestPartResult#failed(50ce9a9e25b4a850).() const { return fatally_failedcxx . . $ testing/TestPartResult#fatally_failed(50ce9a9e25b4a850).() || nonfatally_failedcxx . . $ testing/TestPartResult#nonfatally_failed(50ce9a9e25b4a850).(); } |
| 109 |
|
| 110 |
private: |
| 111 |
Typecxx . . $ testing/TestPartResult#Type# type_cxx . . $ testing/TestPartResult#type_.; |
| 112 |
|
| 113 |
// Gets the summary of the failure message by omitting the stack |
| 114 |
// trace in it. |
| 115 |
static stdcxx . . $ std/::stringcxx . . $ std/string# ExtractSummarycxx . . $ testing/TestPartResult#ExtractSummary(d06bf7adff8c4caf).(const char* message); |
| 116 |
|
| 117 |
// The name of the source file where the test part took place, or |
| 118 |
// "" if the source file is unknown. |
| 119 |
stdcxx . . $ std/::stringcxx . . $ std/string# file_name_cxx . . $ testing/TestPartResult#file_name_.; |
| 120 |
// The line in the source file where the test part took place, or -1 |
| 121 |
// if the line number is unknown. |
| 122 |
int line_number_cxx . . $ testing/TestPartResult#line_number_.; |
| 123 |
stdcxx . . $ std/::stringcxx . . $ std/string# summary_cxx . . $ testing/TestPartResult#summary_.; // The test failure summary. |
| 124 |
stdcxx . . $ std/::stringcxx . . $ std/string# message_cxx . . $ testing/TestPartResult#message_.; // The test failure message. |
| 125 |
}; |
| 126 |
|
| 127 |
// Prints a TestPartResult object. |
| 128 |
stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& operatorcxx . . $ testing/`operator<<`(7b2968f47657240a).<<(stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os, const TestPartResultcxx . . $ testing/TestPartResult#& result); |
| 129 |
|
| 130 |
// An array of TestPartResult objects. |
| 131 |
// |
| 132 |
// Don't inherit from TestPartResultArray as its destructor is not |
| 133 |
// virtual. |
| 134 |
class GTEST_API_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-port.h:787:9`! TestPartResultArraycxx . . $ testing/TestPartResultArray# { |
| 135 |
public: |
| 136 |
TestPartResultArraycxx . . $ testing/TestPartResultArray#TestPartResultArray(49f6e7a06ebc5aa8).() {} |
| 137 |
|
| 138 |
// Appends the given TestPartResult to the array. |
| 139 |
void Appendcxx . . $ testing/TestPartResultArray#Append(1671c14f799d0273).(const TestPartResultcxx . . $ testing/TestPartResult#& result); |
| 140 |
|
| 141 |
// Returns the TestPartResult at the given index (0-based). |
| 142 |
const TestPartResultcxx . . $ testing/TestPartResult#& GetTestPartResultcxx . . $ testing/TestPartResultArray#GetTestPartResult(908ec00aa68fb0c3).(int index) const; |
| 143 |
|
| 144 |
// Returns the number of TestPartResult objects in the array. |
| 145 |
int sizecxx . . $ testing/TestPartResultArray#size(455f465bc33b4cdf).() const; |
| 146 |
|
| 147 |
private: |
| 148 |
stdcxx . . $ std/::vectorcxx . . $ std/vector#<TestPartResultcxx . . $ testing/TestPartResult#> array_cxx . . $ testing/TestPartResultArray#array_.; |
| 149 |
|
| 150 |
TestPartResultArraycxx . . $ testing/TestPartResultArray#TestPartResultArray(803729557130fed2).(const TestPartResultArraycxx . . $ testing/TestPartResultArray#&) = delete; |
| 151 |
TestPartResultArraycxx . . $ testing/TestPartResultArray#& operatorcxx . . $ testing/TestPartResultArray#`operator=`(11ef045abec2544b).=(const TestPartResultArraycxx . . $ testing/TestPartResultArray#&) = delete; |
| 152 |
}; |
| 153 |
|
| 154 |
// This interface knows how to report a test part result. |
| 155 |
class GTEST_API_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-port.h:787:9`! TestPartResultReporterInterfacecxx . . $ testing/TestPartResultReporterInterface# { |
| 156 |
public: |
| 157 |
virtual ~cxx . . $ testing/TestPartResultReporterInterface#`~TestPartResultReporterInterface`(ced63f7c635d850d).TestPartResultReporterInterfacecxx . . $ testing/TestPartResultReporterInterface#() {} |
| 158 |
|
| 159 |
virtual void ReportTestPartResultcxx . . $ testing/TestPartResultReporterInterface#ReportTestPartResult(1671c14f799d0273).(const TestPartResultcxx . . $ testing/TestPartResult#& result) = 0; |
| 160 |
}; |
| 161 |
|
| 162 |
namespace internalcxx . . $ testing/internal/ { |
| 163 |
|
| 164 |
// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a |
| 165 |
// statement generates new fatal failures. To do so it registers itself as the |
| 166 |
// current test part result reporter. Besides checking if fatal failures were |
| 167 |
// reported, it only delegates the reporting to the former result reporter. |
| 168 |
// The original result reporter is restored in the destructor. |
| 169 |
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. |
| 170 |
class GTEST_API_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-port.h:787:9`! HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper# |
| 171 |
: public TestPartResultReporterInterfacecxx . . $ testing/TestPartResultReporterInterface# { |
| 172 |
public: |
| 173 |
HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper#HasNewFatalFailureHelper(49f6e7a06ebc5aa8).(); |
| 174 |
~cxx . . $ testing/internal/HasNewFatalFailureHelper#`~HasNewFatalFailureHelper`(ced63f7c635d850d).HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper#() override; |
| 175 |
void ReportTestPartResultcxx . . $ testing/internal/HasNewFatalFailureHelper#ReportTestPartResult(1671c14f799d0273).(const TestPartResultcxx . . $ testing/TestPartResult#& result) override; |
| 176 |
bool has_new_fatal_failurecxx . . $ testing/internal/HasNewFatalFailureHelper#has_new_fatal_failure(50ce9a9e25b4a850).() const { return has_new_fatal_failure_cxx . . $ testing/internal/HasNewFatalFailureHelper#has_new_fatal_failure_.; } |
| 177 |
|
| 178 |
private: |
| 179 |
bool has_new_fatal_failure_cxx . . $ testing/internal/HasNewFatalFailureHelper#has_new_fatal_failure_.; |
| 180 |
TestPartResultReporterInterfacecxx . . $ testing/TestPartResultReporterInterface#* original_reporter_cxx . . $ testing/internal/HasNewFatalFailureHelper#original_reporter_.; |
| 181 |
|
| 182 |
HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper#HasNewFatalFailureHelper(c38f2a25089cc62e).(const HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper#&) = delete; |
| 183 |
HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper#& operatorcxx . . $ testing/internal/HasNewFatalFailureHelper#`operator=`(3e7134d028308d9a).=(const HasNewFatalFailureHelpercxx . . $ testing/internal/HasNewFatalFailureHelper#&) = delete; |
| 184 |
}; |
| 185 |
|
| 186 |
} // namespace internal |
| 187 |
|
| 188 |
} // namespace testing |
| 189 |
|
| 190 |
GTEST_DISABLE_MSC_WARNINGS_POP_cxx . . $ `Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/include/gtest/internal/gtest-port.h:344:9`!() // 4251 |
| 191 |
|
| 192 |
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ |