uia 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -1
- data/lib/uia/version.rb +1 -1
- data/uia.gemspec +3 -1
- metadata +1 -48
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-actions.h +0 -1078
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-cardinalities.h +0 -147
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-actions.h +0 -2415
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-actions.h.pump +0 -821
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-function-mockers.h +0 -991
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-function-mockers.h.pump +0 -265
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-matchers.h +0 -2190
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-matchers.h.pump +0 -674
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-nice-strict.h +0 -397
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-nice-strict.h.pump +0 -161
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-matchers.h +0 -3986
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-more-actions.h +0 -233
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-more-matchers.h +0 -58
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-spec-builders.h +0 -1791
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock.h +0 -94
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-generated-internal-utils.h +0 -279
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-generated-internal-utils.h.pump +0 -136
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-internal-utils.h +0 -498
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-port.h +0 -78
- data/ext/UiaDll/UiaDll.Test/gmock/lib/gmock.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/gmock/lib/gmockd.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-death-test.h +0 -294
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-message.h +0 -250
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-param-test.h +0 -1421
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-param-test.h.pump +0 -487
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-printers.h +0 -855
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-spi.h +0 -232
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-test-part.h +0 -179
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-typed-test.h +0 -259
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest.h +0 -2291
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest_pred_impl.h +0 -358
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest_prod.h +0 -58
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-death-test-internal.h +0 -319
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-filepath.h +0 -206
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-internal.h +0 -1158
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-linked_ptr.h +0 -233
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-param-util-generated.h +0 -5143
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -301
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-param-util.h +0 -619
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-port.h +0 -1947
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-string.h +0 -167
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-tuple.h +0 -1012
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-tuple.h.pump +0 -339
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-type-util.h +0 -3331
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-type-util.h.pump +0 -297
- data/ext/UiaDll/UiaDll.Test/gtest/lib/gtest.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/gtest/lib/gtestd.lib +0 -0
@@ -1,232 +0,0 @@
|
|
1
|
-
// Copyright 2007, Google Inc.
|
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
|
-
// Author: wan@google.com (Zhanyong Wan)
|
31
|
-
//
|
32
|
-
// Utilities for testing Google Test itself and code that uses Google Test
|
33
|
-
// (e.g. frameworks built on top of Google Test).
|
34
|
-
|
35
|
-
#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
|
36
|
-
#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
|
37
|
-
|
38
|
-
#include "gtest/gtest.h"
|
39
|
-
|
40
|
-
namespace testing {
|
41
|
-
|
42
|
-
// This helper class can be used to mock out Google Test failure reporting
|
43
|
-
// so that we can test Google Test or code that builds on Google Test.
|
44
|
-
//
|
45
|
-
// An object of this class appends a TestPartResult object to the
|
46
|
-
// TestPartResultArray object given in the constructor whenever a Google Test
|
47
|
-
// failure is reported. It can either intercept only failures that are
|
48
|
-
// generated in the same thread that created this object or it can intercept
|
49
|
-
// all generated failures. The scope of this mock object can be controlled with
|
50
|
-
// the second argument to the two arguments constructor.
|
51
|
-
class GTEST_API_ ScopedFakeTestPartResultReporter
|
52
|
-
: public TestPartResultReporterInterface {
|
53
|
-
public:
|
54
|
-
// The two possible mocking modes of this object.
|
55
|
-
enum InterceptMode {
|
56
|
-
INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
|
57
|
-
INTERCEPT_ALL_THREADS // Intercepts all failures.
|
58
|
-
};
|
59
|
-
|
60
|
-
// The c'tor sets this object as the test part result reporter used
|
61
|
-
// by Google Test. The 'result' parameter specifies where to report the
|
62
|
-
// results. This reporter will only catch failures generated in the current
|
63
|
-
// thread. DEPRECATED
|
64
|
-
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
|
65
|
-
|
66
|
-
// Same as above, but you can choose the interception scope of this object.
|
67
|
-
ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
|
68
|
-
TestPartResultArray* result);
|
69
|
-
|
70
|
-
// The d'tor restores the previous test part result reporter.
|
71
|
-
virtual ~ScopedFakeTestPartResultReporter();
|
72
|
-
|
73
|
-
// Appends the TestPartResult object to the TestPartResultArray
|
74
|
-
// received in the constructor.
|
75
|
-
//
|
76
|
-
// This method is from the TestPartResultReporterInterface
|
77
|
-
// interface.
|
78
|
-
virtual void ReportTestPartResult(const TestPartResult& result);
|
79
|
-
private:
|
80
|
-
void Init();
|
81
|
-
|
82
|
-
const InterceptMode intercept_mode_;
|
83
|
-
TestPartResultReporterInterface* old_reporter_;
|
84
|
-
TestPartResultArray* const result_;
|
85
|
-
|
86
|
-
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
|
87
|
-
};
|
88
|
-
|
89
|
-
namespace internal {
|
90
|
-
|
91
|
-
// A helper class for implementing EXPECT_FATAL_FAILURE() and
|
92
|
-
// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
|
93
|
-
// TestPartResultArray contains exactly one failure that has the given
|
94
|
-
// type and contains the given substring. If that's not the case, a
|
95
|
-
// non-fatal failure will be generated.
|
96
|
-
class GTEST_API_ SingleFailureChecker {
|
97
|
-
public:
|
98
|
-
// The constructor remembers the arguments.
|
99
|
-
SingleFailureChecker(const TestPartResultArray* results,
|
100
|
-
TestPartResult::Type type,
|
101
|
-
const string& substr);
|
102
|
-
~SingleFailureChecker();
|
103
|
-
private:
|
104
|
-
const TestPartResultArray* const results_;
|
105
|
-
const TestPartResult::Type type_;
|
106
|
-
const string substr_;
|
107
|
-
|
108
|
-
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
|
109
|
-
};
|
110
|
-
|
111
|
-
} // namespace internal
|
112
|
-
|
113
|
-
} // namespace testing
|
114
|
-
|
115
|
-
// A set of macros for testing Google Test assertions or code that's expected
|
116
|
-
// to generate Google Test fatal failures. It verifies that the given
|
117
|
-
// statement will cause exactly one fatal Google Test failure with 'substr'
|
118
|
-
// being part of the failure message.
|
119
|
-
//
|
120
|
-
// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
|
121
|
-
// affects and considers failures generated in the current thread and
|
122
|
-
// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
123
|
-
//
|
124
|
-
// The verification of the assertion is done correctly even when the statement
|
125
|
-
// throws an exception or aborts the current function.
|
126
|
-
//
|
127
|
-
// Known restrictions:
|
128
|
-
// - 'statement' cannot reference local non-static variables or
|
129
|
-
// non-static members of the current object.
|
130
|
-
// - 'statement' cannot return a value.
|
131
|
-
// - You cannot stream a failure message to this macro.
|
132
|
-
//
|
133
|
-
// Note that even though the implementations of the following two
|
134
|
-
// macros are much alike, we cannot refactor them to use a common
|
135
|
-
// helper macro, due to some peculiarity in how the preprocessor
|
136
|
-
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
|
137
|
-
// gtest_unittest.cc will fail to compile if we do that.
|
138
|
-
#define EXPECT_FATAL_FAILURE(statement, substr) \
|
139
|
-
do { \
|
140
|
-
class GTestExpectFatalFailureHelper {\
|
141
|
-
public:\
|
142
|
-
static void Execute() { statement; }\
|
143
|
-
};\
|
144
|
-
::testing::TestPartResultArray gtest_failures;\
|
145
|
-
::testing::internal::SingleFailureChecker gtest_checker(\
|
146
|
-
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
147
|
-
{\
|
148
|
-
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
149
|
-
::testing::ScopedFakeTestPartResultReporter:: \
|
150
|
-
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
151
|
-
GTestExpectFatalFailureHelper::Execute();\
|
152
|
-
}\
|
153
|
-
} while (::testing::internal::AlwaysFalse())
|
154
|
-
|
155
|
-
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
156
|
-
do { \
|
157
|
-
class GTestExpectFatalFailureHelper {\
|
158
|
-
public:\
|
159
|
-
static void Execute() { statement; }\
|
160
|
-
};\
|
161
|
-
::testing::TestPartResultArray gtest_failures;\
|
162
|
-
::testing::internal::SingleFailureChecker gtest_checker(\
|
163
|
-
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
164
|
-
{\
|
165
|
-
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
166
|
-
::testing::ScopedFakeTestPartResultReporter:: \
|
167
|
-
INTERCEPT_ALL_THREADS, >est_failures);\
|
168
|
-
GTestExpectFatalFailureHelper::Execute();\
|
169
|
-
}\
|
170
|
-
} while (::testing::internal::AlwaysFalse())
|
171
|
-
|
172
|
-
// A macro for testing Google Test assertions or code that's expected to
|
173
|
-
// generate Google Test non-fatal failures. It asserts that the given
|
174
|
-
// statement will cause exactly one non-fatal Google Test failure with 'substr'
|
175
|
-
// being part of the failure message.
|
176
|
-
//
|
177
|
-
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
|
178
|
-
// affects and considers failures generated in the current thread and
|
179
|
-
// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
180
|
-
//
|
181
|
-
// 'statement' is allowed to reference local variables and members of
|
182
|
-
// the current object.
|
183
|
-
//
|
184
|
-
// The verification of the assertion is done correctly even when the statement
|
185
|
-
// throws an exception or aborts the current function.
|
186
|
-
//
|
187
|
-
// Known restrictions:
|
188
|
-
// - You cannot stream a failure message to this macro.
|
189
|
-
//
|
190
|
-
// Note that even though the implementations of the following two
|
191
|
-
// macros are much alike, we cannot refactor them to use a common
|
192
|
-
// helper macro, due to some peculiarity in how the preprocessor
|
193
|
-
// works. If we do that, the code won't compile when the user gives
|
194
|
-
// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
|
195
|
-
// expands to code containing an unprotected comma. The
|
196
|
-
// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
|
197
|
-
// catches that.
|
198
|
-
//
|
199
|
-
// For the same reason, we have to write
|
200
|
-
// if (::testing::internal::AlwaysTrue()) { statement; }
|
201
|
-
// instead of
|
202
|
-
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
203
|
-
// to avoid an MSVC warning on unreachable code.
|
204
|
-
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
205
|
-
do {\
|
206
|
-
::testing::TestPartResultArray gtest_failures;\
|
207
|
-
::testing::internal::SingleFailureChecker gtest_checker(\
|
208
|
-
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
209
|
-
(substr));\
|
210
|
-
{\
|
211
|
-
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
212
|
-
::testing::ScopedFakeTestPartResultReporter:: \
|
213
|
-
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
214
|
-
if (::testing::internal::AlwaysTrue()) { statement; }\
|
215
|
-
}\
|
216
|
-
} while (::testing::internal::AlwaysFalse())
|
217
|
-
|
218
|
-
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
219
|
-
do {\
|
220
|
-
::testing::TestPartResultArray gtest_failures;\
|
221
|
-
::testing::internal::SingleFailureChecker gtest_checker(\
|
222
|
-
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
223
|
-
(substr));\
|
224
|
-
{\
|
225
|
-
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
226
|
-
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
227
|
-
>est_failures);\
|
228
|
-
if (::testing::internal::AlwaysTrue()) { statement; }\
|
229
|
-
}\
|
230
|
-
} while (::testing::internal::AlwaysFalse())
|
231
|
-
|
232
|
-
#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
|
@@ -1,179 +0,0 @@
|
|
1
|
-
// Copyright 2008, Google Inc.
|
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
|
-
// Author: mheule@google.com (Markus Heule)
|
31
|
-
//
|
32
|
-
|
33
|
-
#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
34
|
-
#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
35
|
-
|
36
|
-
#include <iosfwd>
|
37
|
-
#include <vector>
|
38
|
-
#include "gtest/internal/gtest-internal.h"
|
39
|
-
#include "gtest/internal/gtest-string.h"
|
40
|
-
|
41
|
-
namespace testing {
|
42
|
-
|
43
|
-
// A copyable object representing the result of a test part (i.e. an
|
44
|
-
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
|
45
|
-
//
|
46
|
-
// Don't inherit from TestPartResult as its destructor is not virtual.
|
47
|
-
class GTEST_API_ TestPartResult {
|
48
|
-
public:
|
49
|
-
// The possible outcomes of a test part (i.e. an assertion or an
|
50
|
-
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
|
51
|
-
enum Type {
|
52
|
-
kSuccess, // Succeeded.
|
53
|
-
kNonFatalFailure, // Failed but the test can continue.
|
54
|
-
kFatalFailure // Failed and the test should be terminated.
|
55
|
-
};
|
56
|
-
|
57
|
-
// C'tor. TestPartResult does NOT have a default constructor.
|
58
|
-
// Always use this constructor (with parameters) to create a
|
59
|
-
// TestPartResult object.
|
60
|
-
TestPartResult(Type a_type,
|
61
|
-
const char* a_file_name,
|
62
|
-
int a_line_number,
|
63
|
-
const char* a_message)
|
64
|
-
: type_(a_type),
|
65
|
-
file_name_(a_file_name == NULL ? "" : a_file_name),
|
66
|
-
line_number_(a_line_number),
|
67
|
-
summary_(ExtractSummary(a_message)),
|
68
|
-
message_(a_message) {
|
69
|
-
}
|
70
|
-
|
71
|
-
// Gets the outcome of the test part.
|
72
|
-
Type type() const { return type_; }
|
73
|
-
|
74
|
-
// Gets the name of the source file where the test part took place, or
|
75
|
-
// NULL if it's unknown.
|
76
|
-
const char* file_name() const {
|
77
|
-
return file_name_.empty() ? NULL : file_name_.c_str();
|
78
|
-
}
|
79
|
-
|
80
|
-
// Gets the line in the source file where the test part took place,
|
81
|
-
// or -1 if it's unknown.
|
82
|
-
int line_number() const { return line_number_; }
|
83
|
-
|
84
|
-
// Gets the summary of the failure message.
|
85
|
-
const char* summary() const { return summary_.c_str(); }
|
86
|
-
|
87
|
-
// Gets the message associated with the test part.
|
88
|
-
const char* message() const { return message_.c_str(); }
|
89
|
-
|
90
|
-
// Returns true iff the test part passed.
|
91
|
-
bool passed() const { return type_ == kSuccess; }
|
92
|
-
|
93
|
-
// Returns true iff the test part failed.
|
94
|
-
bool failed() const { return type_ != kSuccess; }
|
95
|
-
|
96
|
-
// Returns true iff the test part non-fatally failed.
|
97
|
-
bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
|
98
|
-
|
99
|
-
// Returns true iff the test part fatally failed.
|
100
|
-
bool fatally_failed() const { return type_ == kFatalFailure; }
|
101
|
-
|
102
|
-
private:
|
103
|
-
Type type_;
|
104
|
-
|
105
|
-
// Gets the summary of the failure message by omitting the stack
|
106
|
-
// trace in it.
|
107
|
-
static std::string ExtractSummary(const char* message);
|
108
|
-
|
109
|
-
// The name of the source file where the test part took place, or
|
110
|
-
// "" if the source file is unknown.
|
111
|
-
std::string file_name_;
|
112
|
-
// The line in the source file where the test part took place, or -1
|
113
|
-
// if the line number is unknown.
|
114
|
-
int line_number_;
|
115
|
-
std::string summary_; // The test failure summary.
|
116
|
-
std::string message_; // The test failure message.
|
117
|
-
};
|
118
|
-
|
119
|
-
// Prints a TestPartResult object.
|
120
|
-
std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
|
121
|
-
|
122
|
-
// An array of TestPartResult objects.
|
123
|
-
//
|
124
|
-
// Don't inherit from TestPartResultArray as its destructor is not
|
125
|
-
// virtual.
|
126
|
-
class GTEST_API_ TestPartResultArray {
|
127
|
-
public:
|
128
|
-
TestPartResultArray() {}
|
129
|
-
|
130
|
-
// Appends the given TestPartResult to the array.
|
131
|
-
void Append(const TestPartResult& result);
|
132
|
-
|
133
|
-
// Returns the TestPartResult at the given index (0-based).
|
134
|
-
const TestPartResult& GetTestPartResult(int index) const;
|
135
|
-
|
136
|
-
// Returns the number of TestPartResult objects in the array.
|
137
|
-
int size() const;
|
138
|
-
|
139
|
-
private:
|
140
|
-
std::vector<TestPartResult> array_;
|
141
|
-
|
142
|
-
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
|
143
|
-
};
|
144
|
-
|
145
|
-
// This interface knows how to report a test part result.
|
146
|
-
class TestPartResultReporterInterface {
|
147
|
-
public:
|
148
|
-
virtual ~TestPartResultReporterInterface() {}
|
149
|
-
|
150
|
-
virtual void ReportTestPartResult(const TestPartResult& result) = 0;
|
151
|
-
};
|
152
|
-
|
153
|
-
namespace internal {
|
154
|
-
|
155
|
-
// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
|
156
|
-
// statement generates new fatal failures. To do so it registers itself as the
|
157
|
-
// current test part result reporter. Besides checking if fatal failures were
|
158
|
-
// reported, it only delegates the reporting to the former result reporter.
|
159
|
-
// The original result reporter is restored in the destructor.
|
160
|
-
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
161
|
-
class GTEST_API_ HasNewFatalFailureHelper
|
162
|
-
: public TestPartResultReporterInterface {
|
163
|
-
public:
|
164
|
-
HasNewFatalFailureHelper();
|
165
|
-
virtual ~HasNewFatalFailureHelper();
|
166
|
-
virtual void ReportTestPartResult(const TestPartResult& result);
|
167
|
-
bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
|
168
|
-
private:
|
169
|
-
bool has_new_fatal_failure_;
|
170
|
-
TestPartResultReporterInterface* original_reporter_;
|
171
|
-
|
172
|
-
GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
|
173
|
-
};
|
174
|
-
|
175
|
-
} // namespace internal
|
176
|
-
|
177
|
-
} // namespace testing
|
178
|
-
|
179
|
-
#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
@@ -1,259 +0,0 @@
|
|
1
|
-
// Copyright 2008 Google Inc.
|
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
|
-
// Author: wan@google.com (Zhanyong Wan)
|
31
|
-
|
32
|
-
#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
33
|
-
#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
34
|
-
|
35
|
-
// This header implements typed tests and type-parameterized tests.
|
36
|
-
|
37
|
-
// Typed (aka type-driven) tests repeat the same test for types in a
|
38
|
-
// list. You must know which types you want to test with when writing
|
39
|
-
// typed tests. Here's how you do it:
|
40
|
-
|
41
|
-
#if 0
|
42
|
-
|
43
|
-
// First, define a fixture class template. It should be parameterized
|
44
|
-
// by a type. Remember to derive it from testing::Test.
|
45
|
-
template <typename T>
|
46
|
-
class FooTest : public testing::Test {
|
47
|
-
public:
|
48
|
-
...
|
49
|
-
typedef std::list<T> List;
|
50
|
-
static T shared_;
|
51
|
-
T value_;
|
52
|
-
};
|
53
|
-
|
54
|
-
// Next, associate a list of types with the test case, which will be
|
55
|
-
// repeated for each type in the list. The typedef is necessary for
|
56
|
-
// the macro to parse correctly.
|
57
|
-
typedef testing::Types<char, int, unsigned int> MyTypes;
|
58
|
-
TYPED_TEST_CASE(FooTest, MyTypes);
|
59
|
-
|
60
|
-
// If the type list contains only one type, you can write that type
|
61
|
-
// directly without Types<...>:
|
62
|
-
// TYPED_TEST_CASE(FooTest, int);
|
63
|
-
|
64
|
-
// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
|
65
|
-
// tests for this test case as you want.
|
66
|
-
TYPED_TEST(FooTest, DoesBlah) {
|
67
|
-
// Inside a test, refer to TypeParam to get the type parameter.
|
68
|
-
// Since we are inside a derived class template, C++ requires use to
|
69
|
-
// visit the members of FooTest via 'this'.
|
70
|
-
TypeParam n = this->value_;
|
71
|
-
|
72
|
-
// To visit static members of the fixture, add the TestFixture::
|
73
|
-
// prefix.
|
74
|
-
n += TestFixture::shared_;
|
75
|
-
|
76
|
-
// To refer to typedefs in the fixture, add the "typename
|
77
|
-
// TestFixture::" prefix.
|
78
|
-
typename TestFixture::List values;
|
79
|
-
values.push_back(n);
|
80
|
-
...
|
81
|
-
}
|
82
|
-
|
83
|
-
TYPED_TEST(FooTest, HasPropertyA) { ... }
|
84
|
-
|
85
|
-
#endif // 0
|
86
|
-
|
87
|
-
// Type-parameterized tests are abstract test patterns parameterized
|
88
|
-
// by a type. Compared with typed tests, type-parameterized tests
|
89
|
-
// allow you to define the test pattern without knowing what the type
|
90
|
-
// parameters are. The defined pattern can be instantiated with
|
91
|
-
// different types any number of times, in any number of translation
|
92
|
-
// units.
|
93
|
-
//
|
94
|
-
// If you are designing an interface or concept, you can define a
|
95
|
-
// suite of type-parameterized tests to verify properties that any
|
96
|
-
// valid implementation of the interface/concept should have. Then,
|
97
|
-
// each implementation can easily instantiate the test suite to verify
|
98
|
-
// that it conforms to the requirements, without having to write
|
99
|
-
// similar tests repeatedly. Here's an example:
|
100
|
-
|
101
|
-
#if 0
|
102
|
-
|
103
|
-
// First, define a fixture class template. It should be parameterized
|
104
|
-
// by a type. Remember to derive it from testing::Test.
|
105
|
-
template <typename T>
|
106
|
-
class FooTest : public testing::Test {
|
107
|
-
...
|
108
|
-
};
|
109
|
-
|
110
|
-
// Next, declare that you will define a type-parameterized test case
|
111
|
-
// (the _P suffix is for "parameterized" or "pattern", whichever you
|
112
|
-
// prefer):
|
113
|
-
TYPED_TEST_CASE_P(FooTest);
|
114
|
-
|
115
|
-
// Then, use TYPED_TEST_P() to define as many type-parameterized tests
|
116
|
-
// for this type-parameterized test case as you want.
|
117
|
-
TYPED_TEST_P(FooTest, DoesBlah) {
|
118
|
-
// Inside a test, refer to TypeParam to get the type parameter.
|
119
|
-
TypeParam n = 0;
|
120
|
-
...
|
121
|
-
}
|
122
|
-
|
123
|
-
TYPED_TEST_P(FooTest, HasPropertyA) { ... }
|
124
|
-
|
125
|
-
// Now the tricky part: you need to register all test patterns before
|
126
|
-
// you can instantiate them. The first argument of the macro is the
|
127
|
-
// test case name; the rest are the names of the tests in this test
|
128
|
-
// case.
|
129
|
-
REGISTER_TYPED_TEST_CASE_P(FooTest,
|
130
|
-
DoesBlah, HasPropertyA);
|
131
|
-
|
132
|
-
// Finally, you are free to instantiate the pattern with the types you
|
133
|
-
// want. If you put the above code in a header file, you can #include
|
134
|
-
// it in multiple C++ source files and instantiate it multiple times.
|
135
|
-
//
|
136
|
-
// To distinguish different instances of the pattern, the first
|
137
|
-
// argument to the INSTANTIATE_* macro is a prefix that will be added
|
138
|
-
// to the actual test case name. Remember to pick unique prefixes for
|
139
|
-
// different instances.
|
140
|
-
typedef testing::Types<char, int, unsigned int> MyTypes;
|
141
|
-
INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
142
|
-
|
143
|
-
// If the type list contains only one type, you can write that type
|
144
|
-
// directly without Types<...>:
|
145
|
-
// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
|
146
|
-
|
147
|
-
#endif // 0
|
148
|
-
|
149
|
-
#include "gtest/internal/gtest-port.h"
|
150
|
-
#include "gtest/internal/gtest-type-util.h"
|
151
|
-
|
152
|
-
// Implements typed tests.
|
153
|
-
|
154
|
-
#if GTEST_HAS_TYPED_TEST
|
155
|
-
|
156
|
-
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
157
|
-
//
|
158
|
-
// Expands to the name of the typedef for the type parameters of the
|
159
|
-
// given test case.
|
160
|
-
# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
|
161
|
-
|
162
|
-
// The 'Types' template argument below must have spaces around it
|
163
|
-
// since some compilers may choke on '>>' when passing a template
|
164
|
-
// instance (e.g. Types<int>)
|
165
|
-
# define TYPED_TEST_CASE(CaseName, Types) \
|
166
|
-
typedef ::testing::internal::TypeList< Types >::type \
|
167
|
-
GTEST_TYPE_PARAMS_(CaseName)
|
168
|
-
|
169
|
-
# define TYPED_TEST(CaseName, TestName) \
|
170
|
-
template <typename gtest_TypeParam_> \
|
171
|
-
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
|
172
|
-
: public CaseName<gtest_TypeParam_> { \
|
173
|
-
private: \
|
174
|
-
typedef CaseName<gtest_TypeParam_> TestFixture; \
|
175
|
-
typedef gtest_TypeParam_ TypeParam; \
|
176
|
-
virtual void TestBody(); \
|
177
|
-
}; \
|
178
|
-
bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
|
179
|
-
::testing::internal::TypeParameterizedTest< \
|
180
|
-
CaseName, \
|
181
|
-
::testing::internal::TemplateSel< \
|
182
|
-
GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
|
183
|
-
GTEST_TYPE_PARAMS_(CaseName)>::Register(\
|
184
|
-
"", #CaseName, #TestName, 0); \
|
185
|
-
template <typename gtest_TypeParam_> \
|
186
|
-
void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
|
187
|
-
|
188
|
-
#endif // GTEST_HAS_TYPED_TEST
|
189
|
-
|
190
|
-
// Implements type-parameterized tests.
|
191
|
-
|
192
|
-
#if GTEST_HAS_TYPED_TEST_P
|
193
|
-
|
194
|
-
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
195
|
-
//
|
196
|
-
// Expands to the namespace name that the type-parameterized tests for
|
197
|
-
// the given type-parameterized test case are defined in. The exact
|
198
|
-
// name of the namespace is subject to change without notice.
|
199
|
-
# define GTEST_CASE_NAMESPACE_(TestCaseName) \
|
200
|
-
gtest_case_##TestCaseName##_
|
201
|
-
|
202
|
-
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
203
|
-
//
|
204
|
-
// Expands to the name of the variable used to remember the names of
|
205
|
-
// the defined tests in the given test case.
|
206
|
-
# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
|
207
|
-
gtest_typed_test_case_p_state_##TestCaseName##_
|
208
|
-
|
209
|
-
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
|
210
|
-
//
|
211
|
-
// Expands to the name of the variable used to remember the names of
|
212
|
-
// the registered tests in the given test case.
|
213
|
-
# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
|
214
|
-
gtest_registered_test_names_##TestCaseName##_
|
215
|
-
|
216
|
-
// The variables defined in the type-parameterized test macros are
|
217
|
-
// static as typically these macros are used in a .h file that can be
|
218
|
-
// #included in multiple translation units linked together.
|
219
|
-
# define TYPED_TEST_CASE_P(CaseName) \
|
220
|
-
static ::testing::internal::TypedTestCasePState \
|
221
|
-
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
|
222
|
-
|
223
|
-
# define TYPED_TEST_P(CaseName, TestName) \
|
224
|
-
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
|
225
|
-
template <typename gtest_TypeParam_> \
|
226
|
-
class TestName : public CaseName<gtest_TypeParam_> { \
|
227
|
-
private: \
|
228
|
-
typedef CaseName<gtest_TypeParam_> TestFixture; \
|
229
|
-
typedef gtest_TypeParam_ TypeParam; \
|
230
|
-
virtual void TestBody(); \
|
231
|
-
}; \
|
232
|
-
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
|
233
|
-
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
|
234
|
-
__FILE__, __LINE__, #CaseName, #TestName); \
|
235
|
-
} \
|
236
|
-
template <typename gtest_TypeParam_> \
|
237
|
-
void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
|
238
|
-
|
239
|
-
# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
|
240
|
-
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
|
241
|
-
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
|
242
|
-
} \
|
243
|
-
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
|
244
|
-
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
|
245
|
-
__FILE__, __LINE__, #__VA_ARGS__)
|
246
|
-
|
247
|
-
// The 'Types' template argument below must have spaces around it
|
248
|
-
// since some compilers may choke on '>>' when passing a template
|
249
|
-
// instance (e.g. Types<int>)
|
250
|
-
# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
|
251
|
-
bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
|
252
|
-
::testing::internal::TypeParameterizedTestCase<CaseName, \
|
253
|
-
GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
|
254
|
-
::testing::internal::TypeList< Types >::type>::Register(\
|
255
|
-
#Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
|
256
|
-
|
257
|
-
#endif // GTEST_HAS_TYPED_TEST_P
|
258
|
-
|
259
|
-
#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|