uia 0.0.5 → 0.0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,78 +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: vadimb@google.com (Vadim Berman)
|
31
|
-
//
|
32
|
-
// Low-level types and utilities for porting Google Mock to various
|
33
|
-
// platforms. They are subject to change without notice. DO NOT USE
|
34
|
-
// THEM IN USER CODE.
|
35
|
-
|
36
|
-
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
|
37
|
-
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
|
38
|
-
|
39
|
-
#include <assert.h>
|
40
|
-
#include <stdlib.h>
|
41
|
-
#include <iostream>
|
42
|
-
|
43
|
-
// Most of the types needed for porting Google Mock are also required
|
44
|
-
// for Google Test and are defined in gtest-port.h.
|
45
|
-
#include "gtest/internal/gtest-linked_ptr.h"
|
46
|
-
#include "gtest/internal/gtest-port.h"
|
47
|
-
|
48
|
-
// To avoid conditional compilation everywhere, we make it
|
49
|
-
// gmock-port.h's responsibility to #include the header implementing
|
50
|
-
// tr1/tuple. gmock-port.h does this via gtest-port.h, which is
|
51
|
-
// guaranteed to pull in the tuple header.
|
52
|
-
|
53
|
-
// For MS Visual C++, check the compiler version. At least VS 2003 is
|
54
|
-
// required to compile Google Mock.
|
55
|
-
#if defined(_MSC_VER) && _MSC_VER < 1310
|
56
|
-
# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
|
57
|
-
#endif
|
58
|
-
|
59
|
-
// Macro for referencing flags. This is public as we want the user to
|
60
|
-
// use this syntax to reference Google Mock flags.
|
61
|
-
#define GMOCK_FLAG(name) FLAGS_gmock_##name
|
62
|
-
|
63
|
-
// Macros for declaring flags.
|
64
|
-
#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
|
65
|
-
#define GMOCK_DECLARE_int32_(name) \
|
66
|
-
extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
|
67
|
-
#define GMOCK_DECLARE_string_(name) \
|
68
|
-
extern GTEST_API_ ::std::string GMOCK_FLAG(name)
|
69
|
-
|
70
|
-
// Macros for defining flags.
|
71
|
-
#define GMOCK_DEFINE_bool_(name, default_val, doc) \
|
72
|
-
GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
|
73
|
-
#define GMOCK_DEFINE_int32_(name, default_val, doc) \
|
74
|
-
GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
|
75
|
-
#define GMOCK_DEFINE_string_(name, default_val, doc) \
|
76
|
-
GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val)
|
77
|
-
|
78
|
-
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
|
Binary file
|
Binary file
|
@@ -1,294 +0,0 @@
|
|
1
|
-
// Copyright 2005, 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
|
-
// The Google C++ Testing Framework (Google Test)
|
33
|
-
//
|
34
|
-
// This header file defines the public API for death tests. It is
|
35
|
-
// #included by gtest.h so a user doesn't need to include this
|
36
|
-
// directly.
|
37
|
-
|
38
|
-
#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
39
|
-
#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
40
|
-
|
41
|
-
#include "gtest/internal/gtest-death-test-internal.h"
|
42
|
-
|
43
|
-
namespace testing {
|
44
|
-
|
45
|
-
// This flag controls the style of death tests. Valid values are "threadsafe",
|
46
|
-
// meaning that the death test child process will re-execute the test binary
|
47
|
-
// from the start, running only a single death test, or "fast",
|
48
|
-
// meaning that the child process will execute the test logic immediately
|
49
|
-
// after forking.
|
50
|
-
GTEST_DECLARE_string_(death_test_style);
|
51
|
-
|
52
|
-
#if GTEST_HAS_DEATH_TEST
|
53
|
-
|
54
|
-
namespace internal {
|
55
|
-
|
56
|
-
// Returns a Boolean value indicating whether the caller is currently
|
57
|
-
// executing in the context of the death test child process. Tools such as
|
58
|
-
// Valgrind heap checkers may need this to modify their behavior in death
|
59
|
-
// tests. IMPORTANT: This is an internal utility. Using it may break the
|
60
|
-
// implementation of death tests. User code MUST NOT use it.
|
61
|
-
GTEST_API_ bool InDeathTestChild();
|
62
|
-
|
63
|
-
} // namespace internal
|
64
|
-
|
65
|
-
// The following macros are useful for writing death tests.
|
66
|
-
|
67
|
-
// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
|
68
|
-
// executed:
|
69
|
-
//
|
70
|
-
// 1. It generates a warning if there is more than one active
|
71
|
-
// thread. This is because it's safe to fork() or clone() only
|
72
|
-
// when there is a single thread.
|
73
|
-
//
|
74
|
-
// 2. The parent process clone()s a sub-process and runs the death
|
75
|
-
// test in it; the sub-process exits with code 0 at the end of the
|
76
|
-
// death test, if it hasn't exited already.
|
77
|
-
//
|
78
|
-
// 3. The parent process waits for the sub-process to terminate.
|
79
|
-
//
|
80
|
-
// 4. The parent process checks the exit code and error message of
|
81
|
-
// the sub-process.
|
82
|
-
//
|
83
|
-
// Examples:
|
84
|
-
//
|
85
|
-
// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
|
86
|
-
// for (int i = 0; i < 5; i++) {
|
87
|
-
// EXPECT_DEATH(server.ProcessRequest(i),
|
88
|
-
// "Invalid request .* in ProcessRequest()")
|
89
|
-
// << "Failed to die on request " << i;
|
90
|
-
// }
|
91
|
-
//
|
92
|
-
// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
|
93
|
-
//
|
94
|
-
// bool KilledBySIGHUP(int exit_code) {
|
95
|
-
// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
|
96
|
-
// }
|
97
|
-
//
|
98
|
-
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
|
99
|
-
//
|
100
|
-
// On the regular expressions used in death tests:
|
101
|
-
//
|
102
|
-
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
103
|
-
// which uses the POSIX extended regex syntax.
|
104
|
-
//
|
105
|
-
// On other platforms (e.g. Windows), we only support a simple regex
|
106
|
-
// syntax implemented as part of Google Test. This limited
|
107
|
-
// implementation should be enough most of the time when writing
|
108
|
-
// death tests; though it lacks many features you can find in PCRE
|
109
|
-
// or POSIX extended regex syntax. For example, we don't support
|
110
|
-
// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
|
111
|
-
// repetition count ("x{5,7}"), among others.
|
112
|
-
//
|
113
|
-
// Below is the syntax that we do support. We chose it to be a
|
114
|
-
// subset of both PCRE and POSIX extended regex, so it's easy to
|
115
|
-
// learn wherever you come from. In the following: 'A' denotes a
|
116
|
-
// literal character, period (.), or a single \\ escape sequence;
|
117
|
-
// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
|
118
|
-
// natural numbers.
|
119
|
-
//
|
120
|
-
// c matches any literal character c
|
121
|
-
// \\d matches any decimal digit
|
122
|
-
// \\D matches any character that's not a decimal digit
|
123
|
-
// \\f matches \f
|
124
|
-
// \\n matches \n
|
125
|
-
// \\r matches \r
|
126
|
-
// \\s matches any ASCII whitespace, including \n
|
127
|
-
// \\S matches any character that's not a whitespace
|
128
|
-
// \\t matches \t
|
129
|
-
// \\v matches \v
|
130
|
-
// \\w matches any letter, _, or decimal digit
|
131
|
-
// \\W matches any character that \\w doesn't match
|
132
|
-
// \\c matches any literal character c, which must be a punctuation
|
133
|
-
// . matches any single character except \n
|
134
|
-
// A? matches 0 or 1 occurrences of A
|
135
|
-
// A* matches 0 or many occurrences of A
|
136
|
-
// A+ matches 1 or many occurrences of A
|
137
|
-
// ^ matches the beginning of a string (not that of each line)
|
138
|
-
// $ matches the end of a string (not that of each line)
|
139
|
-
// xy matches x followed by y
|
140
|
-
//
|
141
|
-
// If you accidentally use PCRE or POSIX extended regex features
|
142
|
-
// not implemented by us, you will get a run-time failure. In that
|
143
|
-
// case, please try to rewrite your regular expression within the
|
144
|
-
// above syntax.
|
145
|
-
//
|
146
|
-
// This implementation is *not* meant to be as highly tuned or robust
|
147
|
-
// as a compiled regex library, but should perform well enough for a
|
148
|
-
// death test, which already incurs significant overhead by launching
|
149
|
-
// a child process.
|
150
|
-
//
|
151
|
-
// Known caveats:
|
152
|
-
//
|
153
|
-
// A "threadsafe" style death test obtains the path to the test
|
154
|
-
// program from argv[0] and re-executes it in the sub-process. For
|
155
|
-
// simplicity, the current implementation doesn't search the PATH
|
156
|
-
// when launching the sub-process. This means that the user must
|
157
|
-
// invoke the test program via a path that contains at least one
|
158
|
-
// path separator (e.g. path/to/foo_test and
|
159
|
-
// /absolute/path/to/bar_test are fine, but foo_test is not). This
|
160
|
-
// is rarely a problem as people usually don't put the test binary
|
161
|
-
// directory in PATH.
|
162
|
-
//
|
163
|
-
// TODO(wan@google.com): make thread-safe death tests search the PATH.
|
164
|
-
|
165
|
-
// Asserts that a given statement causes the program to exit, with an
|
166
|
-
// integer exit status that satisfies predicate, and emitting error output
|
167
|
-
// that matches regex.
|
168
|
-
# define ASSERT_EXIT(statement, predicate, regex) \
|
169
|
-
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
|
170
|
-
|
171
|
-
// Like ASSERT_EXIT, but continues on to successive tests in the
|
172
|
-
// test case, if any:
|
173
|
-
# define EXPECT_EXIT(statement, predicate, regex) \
|
174
|
-
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
|
175
|
-
|
176
|
-
// Asserts that a given statement causes the program to exit, either by
|
177
|
-
// explicitly exiting with a nonzero exit code or being killed by a
|
178
|
-
// signal, and emitting error output that matches regex.
|
179
|
-
# define ASSERT_DEATH(statement, regex) \
|
180
|
-
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
|
181
|
-
|
182
|
-
// Like ASSERT_DEATH, but continues on to successive tests in the
|
183
|
-
// test case, if any:
|
184
|
-
# define EXPECT_DEATH(statement, regex) \
|
185
|
-
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
|
186
|
-
|
187
|
-
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
|
188
|
-
|
189
|
-
// Tests that an exit code describes a normal exit with a given exit code.
|
190
|
-
class GTEST_API_ ExitedWithCode {
|
191
|
-
public:
|
192
|
-
explicit ExitedWithCode(int exit_code);
|
193
|
-
bool operator()(int exit_status) const;
|
194
|
-
private:
|
195
|
-
// No implementation - assignment is unsupported.
|
196
|
-
void operator=(const ExitedWithCode& other);
|
197
|
-
|
198
|
-
const int exit_code_;
|
199
|
-
};
|
200
|
-
|
201
|
-
# if !GTEST_OS_WINDOWS
|
202
|
-
// Tests that an exit code describes an exit due to termination by a
|
203
|
-
// given signal.
|
204
|
-
class GTEST_API_ KilledBySignal {
|
205
|
-
public:
|
206
|
-
explicit KilledBySignal(int signum);
|
207
|
-
bool operator()(int exit_status) const;
|
208
|
-
private:
|
209
|
-
const int signum_;
|
210
|
-
};
|
211
|
-
# endif // !GTEST_OS_WINDOWS
|
212
|
-
|
213
|
-
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
214
|
-
// The death testing framework causes this to have interesting semantics,
|
215
|
-
// since the sideeffects of the call are only visible in opt mode, and not
|
216
|
-
// in debug mode.
|
217
|
-
//
|
218
|
-
// In practice, this can be used to test functions that utilize the
|
219
|
-
// LOG(DFATAL) macro using the following style:
|
220
|
-
//
|
221
|
-
// int DieInDebugOr12(int* sideeffect) {
|
222
|
-
// if (sideeffect) {
|
223
|
-
// *sideeffect = 12;
|
224
|
-
// }
|
225
|
-
// LOG(DFATAL) << "death";
|
226
|
-
// return 12;
|
227
|
-
// }
|
228
|
-
//
|
229
|
-
// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
|
230
|
-
// int sideeffect = 0;
|
231
|
-
// // Only asserts in dbg.
|
232
|
-
// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
|
233
|
-
//
|
234
|
-
// #ifdef NDEBUG
|
235
|
-
// // opt-mode has sideeffect visible.
|
236
|
-
// EXPECT_EQ(12, sideeffect);
|
237
|
-
// #else
|
238
|
-
// // dbg-mode no visible sideeffect.
|
239
|
-
// EXPECT_EQ(0, sideeffect);
|
240
|
-
// #endif
|
241
|
-
// }
|
242
|
-
//
|
243
|
-
// This will assert that DieInDebugReturn12InOpt() crashes in debug
|
244
|
-
// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
|
245
|
-
// appropriate fallback value (12 in this case) in opt mode. If you
|
246
|
-
// need to test that a function has appropriate side-effects in opt
|
247
|
-
// mode, include assertions against the side-effects. A general
|
248
|
-
// pattern for this is:
|
249
|
-
//
|
250
|
-
// EXPECT_DEBUG_DEATH({
|
251
|
-
// // Side-effects here will have an effect after this statement in
|
252
|
-
// // opt mode, but none in debug mode.
|
253
|
-
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
|
254
|
-
// }, "death");
|
255
|
-
//
|
256
|
-
# ifdef NDEBUG
|
257
|
-
|
258
|
-
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
259
|
-
GTEST_EXECUTE_STATEMENT_(statement, regex)
|
260
|
-
|
261
|
-
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
262
|
-
GTEST_EXECUTE_STATEMENT_(statement, regex)
|
263
|
-
|
264
|
-
# else
|
265
|
-
|
266
|
-
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
267
|
-
EXPECT_DEATH(statement, regex)
|
268
|
-
|
269
|
-
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
270
|
-
ASSERT_DEATH(statement, regex)
|
271
|
-
|
272
|
-
# endif // NDEBUG for EXPECT_DEBUG_DEATH
|
273
|
-
#endif // GTEST_HAS_DEATH_TEST
|
274
|
-
|
275
|
-
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
276
|
-
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
|
277
|
-
// death tests are supported; otherwise they just issue a warning. This is
|
278
|
-
// useful when you are combining death test assertions with normal test
|
279
|
-
// assertions in one test.
|
280
|
-
#if GTEST_HAS_DEATH_TEST
|
281
|
-
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
282
|
-
EXPECT_DEATH(statement, regex)
|
283
|
-
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
284
|
-
ASSERT_DEATH(statement, regex)
|
285
|
-
#else
|
286
|
-
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
287
|
-
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
|
288
|
-
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
289
|
-
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
|
290
|
-
#endif
|
291
|
-
|
292
|
-
} // namespace testing
|
293
|
-
|
294
|
-
#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
@@ -1,250 +0,0 @@
|
|
1
|
-
// Copyright 2005, 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
|
-
// The Google C++ Testing Framework (Google Test)
|
33
|
-
//
|
34
|
-
// This header file defines the Message class.
|
35
|
-
//
|
36
|
-
// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
|
37
|
-
// leave some internal implementation details in this header file.
|
38
|
-
// They are clearly marked by comments like this:
|
39
|
-
//
|
40
|
-
// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
41
|
-
//
|
42
|
-
// Such code is NOT meant to be used by a user directly, and is subject
|
43
|
-
// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
|
44
|
-
// program!
|
45
|
-
|
46
|
-
#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
47
|
-
#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
48
|
-
|
49
|
-
#include <limits>
|
50
|
-
|
51
|
-
#include "gtest/internal/gtest-port.h"
|
52
|
-
|
53
|
-
// Ensures that there is at least one operator<< in the global namespace.
|
54
|
-
// See Message& operator<<(...) below for why.
|
55
|
-
void operator<<(const testing::internal::Secret&, int);
|
56
|
-
|
57
|
-
namespace testing {
|
58
|
-
|
59
|
-
// The Message class works like an ostream repeater.
|
60
|
-
//
|
61
|
-
// Typical usage:
|
62
|
-
//
|
63
|
-
// 1. You stream a bunch of values to a Message object.
|
64
|
-
// It will remember the text in a stringstream.
|
65
|
-
// 2. Then you stream the Message object to an ostream.
|
66
|
-
// This causes the text in the Message to be streamed
|
67
|
-
// to the ostream.
|
68
|
-
//
|
69
|
-
// For example;
|
70
|
-
//
|
71
|
-
// testing::Message foo;
|
72
|
-
// foo << 1 << " != " << 2;
|
73
|
-
// std::cout << foo;
|
74
|
-
//
|
75
|
-
// will print "1 != 2".
|
76
|
-
//
|
77
|
-
// Message is not intended to be inherited from. In particular, its
|
78
|
-
// destructor is not virtual.
|
79
|
-
//
|
80
|
-
// Note that stringstream behaves differently in gcc and in MSVC. You
|
81
|
-
// can stream a NULL char pointer to it in the former, but not in the
|
82
|
-
// latter (it causes an access violation if you do). The Message
|
83
|
-
// class hides this difference by treating a NULL char pointer as
|
84
|
-
// "(null)".
|
85
|
-
class GTEST_API_ Message {
|
86
|
-
private:
|
87
|
-
// The type of basic IO manipulators (endl, ends, and flush) for
|
88
|
-
// narrow streams.
|
89
|
-
typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
|
90
|
-
|
91
|
-
public:
|
92
|
-
// Constructs an empty Message.
|
93
|
-
Message();
|
94
|
-
|
95
|
-
// Copy constructor.
|
96
|
-
Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
|
97
|
-
*ss_ << msg.GetString();
|
98
|
-
}
|
99
|
-
|
100
|
-
// Constructs a Message from a C-string.
|
101
|
-
explicit Message(const char* str) : ss_(new ::std::stringstream) {
|
102
|
-
*ss_ << str;
|
103
|
-
}
|
104
|
-
|
105
|
-
#if GTEST_OS_SYMBIAN
|
106
|
-
// Streams a value (either a pointer or not) to this object.
|
107
|
-
template <typename T>
|
108
|
-
inline Message& operator <<(const T& value) {
|
109
|
-
StreamHelper(typename internal::is_pointer<T>::type(), value);
|
110
|
-
return *this;
|
111
|
-
}
|
112
|
-
#else
|
113
|
-
// Streams a non-pointer value to this object.
|
114
|
-
template <typename T>
|
115
|
-
inline Message& operator <<(const T& val) {
|
116
|
-
// Some libraries overload << for STL containers. These
|
117
|
-
// overloads are defined in the global namespace instead of ::std.
|
118
|
-
//
|
119
|
-
// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
|
120
|
-
// overloads are visible in either the std namespace or the global
|
121
|
-
// namespace, but not other namespaces, including the testing
|
122
|
-
// namespace which Google Test's Message class is in.
|
123
|
-
//
|
124
|
-
// To allow STL containers (and other types that has a << operator
|
125
|
-
// defined in the global namespace) to be used in Google Test
|
126
|
-
// assertions, testing::Message must access the custom << operator
|
127
|
-
// from the global namespace. With this using declaration,
|
128
|
-
// overloads of << defined in the global namespace and those
|
129
|
-
// visible via Koenig lookup are both exposed in this function.
|
130
|
-
using ::operator <<;
|
131
|
-
*ss_ << val;
|
132
|
-
return *this;
|
133
|
-
}
|
134
|
-
|
135
|
-
// Streams a pointer value to this object.
|
136
|
-
//
|
137
|
-
// This function is an overload of the previous one. When you
|
138
|
-
// stream a pointer to a Message, this definition will be used as it
|
139
|
-
// is more specialized. (The C++ Standard, section
|
140
|
-
// [temp.func.order].) If you stream a non-pointer, then the
|
141
|
-
// previous definition will be used.
|
142
|
-
//
|
143
|
-
// The reason for this overload is that streaming a NULL pointer to
|
144
|
-
// ostream is undefined behavior. Depending on the compiler, you
|
145
|
-
// may get "0", "(nil)", "(null)", or an access violation. To
|
146
|
-
// ensure consistent result across compilers, we always treat NULL
|
147
|
-
// as "(null)".
|
148
|
-
template <typename T>
|
149
|
-
inline Message& operator <<(T* const& pointer) { // NOLINT
|
150
|
-
if (pointer == NULL) {
|
151
|
-
*ss_ << "(null)";
|
152
|
-
} else {
|
153
|
-
*ss_ << pointer;
|
154
|
-
}
|
155
|
-
return *this;
|
156
|
-
}
|
157
|
-
#endif // GTEST_OS_SYMBIAN
|
158
|
-
|
159
|
-
// Since the basic IO manipulators are overloaded for both narrow
|
160
|
-
// and wide streams, we have to provide this specialized definition
|
161
|
-
// of operator <<, even though its body is the same as the
|
162
|
-
// templatized version above. Without this definition, streaming
|
163
|
-
// endl or other basic IO manipulators to Message will confuse the
|
164
|
-
// compiler.
|
165
|
-
Message& operator <<(BasicNarrowIoManip val) {
|
166
|
-
*ss_ << val;
|
167
|
-
return *this;
|
168
|
-
}
|
169
|
-
|
170
|
-
// Instead of 1/0, we want to see true/false for bool values.
|
171
|
-
Message& operator <<(bool b) {
|
172
|
-
return *this << (b ? "true" : "false");
|
173
|
-
}
|
174
|
-
|
175
|
-
// These two overloads allow streaming a wide C string to a Message
|
176
|
-
// using the UTF-8 encoding.
|
177
|
-
Message& operator <<(const wchar_t* wide_c_str);
|
178
|
-
Message& operator <<(wchar_t* wide_c_str);
|
179
|
-
|
180
|
-
#if GTEST_HAS_STD_WSTRING
|
181
|
-
// Converts the given wide string to a narrow string using the UTF-8
|
182
|
-
// encoding, and streams the result to this Message object.
|
183
|
-
Message& operator <<(const ::std::wstring& wstr);
|
184
|
-
#endif // GTEST_HAS_STD_WSTRING
|
185
|
-
|
186
|
-
#if GTEST_HAS_GLOBAL_WSTRING
|
187
|
-
// Converts the given wide string to a narrow string using the UTF-8
|
188
|
-
// encoding, and streams the result to this Message object.
|
189
|
-
Message& operator <<(const ::wstring& wstr);
|
190
|
-
#endif // GTEST_HAS_GLOBAL_WSTRING
|
191
|
-
|
192
|
-
// Gets the text streamed to this object so far as an std::string.
|
193
|
-
// Each '\0' character in the buffer is replaced with "\\0".
|
194
|
-
//
|
195
|
-
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
196
|
-
std::string GetString() const;
|
197
|
-
|
198
|
-
private:
|
199
|
-
|
200
|
-
#if GTEST_OS_SYMBIAN
|
201
|
-
// These are needed as the Nokia Symbian Compiler cannot decide between
|
202
|
-
// const T& and const T* in a function template. The Nokia compiler _can_
|
203
|
-
// decide between class template specializations for T and T*, so a
|
204
|
-
// tr1::type_traits-like is_pointer works, and we can overload on that.
|
205
|
-
template <typename T>
|
206
|
-
inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
|
207
|
-
if (pointer == NULL) {
|
208
|
-
*ss_ << "(null)";
|
209
|
-
} else {
|
210
|
-
*ss_ << pointer;
|
211
|
-
}
|
212
|
-
}
|
213
|
-
template <typename T>
|
214
|
-
inline void StreamHelper(internal::false_type /*is_pointer*/,
|
215
|
-
const T& value) {
|
216
|
-
// See the comments in Message& operator <<(const T&) above for why
|
217
|
-
// we need this using statement.
|
218
|
-
using ::operator <<;
|
219
|
-
*ss_ << value;
|
220
|
-
}
|
221
|
-
#endif // GTEST_OS_SYMBIAN
|
222
|
-
|
223
|
-
// We'll hold the text streamed to this object here.
|
224
|
-
const internal::scoped_ptr< ::std::stringstream> ss_;
|
225
|
-
|
226
|
-
// We declare (but don't implement) this to prevent the compiler
|
227
|
-
// from implementing the assignment operator.
|
228
|
-
void operator=(const Message&);
|
229
|
-
};
|
230
|
-
|
231
|
-
// Streams a Message to an ostream.
|
232
|
-
inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
|
233
|
-
return os << sb.GetString();
|
234
|
-
}
|
235
|
-
|
236
|
-
namespace internal {
|
237
|
-
|
238
|
-
// Converts a streamable value to an std::string. A NULL pointer is
|
239
|
-
// converted to "(null)". When the input value is a ::string,
|
240
|
-
// ::std::string, ::wstring, or ::std::wstring object, each NUL
|
241
|
-
// character in it is replaced with "\\0".
|
242
|
-
template <typename T>
|
243
|
-
std::string StreamableToString(const T& streamable) {
|
244
|
-
return (Message() << streamable).GetString();
|
245
|
-
}
|
246
|
-
|
247
|
-
} // namespace internal
|
248
|
-
} // namespace testing
|
249
|
-
|
250
|
-
#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|