113481Sgiacomo.travaglini@arm.com// Copyright 2005, Google Inc.
213481Sgiacomo.travaglini@arm.com// All rights reserved.
313481Sgiacomo.travaglini@arm.com//
413481Sgiacomo.travaglini@arm.com// Redistribution and use in source and binary forms, with or without
513481Sgiacomo.travaglini@arm.com// modification, are permitted provided that the following conditions are
613481Sgiacomo.travaglini@arm.com// met:
713481Sgiacomo.travaglini@arm.com//
813481Sgiacomo.travaglini@arm.com//     * Redistributions of source code must retain the above copyright
913481Sgiacomo.travaglini@arm.com// notice, this list of conditions and the following disclaimer.
1013481Sgiacomo.travaglini@arm.com//     * Redistributions in binary form must reproduce the above
1113481Sgiacomo.travaglini@arm.com// copyright notice, this list of conditions and the following disclaimer
1213481Sgiacomo.travaglini@arm.com// in the documentation and/or other materials provided with the
1313481Sgiacomo.travaglini@arm.com// distribution.
1413481Sgiacomo.travaglini@arm.com//     * Neither the name of Google Inc. nor the names of its
1513481Sgiacomo.travaglini@arm.com// contributors may be used to endorse or promote products derived from
1613481Sgiacomo.travaglini@arm.com// this software without specific prior written permission.
1713481Sgiacomo.travaglini@arm.com//
1813481Sgiacomo.travaglini@arm.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1913481Sgiacomo.travaglini@arm.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2013481Sgiacomo.travaglini@arm.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2113481Sgiacomo.travaglini@arm.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2213481Sgiacomo.travaglini@arm.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2313481Sgiacomo.travaglini@arm.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2413481Sgiacomo.travaglini@arm.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2513481Sgiacomo.travaglini@arm.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2613481Sgiacomo.travaglini@arm.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2713481Sgiacomo.travaglini@arm.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2813481Sgiacomo.travaglini@arm.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2913481Sgiacomo.travaglini@arm.com//
3013481Sgiacomo.travaglini@arm.com// Author: wan@google.com (Zhanyong Wan)
3113481Sgiacomo.travaglini@arm.com//
3213481Sgiacomo.travaglini@arm.com// The Google C++ Testing Framework (Google Test)
3313481Sgiacomo.travaglini@arm.com//
3413481Sgiacomo.travaglini@arm.com// This header file defines the public API for death tests.  It is
3513481Sgiacomo.travaglini@arm.com// #included by gtest.h so a user doesn't need to include this
3613481Sgiacomo.travaglini@arm.com// directly.
3713481Sgiacomo.travaglini@arm.com
3813481Sgiacomo.travaglini@arm.com#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
3913481Sgiacomo.travaglini@arm.com#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
4013481Sgiacomo.travaglini@arm.com
4113481Sgiacomo.travaglini@arm.com#include "gtest/internal/gtest-death-test-internal.h"
4213481Sgiacomo.travaglini@arm.com
4313481Sgiacomo.travaglini@arm.comnamespace testing {
4413481Sgiacomo.travaglini@arm.com
4513481Sgiacomo.travaglini@arm.com// This flag controls the style of death tests.  Valid values are "threadsafe",
4613481Sgiacomo.travaglini@arm.com// meaning that the death test child process will re-execute the test binary
4713481Sgiacomo.travaglini@arm.com// from the start, running only a single death test, or "fast",
4813481Sgiacomo.travaglini@arm.com// meaning that the child process will execute the test logic immediately
4913481Sgiacomo.travaglini@arm.com// after forking.
5013481Sgiacomo.travaglini@arm.comGTEST_DECLARE_string_(death_test_style);
5113481Sgiacomo.travaglini@arm.com
5213481Sgiacomo.travaglini@arm.com#if GTEST_HAS_DEATH_TEST
5313481Sgiacomo.travaglini@arm.com
5413481Sgiacomo.travaglini@arm.comnamespace internal {
5513481Sgiacomo.travaglini@arm.com
5613481Sgiacomo.travaglini@arm.com// Returns a Boolean value indicating whether the caller is currently
5713481Sgiacomo.travaglini@arm.com// executing in the context of the death test child process.  Tools such as
5813481Sgiacomo.travaglini@arm.com// Valgrind heap checkers may need this to modify their behavior in death
5913481Sgiacomo.travaglini@arm.com// tests.  IMPORTANT: This is an internal utility.  Using it may break the
6013481Sgiacomo.travaglini@arm.com// implementation of death tests.  User code MUST NOT use it.
6113481Sgiacomo.travaglini@arm.comGTEST_API_ bool InDeathTestChild();
6213481Sgiacomo.travaglini@arm.com
6313481Sgiacomo.travaglini@arm.com}  // namespace internal
6413481Sgiacomo.travaglini@arm.com
6513481Sgiacomo.travaglini@arm.com// The following macros are useful for writing death tests.
6613481Sgiacomo.travaglini@arm.com
6713481Sgiacomo.travaglini@arm.com// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
6813481Sgiacomo.travaglini@arm.com// executed:
6913481Sgiacomo.travaglini@arm.com//
7013481Sgiacomo.travaglini@arm.com//   1. It generates a warning if there is more than one active
7113481Sgiacomo.travaglini@arm.com//   thread.  This is because it's safe to fork() or clone() only
7213481Sgiacomo.travaglini@arm.com//   when there is a single thread.
7313481Sgiacomo.travaglini@arm.com//
7413481Sgiacomo.travaglini@arm.com//   2. The parent process clone()s a sub-process and runs the death
7513481Sgiacomo.travaglini@arm.com//   test in it; the sub-process exits with code 0 at the end of the
7613481Sgiacomo.travaglini@arm.com//   death test, if it hasn't exited already.
7713481Sgiacomo.travaglini@arm.com//
7813481Sgiacomo.travaglini@arm.com//   3. The parent process waits for the sub-process to terminate.
7913481Sgiacomo.travaglini@arm.com//
8013481Sgiacomo.travaglini@arm.com//   4. The parent process checks the exit code and error message of
8113481Sgiacomo.travaglini@arm.com//   the sub-process.
8213481Sgiacomo.travaglini@arm.com//
8313481Sgiacomo.travaglini@arm.com// Examples:
8413481Sgiacomo.travaglini@arm.com//
8513481Sgiacomo.travaglini@arm.com//   ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
8613481Sgiacomo.travaglini@arm.com//   for (int i = 0; i < 5; i++) {
8713481Sgiacomo.travaglini@arm.com//     EXPECT_DEATH(server.ProcessRequest(i),
8813481Sgiacomo.travaglini@arm.com//                  "Invalid request .* in ProcessRequest()")
8913481Sgiacomo.travaglini@arm.com//                  << "Failed to die on request " << i;
9013481Sgiacomo.travaglini@arm.com//   }
9113481Sgiacomo.travaglini@arm.com//
9213481Sgiacomo.travaglini@arm.com//   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
9313481Sgiacomo.travaglini@arm.com//
9413481Sgiacomo.travaglini@arm.com//   bool KilledBySIGHUP(int exit_code) {
9513481Sgiacomo.travaglini@arm.com//     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
9613481Sgiacomo.travaglini@arm.com//   }
9713481Sgiacomo.travaglini@arm.com//
9813481Sgiacomo.travaglini@arm.com//   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
9913481Sgiacomo.travaglini@arm.com//
10013481Sgiacomo.travaglini@arm.com// On the regular expressions used in death tests:
10113481Sgiacomo.travaglini@arm.com//
10213481Sgiacomo.travaglini@arm.com//   On POSIX-compliant systems (*nix), we use the <regex.h> library,
10313481Sgiacomo.travaglini@arm.com//   which uses the POSIX extended regex syntax.
10413481Sgiacomo.travaglini@arm.com//
10513481Sgiacomo.travaglini@arm.com//   On other platforms (e.g. Windows), we only support a simple regex
10613481Sgiacomo.travaglini@arm.com//   syntax implemented as part of Google Test.  This limited
10713481Sgiacomo.travaglini@arm.com//   implementation should be enough most of the time when writing
10813481Sgiacomo.travaglini@arm.com//   death tests; though it lacks many features you can find in PCRE
10913481Sgiacomo.travaglini@arm.com//   or POSIX extended regex syntax.  For example, we don't support
11013481Sgiacomo.travaglini@arm.com//   union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
11113481Sgiacomo.travaglini@arm.com//   repetition count ("x{5,7}"), among others.
11213481Sgiacomo.travaglini@arm.com//
11313481Sgiacomo.travaglini@arm.com//   Below is the syntax that we do support.  We chose it to be a
11413481Sgiacomo.travaglini@arm.com//   subset of both PCRE and POSIX extended regex, so it's easy to
11513481Sgiacomo.travaglini@arm.com//   learn wherever you come from.  In the following: 'A' denotes a
11613481Sgiacomo.travaglini@arm.com//   literal character, period (.), or a single \\ escape sequence;
11713481Sgiacomo.travaglini@arm.com//   'x' and 'y' denote regular expressions; 'm' and 'n' are for
11813481Sgiacomo.travaglini@arm.com//   natural numbers.
11913481Sgiacomo.travaglini@arm.com//
12013481Sgiacomo.travaglini@arm.com//     c     matches any literal character c
12113481Sgiacomo.travaglini@arm.com//     \\d   matches any decimal digit
12213481Sgiacomo.travaglini@arm.com//     \\D   matches any character that's not a decimal digit
12313481Sgiacomo.travaglini@arm.com//     \\f   matches \f
12413481Sgiacomo.travaglini@arm.com//     \\n   matches \n
12513481Sgiacomo.travaglini@arm.com//     \\r   matches \r
12613481Sgiacomo.travaglini@arm.com//     \\s   matches any ASCII whitespace, including \n
12713481Sgiacomo.travaglini@arm.com//     \\S   matches any character that's not a whitespace
12813481Sgiacomo.travaglini@arm.com//     \\t   matches \t
12913481Sgiacomo.travaglini@arm.com//     \\v   matches \v
13013481Sgiacomo.travaglini@arm.com//     \\w   matches any letter, _, or decimal digit
13113481Sgiacomo.travaglini@arm.com//     \\W   matches any character that \\w doesn't match
13213481Sgiacomo.travaglini@arm.com//     \\c   matches any literal character c, which must be a punctuation
13313481Sgiacomo.travaglini@arm.com//     .     matches any single character except \n
13413481Sgiacomo.travaglini@arm.com//     A?    matches 0 or 1 occurrences of A
13513481Sgiacomo.travaglini@arm.com//     A*    matches 0 or many occurrences of A
13613481Sgiacomo.travaglini@arm.com//     A+    matches 1 or many occurrences of A
13713481Sgiacomo.travaglini@arm.com//     ^     matches the beginning of a string (not that of each line)
13813481Sgiacomo.travaglini@arm.com//     $     matches the end of a string (not that of each line)
13913481Sgiacomo.travaglini@arm.com//     xy    matches x followed by y
14013481Sgiacomo.travaglini@arm.com//
14113481Sgiacomo.travaglini@arm.com//   If you accidentally use PCRE or POSIX extended regex features
14213481Sgiacomo.travaglini@arm.com//   not implemented by us, you will get a run-time failure.  In that
14313481Sgiacomo.travaglini@arm.com//   case, please try to rewrite your regular expression within the
14413481Sgiacomo.travaglini@arm.com//   above syntax.
14513481Sgiacomo.travaglini@arm.com//
14613481Sgiacomo.travaglini@arm.com//   This implementation is *not* meant to be as highly tuned or robust
14713481Sgiacomo.travaglini@arm.com//   as a compiled regex library, but should perform well enough for a
14813481Sgiacomo.travaglini@arm.com//   death test, which already incurs significant overhead by launching
14913481Sgiacomo.travaglini@arm.com//   a child process.
15013481Sgiacomo.travaglini@arm.com//
15113481Sgiacomo.travaglini@arm.com// Known caveats:
15213481Sgiacomo.travaglini@arm.com//
15313481Sgiacomo.travaglini@arm.com//   A "threadsafe" style death test obtains the path to the test
15413481Sgiacomo.travaglini@arm.com//   program from argv[0] and re-executes it in the sub-process.  For
15513481Sgiacomo.travaglini@arm.com//   simplicity, the current implementation doesn't search the PATH
15613481Sgiacomo.travaglini@arm.com//   when launching the sub-process.  This means that the user must
15713481Sgiacomo.travaglini@arm.com//   invoke the test program via a path that contains at least one
15813481Sgiacomo.travaglini@arm.com//   path separator (e.g. path/to/foo_test and
15913481Sgiacomo.travaglini@arm.com//   /absolute/path/to/bar_test are fine, but foo_test is not).  This
16013481Sgiacomo.travaglini@arm.com//   is rarely a problem as people usually don't put the test binary
16113481Sgiacomo.travaglini@arm.com//   directory in PATH.
16213481Sgiacomo.travaglini@arm.com//
16313481Sgiacomo.travaglini@arm.com// TODO(wan@google.com): make thread-safe death tests search the PATH.
16413481Sgiacomo.travaglini@arm.com
16513481Sgiacomo.travaglini@arm.com// Asserts that a given statement causes the program to exit, with an
16613481Sgiacomo.travaglini@arm.com// integer exit status that satisfies predicate, and emitting error output
16713481Sgiacomo.travaglini@arm.com// that matches regex.
16813481Sgiacomo.travaglini@arm.com# define ASSERT_EXIT(statement, predicate, regex) \
16913481Sgiacomo.travaglini@arm.com    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
17013481Sgiacomo.travaglini@arm.com
17113481Sgiacomo.travaglini@arm.com// Like ASSERT_EXIT, but continues on to successive tests in the
17213481Sgiacomo.travaglini@arm.com// test case, if any:
17313481Sgiacomo.travaglini@arm.com# define EXPECT_EXIT(statement, predicate, regex) \
17413481Sgiacomo.travaglini@arm.com    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
17513481Sgiacomo.travaglini@arm.com
17613481Sgiacomo.travaglini@arm.com// Asserts that a given statement causes the program to exit, either by
17713481Sgiacomo.travaglini@arm.com// explicitly exiting with a nonzero exit code or being killed by a
17813481Sgiacomo.travaglini@arm.com// signal, and emitting error output that matches regex.
17913481Sgiacomo.travaglini@arm.com# define ASSERT_DEATH(statement, regex) \
18013481Sgiacomo.travaglini@arm.com    ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
18113481Sgiacomo.travaglini@arm.com
18213481Sgiacomo.travaglini@arm.com// Like ASSERT_DEATH, but continues on to successive tests in the
18313481Sgiacomo.travaglini@arm.com// test case, if any:
18413481Sgiacomo.travaglini@arm.com# define EXPECT_DEATH(statement, regex) \
18513481Sgiacomo.travaglini@arm.com    EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
18613481Sgiacomo.travaglini@arm.com
18713481Sgiacomo.travaglini@arm.com// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
18813481Sgiacomo.travaglini@arm.com
18913481Sgiacomo.travaglini@arm.com// Tests that an exit code describes a normal exit with a given exit code.
19013481Sgiacomo.travaglini@arm.comclass GTEST_API_ ExitedWithCode {
19113481Sgiacomo.travaglini@arm.com public:
19213481Sgiacomo.travaglini@arm.com  explicit ExitedWithCode(int exit_code);
19313481Sgiacomo.travaglini@arm.com  bool operator()(int exit_status) const;
19413481Sgiacomo.travaglini@arm.com private:
19513481Sgiacomo.travaglini@arm.com  // No implementation - assignment is unsupported.
19613481Sgiacomo.travaglini@arm.com  void operator=(const ExitedWithCode& other);
19713481Sgiacomo.travaglini@arm.com
19813481Sgiacomo.travaglini@arm.com  const int exit_code_;
19913481Sgiacomo.travaglini@arm.com};
20013481Sgiacomo.travaglini@arm.com
20113481Sgiacomo.travaglini@arm.com# if !GTEST_OS_WINDOWS
20213481Sgiacomo.travaglini@arm.com// Tests that an exit code describes an exit due to termination by a
20313481Sgiacomo.travaglini@arm.com// given signal.
20413481Sgiacomo.travaglini@arm.comclass GTEST_API_ KilledBySignal {
20513481Sgiacomo.travaglini@arm.com public:
20613481Sgiacomo.travaglini@arm.com  explicit KilledBySignal(int signum);
20713481Sgiacomo.travaglini@arm.com  bool operator()(int exit_status) const;
20813481Sgiacomo.travaglini@arm.com private:
20913481Sgiacomo.travaglini@arm.com  const int signum_;
21013481Sgiacomo.travaglini@arm.com};
21113481Sgiacomo.travaglini@arm.com# endif  // !GTEST_OS_WINDOWS
21213481Sgiacomo.travaglini@arm.com
21313481Sgiacomo.travaglini@arm.com// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
21413481Sgiacomo.travaglini@arm.com// The death testing framework causes this to have interesting semantics,
21513481Sgiacomo.travaglini@arm.com// since the sideeffects of the call are only visible in opt mode, and not
21613481Sgiacomo.travaglini@arm.com// in debug mode.
21713481Sgiacomo.travaglini@arm.com//
21813481Sgiacomo.travaglini@arm.com// In practice, this can be used to test functions that utilize the
21913481Sgiacomo.travaglini@arm.com// LOG(DFATAL) macro using the following style:
22013481Sgiacomo.travaglini@arm.com//
22113481Sgiacomo.travaglini@arm.com// int DieInDebugOr12(int* sideeffect) {
22213481Sgiacomo.travaglini@arm.com//   if (sideeffect) {
22313481Sgiacomo.travaglini@arm.com//     *sideeffect = 12;
22413481Sgiacomo.travaglini@arm.com//   }
22513481Sgiacomo.travaglini@arm.com//   LOG(DFATAL) << "death";
22613481Sgiacomo.travaglini@arm.com//   return 12;
22713481Sgiacomo.travaglini@arm.com// }
22813481Sgiacomo.travaglini@arm.com//
22913481Sgiacomo.travaglini@arm.com// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
23013481Sgiacomo.travaglini@arm.com//   int sideeffect = 0;
23113481Sgiacomo.travaglini@arm.com//   // Only asserts in dbg.
23213481Sgiacomo.travaglini@arm.com//   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
23313481Sgiacomo.travaglini@arm.com//
23413481Sgiacomo.travaglini@arm.com// #ifdef NDEBUG
23513481Sgiacomo.travaglini@arm.com//   // opt-mode has sideeffect visible.
23613481Sgiacomo.travaglini@arm.com//   EXPECT_EQ(12, sideeffect);
23713481Sgiacomo.travaglini@arm.com// #else
23813481Sgiacomo.travaglini@arm.com//   // dbg-mode no visible sideeffect.
23913481Sgiacomo.travaglini@arm.com//   EXPECT_EQ(0, sideeffect);
24013481Sgiacomo.travaglini@arm.com// #endif
24113481Sgiacomo.travaglini@arm.com// }
24213481Sgiacomo.travaglini@arm.com//
24313481Sgiacomo.travaglini@arm.com// This will assert that DieInDebugReturn12InOpt() crashes in debug
24413481Sgiacomo.travaglini@arm.com// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
24513481Sgiacomo.travaglini@arm.com// appropriate fallback value (12 in this case) in opt mode. If you
24613481Sgiacomo.travaglini@arm.com// need to test that a function has appropriate side-effects in opt
24713481Sgiacomo.travaglini@arm.com// mode, include assertions against the side-effects.  A general
24813481Sgiacomo.travaglini@arm.com// pattern for this is:
24913481Sgiacomo.travaglini@arm.com//
25013481Sgiacomo.travaglini@arm.com// EXPECT_DEBUG_DEATH({
25113481Sgiacomo.travaglini@arm.com//   // Side-effects here will have an effect after this statement in
25213481Sgiacomo.travaglini@arm.com//   // opt mode, but none in debug mode.
25313481Sgiacomo.travaglini@arm.com//   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
25413481Sgiacomo.travaglini@arm.com// }, "death");
25513481Sgiacomo.travaglini@arm.com//
25613481Sgiacomo.travaglini@arm.com# ifdef NDEBUG
25713481Sgiacomo.travaglini@arm.com
25813481Sgiacomo.travaglini@arm.com#  define EXPECT_DEBUG_DEATH(statement, regex) \
25913481Sgiacomo.travaglini@arm.com  GTEST_EXECUTE_STATEMENT_(statement, regex)
26013481Sgiacomo.travaglini@arm.com
26113481Sgiacomo.travaglini@arm.com#  define ASSERT_DEBUG_DEATH(statement, regex) \
26213481Sgiacomo.travaglini@arm.com  GTEST_EXECUTE_STATEMENT_(statement, regex)
26313481Sgiacomo.travaglini@arm.com
26413481Sgiacomo.travaglini@arm.com# else
26513481Sgiacomo.travaglini@arm.com
26613481Sgiacomo.travaglini@arm.com#  define EXPECT_DEBUG_DEATH(statement, regex) \
26713481Sgiacomo.travaglini@arm.com  EXPECT_DEATH(statement, regex)
26813481Sgiacomo.travaglini@arm.com
26913481Sgiacomo.travaglini@arm.com#  define ASSERT_DEBUG_DEATH(statement, regex) \
27013481Sgiacomo.travaglini@arm.com  ASSERT_DEATH(statement, regex)
27113481Sgiacomo.travaglini@arm.com
27213481Sgiacomo.travaglini@arm.com# endif  // NDEBUG for EXPECT_DEBUG_DEATH
27313481Sgiacomo.travaglini@arm.com#endif  // GTEST_HAS_DEATH_TEST
27413481Sgiacomo.travaglini@arm.com
27513481Sgiacomo.travaglini@arm.com// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
27613481Sgiacomo.travaglini@arm.com// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
27713481Sgiacomo.travaglini@arm.com// death tests are supported; otherwise they just issue a warning.  This is
27813481Sgiacomo.travaglini@arm.com// useful when you are combining death test assertions with normal test
27913481Sgiacomo.travaglini@arm.com// assertions in one test.
28013481Sgiacomo.travaglini@arm.com#if GTEST_HAS_DEATH_TEST
28113481Sgiacomo.travaglini@arm.com# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
28213481Sgiacomo.travaglini@arm.com    EXPECT_DEATH(statement, regex)
28313481Sgiacomo.travaglini@arm.com# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
28413481Sgiacomo.travaglini@arm.com    ASSERT_DEATH(statement, regex)
28513481Sgiacomo.travaglini@arm.com#else
28613481Sgiacomo.travaglini@arm.com# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
28713481Sgiacomo.travaglini@arm.com    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
28813481Sgiacomo.travaglini@arm.com# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
28913481Sgiacomo.travaglini@arm.com    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
29013481Sgiacomo.travaglini@arm.com#endif
29113481Sgiacomo.travaglini@arm.com
29213481Sgiacomo.travaglini@arm.com}  // namespace testing
29313481Sgiacomo.travaglini@arm.com
29413481Sgiacomo.travaglini@arm.com#endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
295