Commit e0865dd9 authored by shiqian's avatar shiqian
Browse files

Many changes:

- appends "_" to internal macro names (by Markus Heule).
- makes Google Test work with newer versions of tools on Symbian and Windows CE (by Mika Raento).
- adds the (ASSERT|EXPECT)_NO_FATAL_FAILURE macros (by Markus Heule).
- changes EXPECT_(NON|)FATAL_FAILURE to catch failures in the current thread only (by Markus Heule).
- adds the EXPECT_(NON|)FATAL_FAILURE_ON_ALL_THREADS macros (by Markus Heule).
- adds GTEST_HAS_PTHREAD and GTEST_IS_THREADSAFE to indicate the availability of <pthread.h> and Google Test's thread-safety (by Zhanyong Wan).
- adds scons/SConscript for building with scons (by Joi Sigurdsson).
- adds src/gtest-all.cc for building Google Test from a single file (by Markus Heule).
- updates the xcode project to include new tests (by Preston Jackson).
parent 0cbe322d
......@@ -115,7 +115,7 @@ class MayDie {
// A member function that may die.
void MemberFunction() const {
if (should_die_) {
GTEST_LOG(FATAL, "death inside MayDie::MemberFunction().");
GTEST_LOG_(FATAL, "death inside MayDie::MemberFunction().");
}
}
......@@ -126,26 +126,26 @@ class MayDie {
// A global function that's expected to die.
void GlobalFunction() {
GTEST_LOG(FATAL, "death inside GlobalFunction().");
GTEST_LOG_(FATAL, "death inside GlobalFunction().");
}
// A non-void function that's expected to die.
int NonVoidFunction() {
GTEST_LOG(FATAL, "death inside NonVoidFunction().");
GTEST_LOG_(FATAL, "death inside NonVoidFunction().");
return 1;
}
// A unary function that may die.
void DieIf(bool should_die) {
if (should_die) {
GTEST_LOG(FATAL, "death inside DieIf().");
GTEST_LOG_(FATAL, "death inside DieIf().");
}
}
// A binary function that may die.
bool DieIfLessThan(int x, int y) {
if (x < y) {
GTEST_LOG(FATAL, "death inside DieIfLessThan().");
GTEST_LOG_(FATAL, "death inside DieIfLessThan().");
}
return true;
}
......@@ -160,7 +160,7 @@ void DeathTestSubroutine() {
int DieInDebugElse12(int* sideeffect) {
if (sideeffect) *sideeffect = 12;
#ifndef NDEBUG
GTEST_LOG(FATAL, "debug death inside DieInDebugElse12()");
GTEST_LOG_(FATAL, "debug death inside DieInDebugElse12()");
#endif // NDEBUG
return 12;
}
......@@ -717,7 +717,7 @@ bool MockDeathTestFactory::Create(const char* statement,
return true;
}
// A test fixture for testing the logic of the GTEST_DEATH_TEST macro.
// A test fixture for testing the logic of the GTEST_DEATH_TEST_ macro.
// It installs a MockDeathTestFactory that is used for the duration
// of the test case.
class MacroLogicDeathTest : public testing::Test {
......
......@@ -286,9 +286,12 @@ TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
}
#endif // GTEST_OS_WINDOWS
#ifndef _WIN32_WCE
// Windows CE _does_ consider an empty directory to exist.
TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
EXPECT_FALSE(FilePath("").DirectoryExists());
}
#endif // ! _WIN32_WCE
TEST(DirectoryTest, CurrentDirectoryExists) {
#ifdef GTEST_OS_WINDOWS // We are on Windows.
......
// Copyright 2008 Google Inc. All Rights Reserved.
// Author: mheule@google.com (Markus Heule)
#include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
using testing::Test;
using testing::TestPartResult;
using testing::TestPartResultArray;
using testing::TPRT_FATAL_FAILURE;
using testing::TPRT_NONFATAL_FAILURE;
using testing::TPRT_SUCCESS;
namespace {
// Tests the TestPartResult class.
// The test fixture for testing TestPartResult.
class TestPartResultTest : public Test {
protected:
TestPartResultTest()
: r1_(TPRT_SUCCESS, "foo/bar.cc", 10, "Success!"),
r2_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure!"),
r3_(TPRT_FATAL_FAILURE, NULL, -1, "Failure!") {}
TestPartResult r1_, r2_, r3_;
};
// Tests TestPartResult::type().
TEST_F(TestPartResultTest, type) {
EXPECT_EQ(TPRT_SUCCESS, r1_.type());
EXPECT_EQ(TPRT_NONFATAL_FAILURE, r2_.type());
EXPECT_EQ(TPRT_FATAL_FAILURE, r3_.type());
}
// Tests TestPartResult::file_name().
TEST_F(TestPartResultTest, file_name) {
EXPECT_STREQ("foo/bar.cc", r1_.file_name());
EXPECT_STREQ(NULL, r3_.file_name());
}
// Tests TestPartResult::line_number().
TEST_F(TestPartResultTest, line_number) {
EXPECT_EQ(10, r1_.line_number());
EXPECT_EQ(-1, r2_.line_number());
}
// Tests TestPartResult::message().
TEST_F(TestPartResultTest, message) {
EXPECT_STREQ("Success!", r1_.message());
}
// Tests TestPartResult::passed().
TEST_F(TestPartResultTest, Passed) {
EXPECT_TRUE(r1_.passed());
EXPECT_FALSE(r2_.passed());
EXPECT_FALSE(r3_.passed());
}
// Tests TestPartResult::failed().
TEST_F(TestPartResultTest, Failed) {
EXPECT_FALSE(r1_.failed());
EXPECT_TRUE(r2_.failed());
EXPECT_TRUE(r3_.failed());
}
// Tests TestPartResult::fatally_failed().
TEST_F(TestPartResultTest, FatallyFailed) {
EXPECT_FALSE(r1_.fatally_failed());
EXPECT_FALSE(r2_.fatally_failed());
EXPECT_TRUE(r3_.fatally_failed());
}
// Tests TestPartResult::nonfatally_failed().
TEST_F(TestPartResultTest, NonfatallyFailed) {
EXPECT_FALSE(r1_.nonfatally_failed());
EXPECT_TRUE(r2_.nonfatally_failed());
EXPECT_FALSE(r3_.nonfatally_failed());
}
// Tests the TestPartResultArray class.
class TestPartResultArrayTest : public Test {
protected:
TestPartResultArrayTest()
: r1_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure 1"),
r2_(TPRT_FATAL_FAILURE, "foo/bar.cc", -1, "Failure 2") {}
const TestPartResult r1_, r2_;
};
// Tests that TestPartResultArray initially has size 0.
TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
TestPartResultArray results;
EXPECT_EQ(0, results.size());
}
// Tests that TestPartResultArray contains the given TestPartResult
// after one Append() operation.
TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
TestPartResultArray results;
results.Append(r1_);
EXPECT_EQ(1, results.size());
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
}
// Tests that TestPartResultArray contains the given TestPartResults
// after two Append() operations.
TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
TestPartResultArray results;
results.Append(r1_);
results.Append(r2_);
EXPECT_EQ(2, results.size());
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
}
#ifdef GTEST_HAS_DEATH_TEST
typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
// Tests that the program dies when GetTestPartResult() is called with
// an invalid index.
TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {
TestPartResultArray results;
results.Append(r1_);
EXPECT_DEATH(results.GetTestPartResult(-1), "");
EXPECT_DEATH(results.GetTestPartResult(1), "");
}
#endif // GTEST_HAS_DEATH_TEST
// TODO(mheule@google.com): Add a test for the class HasNewFatalFailureHelper.
} // namespace
......@@ -36,7 +36,7 @@
#include <gtest/gtest.h>
namespace testing {
GTEST_DECLARE_string(filter);
GTEST_DECLARE_string_(filter);
}
namespace {
......
......@@ -46,14 +46,20 @@
#include <stdlib.h>
#if GTEST_HAS_PTHREAD
#include <pthread.h>
#endif // GTEST_HAS_PTHREAD
#ifdef GTEST_OS_LINUX
#include <string.h>
#include <signal.h>
#include <pthread.h>
#include <string>
#include <vector>
#endif // GTEST_OS_LINUX
using testing::ScopedFakeTestPartResultReporter;
using testing::TestPartResultArray;
// Tests catching fatal failures.
// A subroutine used by the following test.
......@@ -790,6 +796,134 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
#endif // GTEST_HAS_DEATH_TEST
// Tests various failure conditions of
// EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS}.
class ExpectFailureTest : public testing::Test {
protected:
enum FailureMode {
FATAL_FAILURE,
NONFATAL_FAILURE
};
static void AddFailure(FailureMode failure) {
if (failure == FATAL_FAILURE) {
FAIL() << "Expected fatal failure.";
} else {
ADD_FAILURE() << "Expected non-fatal failure.";
}
}
};
TEST_F(ExpectFailureTest, ExpectFatalFailure) {
// Expected fatal failure, but succeeds.
printf("(expecting 1 failure)\n");
EXPECT_FATAL_FAILURE(SUCCEED(), "Expected fatal failure.");
// Expected fatal failure, but got a non-fatal failure.
printf("(expecting 1 failure)\n");
EXPECT_FATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Expected non-fatal "
"failure.");
// Wrong message.
printf("(expecting 1 failure)\n");
EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Some other fatal failure "
"expected.");
}
TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
// Expected non-fatal failure, but succeeds.
printf("(expecting 1 failure)\n");
EXPECT_NONFATAL_FAILURE(SUCCEED(), "Expected non-fatal failure.");
// Expected non-fatal failure, but got a fatal failure.
printf("(expecting 1 failure)\n");
EXPECT_NONFATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
// Wrong message.
printf("(expecting 1 failure)\n");
EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Some other non-fatal "
"failure.");
}
#if GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
class ExpectFailureWithThreadsTest : public ExpectFailureTest {
protected:
static void AddFailureInOtherThread(FailureMode failure) {
pthread_t tid;
pthread_create(&tid,
NULL,
ExpectFailureWithThreadsTest::FailureThread,
&failure);
pthread_join(tid, NULL);
}
private:
static void* FailureThread(void* attr) {
FailureMode* failure = static_cast<FailureMode*>(attr);
AddFailure(*failure);
return NULL;
}
};
TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailure) {
// We only intercept the current thread.
printf("(expecting 2 failures)\n");
EXPECT_FATAL_FAILURE(AddFailureInOtherThread(FATAL_FAILURE),
"Expected fatal failure.");
}
TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailure) {
// We only intercept the current thread.
printf("(expecting 2 failures)\n");
EXPECT_NONFATAL_FAILURE(AddFailureInOtherThread(NONFATAL_FAILURE),
"Expected non-fatal failure.");
}
typedef ExpectFailureWithThreadsTest ScopedFakeTestPartResultReporterTest;
// Tests that the ScopedFakeTestPartResultReporter only catches failures from
// the current thread if it is instantiated with INTERCEPT_ONLY_CURRENT_THREAD.
TEST_F(ScopedFakeTestPartResultReporterTest, InterceptOnlyCurrentThread) {
printf("(expecting 2 failures)\n");
TestPartResultArray results;
{
ScopedFakeTestPartResultReporter reporter(
ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
&results);
AddFailureInOtherThread(FATAL_FAILURE);
AddFailureInOtherThread(NONFATAL_FAILURE);
}
// The two failures should not have been intercepted.
EXPECT_EQ(0, results.size()) << "This shouldn't fail.";
}
#endif // GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
// Expected fatal failure, but succeeds.
printf("(expecting 1 failure)\n");
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected fatal failure.");
// Expected fatal failure, but got a non-fatal failure.
printf("(expecting 1 failure)\n");
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
"Expected non-fatal failure.");
// Wrong message.
printf("(expecting 1 failure)\n");
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
"Some other fatal failure expected.");
}
TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
// Expected non-fatal failure, but succeeds.
printf("(expecting 1 failure)\n");
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected non-fatal "
"failure.");
// Expected non-fatal failure, but got a fatal failure.
printf("(expecting 1 failure)\n");
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
"Expected fatal failure.");
// Wrong message.
printf("(expecting 1 failure)\n");
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
"Some other non-fatal failure.");
}
// Two test environments for testing testing::AddGlobalTestEnvironment().
class FooEnvironment : public testing::Environment {
......
......@@ -7,7 +7,7 @@ Expected: true
gtest_output_test_.cc:#: Failure
Value of: 3
Expected: 2
[==========] Running 48 tests from 21 test cases.
[==========] Running 52 tests from 22 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
......@@ -386,6 +386,107 @@ Value of: TypeParam()
Expected: 1
Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure
[----------] 4 tests from ExpectFailureTest
[ RUN ] ExpectFailureTest.ExpectFatalFailure
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ RUN ] ExpectFailureTest.ExpectNonFatalFailure
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
[ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
[----------] Global test environment tear-down
BarEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure
......@@ -395,9 +496,9 @@ FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure
Failed
Expected fatal failure.
[==========] 48 tests from 21 test cases ran.
[==========] 52 tests from 22 test cases ran.
[ PASSED ] 19 tests.
[ FAILED ] 29 tests, listed below:
[ FAILED ] 33 tests, listed below:
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
......@@ -427,8 +528,12 @@ Expected fatal failure.
[ FAILED ] TypedTest/0.Failure, where TypeParam = int
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
29 FAILED TESTS
33 FAILED TESTS
The non-test part of the code is expected to have 2 failures.
gtest_output_test_.cc:#: Failure
......
......@@ -5,7 +5,7 @@ gtest_output_test_.cc:#: error: Value of: false
Expected: true
gtest_output_test_.cc:#: error: Value of: 3
Expected: 2
[==========] Running 46 tests from 19 test cases.
[==========] Running 50 tests from 20 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
......@@ -344,6 +344,95 @@ gtest_output_test_.cc:#: error: Value of: TypeParam()
Expected: 1
Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure
[----------] 4 tests from ExpectFailureTest
[ RUN ] ExpectFailureTest.ExpectFatalFailure
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ RUN ] ExpectFailureTest.ExpectNonFatalFailure
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 fatal failure
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
[ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Success:
Succeeded
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 non-fatal failure
Actual:
gtest_output_test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
(expecting 1 failure)
gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual:
gtest_output_test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
[----------] Global test environment tear-down
BarEnvironment::TearDown() called.
gtest_output_test_.cc:#: error: Failed
......@@ -351,9 +440,9 @@ Expected non-fatal failure.
FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: error: Failed
Expected fatal failure.
[==========] 46 tests from 19 test cases ran.
[==========] 50 tests from 20 test cases ran.
[ PASSED ] 14 tests.
[ FAILED ] 32 tests, listed below:
[ FAILED ] 36 tests, listed below:
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
......@@ -386,8 +475,12 @@ Expected fatal failure.
[ FAILED ] TypedTest/0.Failure, where TypeParam = int
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
32 FAILED TESTS
36 FAILED TESTS
The non-test part of the code is expected to have 2 failures.
gtest_output_test_.cc:#: error: Value of: false
......
......@@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file is AUTOMATICALLY GENERATED on 06/11/2008 by command
// This file is AUTOMATICALLY GENERATED on 10/02/2008 by command
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
// Regression test for gtest_pred_impl.h
......
......@@ -46,9 +46,9 @@
namespace testing {
GTEST_DECLARE_string(death_test_style);
GTEST_DECLARE_string(filter);
GTEST_DECLARE_int32(repeat);
GTEST_DECLARE_string_(death_test_style);
GTEST_DECLARE_string_(filter);
GTEST_DECLARE_int32_(repeat);
} // namespace testing
......
// Copyright 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: mheule@google.com (Markus Heule)
//
// This test verifies that it's possible to use Google Test by including
// the gtest.h header file alone.
#include <gtest/gtest.h>
namespace {
void Subroutine() {
EXPECT_EQ(42, 42);
}
TEST(NoFatalFailureTest, ExpectNoFatalFailure) {
EXPECT_NO_FATAL_FAILURE(;);
EXPECT_NO_FATAL_FAILURE(SUCCEED());
EXPECT_NO_FATAL_FAILURE(Subroutine());
EXPECT_NO_FATAL_FAILURE({ SUCCEED(); });
}
TEST(NoFatalFailureTest, AssertNoFatalFailure) {
ASSERT_NO_FATAL_FAILURE(;);
ASSERT_NO_FATAL_FAILURE(SUCCEED());
ASSERT_NO_FATAL_FAILURE(Subroutine());
ASSERT_NO_FATAL_FAILURE({ SUCCEED(); });
}
} // namespace
......@@ -112,6 +112,36 @@ TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) {
// ManyAsserts() in many threads here.
}
TEST(NoFatalFailureTest, ExpectNoFatalFailureIgnoresFailuresInOtherThreads) {
// TODO(mheule@google.com): Test this works correctly when Google
// Test is made thread-safe.
}
TEST(NoFatalFailureTest, AssertNoFatalFailureIgnoresFailuresInOtherThreads) {
// TODO(mheule@google.com): Test this works correctly when Google
// Test is made thread-safe.
}
TEST(FatalFailureTest, ExpectFatalFailureIgnoresFailuresInOtherThreads) {
// TODO(mheule@google.com): Test this works correctly when Google
// Test is made thread-safe.
}
TEST(FatalFailureOnAllThreadsTest, ExpectFatalFailureOnAllThreads) {
// TODO(wan@google.com): Test this works correctly when Google Test
// is made thread-safe.
}
TEST(NonFatalFailureTest, ExpectNonFatalFailureIgnoresFailuresInOtherThreads) {
// TODO(mheule@google.com): Test this works correctly when Google
// Test is made thread-safe.
}
TEST(NonFatalFailureOnAllThreadsTest, ExpectNonFatalFailureOnAllThreads) {
// TODO(wan@google.com): Test this works correctly when Google Test
// is made thread-safe.
}
} // namespace
} // namespace testing
......
......@@ -46,11 +46,14 @@
#include <stdlib.h>
#if GTEST_HAS_PTHREAD
#include <pthread.h>
#endif // GTEST_HAS_PTHREAD
#ifdef GTEST_OS_LINUX
#include <string.h>
#include <signal.h>
#include <sys/stat.h>
#include <pthread.h>
#include <unistd.h>
#include <string>
#include <vector>
......@@ -68,8 +71,8 @@ using testing::internal::ParseInt32Flag;
namespace testing {
GTEST_DECLARE_string(output);
GTEST_DECLARE_string(color);
GTEST_DECLARE_string_(output);
GTEST_DECLARE_string_(color);
namespace internal {
bool ShouldUseColor(bool stdout_is_tty);
......@@ -114,6 +117,7 @@ using testing::internal::StreamableToString;
using testing::internal::String;
using testing::internal::TestProperty;
using testing::internal::TestResult;
using testing::internal::ThreadLocal;
using testing::internal::UnitTestImpl;
using testing::internal::WideStringToUtf8;
......@@ -142,31 +146,31 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {
EXPECT_STREQ("-3", FormatTimeInMillisAsSeconds(-3000));
}
#ifndef __SYMBIAN32__
#ifndef GTEST_OS_SYMBIAN
// NULL testing does not work with Symbian compilers.
// Tests that GTEST_IS_NULL_LITERAL(x) is true when x is a null
// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
// pointer literal.
TEST(NullLiteralTest, IsTrueForNullLiterals) {
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(NULL));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(0));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(1 - 1));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(0U));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(0L));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(false));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(true && false));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(NULL));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(false));
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(true && false));
}
// Tests that GTEST_IS_NULL_LITERAL(x) is false when x is not a null
// Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null
// pointer literal.
TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
EXPECT_FALSE(GTEST_IS_NULL_LITERAL(1));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL(0.0));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL('a'));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL(static_cast<void*>(NULL)));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(1));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(0.0));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_('a'));
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));
}
#endif // __SYMBIAN32__
#endif // GTEST_OS_SYMBIAN
//
// Tests CodePointToUtf8().
......@@ -662,127 +666,160 @@ TEST(TestPropertyTest, ReplaceStringValue) {
EXPECT_STREQ("2", property.value());
}
// Tests the TestPartResult class.
// The test fixture for testing TestPartResult.
class TestPartResultTest : public Test {
class ScopedFakeTestPartResultReporterTest : public Test {
protected:
TestPartResultTest()
: r1_(TPRT_SUCCESS, "foo/bar.cc", 10, "Success!"),
r2_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure!"),
r3_(TPRT_FATAL_FAILURE, NULL, -1, "Failure!") {}
TestPartResult r1_, r2_, r3_;
enum FailureMode {
FATAL_FAILURE,
NONFATAL_FAILURE
};
static void AddFailure(FailureMode failure) {
if (failure == FATAL_FAILURE) {
FAIL() << "Expected fatal failure.";
} else {
ADD_FAILURE() << "Expected non-fatal failure.";
}
}
};
// Tests TestPartResult::type()
TEST_F(TestPartResultTest, type) {
EXPECT_EQ(TPRT_SUCCESS, r1_.type());
EXPECT_EQ(TPRT_NONFATAL_FAILURE, r2_.type());
EXPECT_EQ(TPRT_FATAL_FAILURE, r3_.type());
}
// Tests that ScopedFakeTestPartResultReporter intercepts test
// failures.
TEST_F(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {
TestPartResultArray results;
{
ScopedFakeTestPartResultReporter reporter(
ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
&results);
AddFailure(NONFATAL_FAILURE);
AddFailure(FATAL_FAILURE);
}
// Tests TestPartResult::file_name()
TEST_F(TestPartResultTest, file_name) {
EXPECT_STREQ("foo/bar.cc", r1_.file_name());
EXPECT_STREQ(NULL, r3_.file_name());
EXPECT_EQ(2, results.size());
EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());
EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
}
// Tests TestPartResult::line_number()
TEST_F(TestPartResultTest, line_number) {
EXPECT_EQ(10, r1_.line_number());
EXPECT_EQ(-1, r2_.line_number());
TEST_F(ScopedFakeTestPartResultReporterTest, DeprecatedConstructor) {
TestPartResultArray results;
{
// Tests, that the deprecated constructor still works.
ScopedFakeTestPartResultReporter reporter(&results);
AddFailure(NONFATAL_FAILURE);
}
EXPECT_EQ(1, results.size());
}
// Tests TestPartResult::message()
TEST_F(TestPartResultTest, message) {
EXPECT_STREQ("Success!", r1_.message());
#if GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
class ScopedFakeTestPartResultReporterWithThreadsTest
: public ScopedFakeTestPartResultReporterTest {
protected:
static void AddFailureInOtherThread(FailureMode failure) {
pthread_t tid;
pthread_create(&tid,
NULL,
ScopedFakeTestPartResultReporterWithThreadsTest::
FailureThread,
&failure);
pthread_join(tid, NULL);
}
private:
static void* FailureThread(void* attr) {
FailureMode* failure = static_cast<FailureMode*>(attr);
AddFailure(*failure);
return NULL;
}
};
TEST_F(ScopedFakeTestPartResultReporterWithThreadsTest,
InterceptsTestFailuresInAllThreads) {
TestPartResultArray results;
{
ScopedFakeTestPartResultReporter reporter(
ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, &results);
AddFailure(NONFATAL_FAILURE);
AddFailure(FATAL_FAILURE);
AddFailureInOtherThread(NONFATAL_FAILURE);
AddFailureInOtherThread(FATAL_FAILURE);
}
EXPECT_EQ(4, results.size());
EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());
EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
EXPECT_TRUE(results.GetTestPartResult(2).nonfatally_failed());
EXPECT_TRUE(results.GetTestPartResult(3).fatally_failed());
}
// Tests TestPartResult::passed()
TEST_F(TestPartResultTest, Passed) {
EXPECT_TRUE(r1_.passed());
EXPECT_FALSE(r2_.passed());
EXPECT_FALSE(r3_.passed());
#endif // GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
// Tests EXPECT_{,NON}FATAL_FAILURE{,ON_ALL_THREADS}.
typedef ScopedFakeTestPartResultReporterTest ExpectFailureTest;
TEST_F(ExpectFailureTest, ExpectFatalFaliure) {
EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
}
// Tests TestPartResult::failed()
TEST_F(TestPartResultTest, Failed) {
EXPECT_FALSE(r1_.failed());
EXPECT_TRUE(r2_.failed());
EXPECT_TRUE(r3_.failed());
TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE),
"Expected non-fatal failure.");
}
// Tests TestPartResult::fatally_failed()
TEST_F(TestPartResultTest, FatallyFailed) {
EXPECT_FALSE(r1_.fatally_failed());
EXPECT_FALSE(r2_.fatally_failed());
EXPECT_TRUE(r3_.fatally_failed());
TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
"Expected fatal failure.");
}
// Tests TestPartResult::nonfatally_failed()
TEST_F(TestPartResultTest, NonfatallyFailed) {
EXPECT_FALSE(r1_.nonfatally_failed());
EXPECT_TRUE(r2_.nonfatally_failed());
EXPECT_FALSE(r3_.nonfatally_failed());
TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
"Expected non-fatal failure.");
}
// Tests the TestPartResultArray class.
// Tests that the EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS} accepts
// a statement that contains a macro which expands to code containing
// an unprotected comma.
class TestPartResultArrayTest : public Test {
protected:
TestPartResultArrayTest()
: r1_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure 1"),
r2_(TPRT_FATAL_FAILURE, "foo/bar.cc", -1, "Failure 2") {}
static int global_var = 0;
#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++
const TestPartResult r1_, r2_;
};
TEST_F(ExpectFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
EXPECT_FATAL_FAILURE({
GTEST_USE_UNPROTECTED_COMMA_;
AddFailure(FATAL_FAILURE);
}, "");
// Tests that TestPartResultArray initially has size 0.
TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
TestPartResultArray results;
EXPECT_EQ(0, results.size());
}
EXPECT_FATAL_FAILURE_ON_ALL_THREADS({
GTEST_USE_UNPROTECTED_COMMA_;
AddFailure(FATAL_FAILURE);
}, "");
// Tests that TestPartResultArray contains the given TestPartResult
// after one Append() operation.
TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
TestPartResultArray results;
results.Append(r1_);
EXPECT_EQ(1, results.size());
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
}
EXPECT_NONFATAL_FAILURE({
GTEST_USE_UNPROTECTED_COMMA_;
AddFailure(NONFATAL_FAILURE);
}, "");
// Tests that TestPartResultArray contains the given TestPartResults
// after two Append() operations.
TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
TestPartResultArray results;
results.Append(r1_);
results.Append(r2_);
EXPECT_EQ(2, results.size());
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS({
GTEST_USE_UNPROTECTED_COMMA_;
AddFailure(NONFATAL_FAILURE);
}, "");
}
void ScopedFakeTestPartResultReporterTestHelper() {
FAIL() << "Expected fatal failure.";
}
#if GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
// Tests that ScopedFakeTestPartResultReporter intercepts test
// failures.
TEST(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {
TestPartResultArray results;
{
ScopedFakeTestPartResultReporter reporter(&results);
ADD_FAILURE() << "Expected non-fatal failure.";
ScopedFakeTestPartResultReporterTestHelper();
}
typedef ScopedFakeTestPartResultReporterWithThreadsTest
ExpectFailureWithThreadsTest;
EXPECT_EQ(2, results.size());
EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());
EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailureOnAllThreads) {
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailureInOtherThread(FATAL_FAILURE),
"Expected fatal failure.");
}
TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailureOnAllThreads) {
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(
AddFailureInOtherThread(NONFATAL_FAILURE), "Expected non-fatal failure.");
}
#endif // GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
// Tests the TestResult class
// The test fixture for testing TestResult.
......@@ -1875,6 +1912,8 @@ TEST_F(FloatTest, LargeDiff) {
TEST_F(FloatTest, Infinity) {
EXPECT_FLOAT_EQ(infinity_, close_to_infinity_);
EXPECT_FLOAT_EQ(-infinity_, -close_to_infinity_);
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, -infinity_),
"-infinity_");
......@@ -1882,10 +1921,13 @@ TEST_F(FloatTest, Infinity) {
// are only 1 DLP apart.
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, nan1_),
"nan1_");
#endif // ! GTEST_OS_SYMBIAN
}
// Tests that comparing with NAN always returns false.
TEST_F(FloatTest, NaN) {
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan1_),
"nan1_");
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan2_),
......@@ -1895,6 +1937,7 @@ TEST_F(FloatTest, NaN) {
EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(nan1_, infinity_),
"infinity_");
#endif // ! GTEST_OS_SYMBIAN
}
// Tests that *_FLOAT_EQ are reflexive.
......@@ -1956,6 +1999,8 @@ TEST_F(FloatTest, FloatLEFails) {
EXPECT_PRED_FORMAT2(FloatLE, further_from_one_, 1.0f);
}, "(further_from_one_) <= (1.0f)");
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
// or when either val1 or val2 is NaN.
EXPECT_NONFATAL_FAILURE({ // NOLINT
EXPECT_PRED_FORMAT2(FloatLE, nan1_, infinity_);
......@@ -1967,6 +2012,7 @@ TEST_F(FloatTest, FloatLEFails) {
EXPECT_FATAL_FAILURE({ // NOLINT
ASSERT_PRED_FORMAT2(FloatLE, nan1_, nan1_);
}, "(nan1_) <= (nan1_)");
#endif // ! GTEST_OS_SYMBIAN
}
// Instantiates FloatingPointTest for testing *_DOUBLE_EQ.
......@@ -2021,6 +2067,8 @@ TEST_F(DoubleTest, LargeDiff) {
TEST_F(DoubleTest, Infinity) {
EXPECT_DOUBLE_EQ(infinity_, close_to_infinity_);
EXPECT_DOUBLE_EQ(-infinity_, -close_to_infinity_);
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, -infinity_),
"-infinity_");
......@@ -2028,22 +2076,29 @@ TEST_F(DoubleTest, Infinity) {
// are only 1 DLP apart.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, nan1_),
"nan1_");
#endif // ! GTEST_OS_SYMBIAN
}
// Tests that comparing with NAN always returns false.
TEST_F(DoubleTest, NaN) {
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan1_),
"nan1_");
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan2_), "nan2_");
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, nan1_), "nan1_");
EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(nan1_, infinity_), "infinity_");
#endif // ! GTEST_OS_SYMBIAN
}
// Tests that *_DOUBLE_EQ are reflexive.
TEST_F(DoubleTest, Reflexive) {
EXPECT_DOUBLE_EQ(0.0, 0.0);
EXPECT_DOUBLE_EQ(1.0, 1.0);
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
ASSERT_DOUBLE_EQ(infinity_, infinity_);
#endif // ! GTEST_OS_SYMBIAN
}
// Tests that *_DOUBLE_EQ are commutative.
......@@ -2059,38 +2114,22 @@ TEST_F(DoubleTest, Commutative) {
TEST_F(DoubleTest, EXPECT_NEAR) {
EXPECT_NEAR(-1.0, -1.1, 0.2);
EXPECT_NEAR(2.0, 3.0, 1.0);
#ifdef __SYMBIAN32__
// Symbian STLport has currently a buggy floating point output.
// TODO(mikie): fix STLport.
EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.2, 0.1), // NOLINT
"The difference between 1.0 and 1.2 is 0.19999:, "
"which exceeds 0.1");
#else // !__SYMBIAN32__
EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.2, 0.1), // NOLINT
"The difference between 1.0 and 1.2 is 0.2, "
"which exceeds 0.1");
// To work around a bug in gcc 2.95.0, there is intentionally no
// space after the first comma in the previous statement.
#endif // __SYMBIAN32__
}
// Tests ASSERT_NEAR.
TEST_F(DoubleTest, ASSERT_NEAR) {
ASSERT_NEAR(-1.0, -1.1, 0.2);
ASSERT_NEAR(2.0, 3.0, 1.0);
#ifdef __SYMBIAN32__
// Symbian STLport has currently a buggy floating point output.
// TODO(mikie): fix STLport.
EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.2, 0.1), // NOLINT
"The difference between 1.0 and 1.2 is 0.19999:, "
"which exceeds 0.1");
#else // ! __SYMBIAN32__
EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.2, 0.1), // NOLINT
"The difference between 1.0 and 1.2 is 0.2, "
"which exceeds 0.1");
// To work around a bug in gcc 2.95.0, there is intentionally no
// space after the first comma in the previous statement.
#endif // __SYMBIAN32__
}
// Tests the cases where DoubleLE() should succeed.
......@@ -2113,6 +2152,8 @@ TEST_F(DoubleTest, DoubleLEFails) {
EXPECT_PRED_FORMAT2(DoubleLE, further_from_one_, 1.0);
}, "(further_from_one_) <= (1.0)");
#ifndef GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
// or when either val1 or val2 is NaN.
EXPECT_NONFATAL_FAILURE({ // NOLINT
EXPECT_PRED_FORMAT2(DoubleLE, nan1_, infinity_);
......@@ -2123,6 +2164,7 @@ TEST_F(DoubleTest, DoubleLEFails) {
EXPECT_FATAL_FAILURE({ // NOLINT
ASSERT_PRED_FORMAT2(DoubleLE, nan1_, nan1_);
}, "(nan1_) <= (nan1_)");
#endif // ! GTEST_OS_SYMBIAN
}
......@@ -2389,6 +2431,97 @@ TEST_F(SingleEvaluationTest, ExceptionTests) {
#endif // GTEST_HAS_EXCEPTIONS
// Tests {ASSERT|EXPECT}_NO_FATAL_FAILURE.
class NoFatalFailureTest : public Test {
protected:
void Succeeds() {}
void FailsNonFatal() {
ADD_FAILURE() << "some non-fatal failure";
}
void Fails() {
FAIL() << "some fatal failure";
}
void DoAssertNoFatalFailureOnFails() {
ASSERT_NO_FATAL_FAILURE(Fails());
ADD_FAILURE() << "shold not reach here.";
}
void DoExpectNoFatalFailureOnFails() {
EXPECT_NO_FATAL_FAILURE(Fails());
ADD_FAILURE() << "other failure";
}
};
TEST_F(NoFatalFailureTest, NoFailure) {
EXPECT_NO_FATAL_FAILURE(Succeeds());
ASSERT_NO_FATAL_FAILURE(Succeeds());
}
TEST_F(NoFatalFailureTest, NonFatalIsNoFailure) {
EXPECT_NONFATAL_FAILURE(
EXPECT_NO_FATAL_FAILURE(FailsNonFatal()),
"some non-fatal failure");
EXPECT_NONFATAL_FAILURE(
ASSERT_NO_FATAL_FAILURE(FailsNonFatal()),
"some non-fatal failure");
}
TEST_F(NoFatalFailureTest, AssertNoFatalFailureOnFatalFailure) {
TestPartResultArray gtest_failures;
{
ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);
DoAssertNoFatalFailureOnFails();
}
ASSERT_EQ(2, gtest_failures.size());
EXPECT_EQ(testing::TPRT_FATAL_FAILURE,
gtest_failures.GetTestPartResult(0).type());
EXPECT_EQ(testing::TPRT_FATAL_FAILURE,
gtest_failures.GetTestPartResult(1).type());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "some fatal failure",
gtest_failures.GetTestPartResult(0).message());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "it does",
gtest_failures.GetTestPartResult(1).message());
}
TEST_F(NoFatalFailureTest, ExpectNoFatalFailureOnFatalFailure) {
TestPartResultArray gtest_failures;
{
ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);
DoExpectNoFatalFailureOnFails();
}
ASSERT_EQ(3, gtest_failures.size());
EXPECT_EQ(testing::TPRT_FATAL_FAILURE,
gtest_failures.GetTestPartResult(0).type());
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
gtest_failures.GetTestPartResult(1).type());
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
gtest_failures.GetTestPartResult(2).type());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "some fatal failure",
gtest_failures.GetTestPartResult(0).message());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "it does",
gtest_failures.GetTestPartResult(1).message());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "other failure",
gtest_failures.GetTestPartResult(2).message());
}
TEST_F(NoFatalFailureTest, MessageIsStreamable) {
TestPartResultArray gtest_failures;
{
ScopedFakeTestPartResultReporter gtest_reporter(&gtest_failures);
EXPECT_NO_FATAL_FAILURE(FAIL() << "foo") << "my message";
}
ASSERT_EQ(2, gtest_failures.size());
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
gtest_failures.GetTestPartResult(0).type());
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
gtest_failures.GetTestPartResult(1).type());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "foo",
gtest_failures.GetTestPartResult(0).message());
EXPECT_PRED_FORMAT2(testing::IsSubstring, "my message",
gtest_failures.GetTestPartResult(1).message());
}
// Tests non-string assertions.
// Tests EqFailure(), used for implementing *EQ* assertions.
......@@ -2492,7 +2625,7 @@ TEST(AssertionTest, ASSERT_EQ) {
}
// Tests ASSERT_EQ(NULL, pointer).
#ifndef __SYMBIAN32__
#ifndef GTEST_OS_SYMBIAN
// The NULL-detection template magic fails to compile with
// the Nokia compiler and crashes the ARM compiler, hence
// not testing on Symbian.
......@@ -2506,7 +2639,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) {
EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
"Value of: &n\n");
}
#endif // __SYMBIAN32__
#endif // GTEST_OS_SYMBIAN
// Tests ASSERT_EQ(0, non_pointer). Since the literal 0 can be
// treated as a null pointer by the compiler, we need to make sure
......@@ -2807,7 +2940,7 @@ TEST(HRESULTAssertionTest, Streaming) {
#endif // defined(GTEST_OS_WINDOWS)
// Tests that the assertion macros behave like single statements.
TEST(AssertionSyntaxTest, BehavesLikeSingleStatement) {
TEST(AssertionSyntaxTest, BasicAssertionsBehavesLikeSingleStatement) {
if (false)
ASSERT_TRUE(false) << "This should never be executed; "
"It's a compilation test only.";
......@@ -2824,8 +2957,10 @@ TEST(AssertionSyntaxTest, BehavesLikeSingleStatement) {
;
else
EXPECT_GT(3, 2) << "";
}
#if GTEST_HAS_EXCEPTIONS
TEST(AssertionSyntaxTest, ExceptionAssertionsBehavesLikeSingleStatement) {
if (false)
EXPECT_THROW(1, bool);
......@@ -2849,7 +2984,30 @@ TEST(AssertionSyntaxTest, BehavesLikeSingleStatement) {
EXPECT_ANY_THROW(ThrowAnInteger());
else
;
}
#endif // GTEST_HAS_EXCEPTIONS
TEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {
if (false)
EXPECT_NO_FATAL_FAILURE(FAIL()) << "This should never be executed. "
<< "It's a compilation test only.";
else
;
if (false)
ASSERT_NO_FATAL_FAILURE(FAIL()) << "";
else
;
if (true)
EXPECT_NO_FATAL_FAILURE(SUCCEED());
else
;
if (false)
;
else
ASSERT_NO_FATAL_FAILURE(SUCCEED());
}
// Tests that the assertion macros work well with switch statements.
......@@ -2984,7 +3142,7 @@ TEST(ExpectTest, EXPECT_EQ_Double) {
"5.1");
}
#ifndef __SYMBIAN32__
#ifndef GTEST_OS_SYMBIAN
// Tests EXPECT_EQ(NULL, pointer).
TEST(ExpectTest, EXPECT_EQ_NULL) {
// A success.
......@@ -2996,7 +3154,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
"Value of: &n\n");
}
#endif // __SYMBIAN32__
#endif // GTEST_OS_SYMBIAN
// Tests EXPECT_EQ(0, non_pointer). Since the literal 0 can be
// treated as a null pointer by the compiler, we need to make sure
......@@ -4739,7 +4897,24 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
#endif // GTEST_OS_WINDOWS
}
#ifndef __SYMBIAN32__
TEST(ThreadLocalTest, DefaultConstructor) {
ThreadLocal<int> t1;
EXPECT_EQ(0, t1.get());
ThreadLocal<void*> t2;
EXPECT_TRUE(t2.get() == NULL);
}
TEST(ThreadLocalTest, Init) {
ThreadLocal<int> t1(123);
EXPECT_EQ(123, t1.get());
int i = 0;
ThreadLocal<int*> t2(&i);
EXPECT_EQ(&i, t2.get());
}
#ifndef GTEST_OS_SYMBIAN
// We will want to integrate running the unittests to a different
// main application on Symbian.
int main(int argc, char** argv) {
......@@ -4756,4 +4931,4 @@ int main(int argc, char** argv) {
// Runs all tests using Google Test.
return RUN_ALL_TESTS();
}
#endif // __SYMBIAN32_
#endif // GTEST_OS_SYMBIAN
......@@ -24,7 +24,9 @@ test_executables=("$BUILT_PRODUCTS_DIR/sample1_unittest"
"$BUILT_PRODUCTS_DIR/gtest_main_unittest"
"$BUILT_PRODUCTS_DIR/gtest_prod_test"
"$BUILT_PRODUCTS_DIR/gtest_repeat_test"
"$BUILT_PRODUCTS_DIR/gtest_sole_header_test"
"$BUILT_PRODUCTS_DIR/gtest_stress_test"
"$BUILT_PRODUCTS_DIR/gtest_test_part_test"
"$BUILT_PRODUCTS_DIR/gtest-typed-test_test"
"$BUILT_PRODUCTS_DIR/gtest_output_test.py"
......@@ -41,6 +43,7 @@ test_executables=("$BUILT_PRODUCTS_DIR/sample1_unittest"
# Now execute each one in turn keeping track of how many succeeded and failed.
succeeded=0
failed=0
failed_list=()
for test in ${test_executables[*]}; do
"$test"
result=$?
......@@ -48,9 +51,14 @@ for test in ${test_executables[*]}; do
succeeded=$(( $succeeded + 1 ))
else
failed=$(( failed + 1 ))
failed_list="$failed_list $test"
fi
done
# Report the successes and failures to the console
echo "Tests complete with $succeeded successes and $failed failures."
if [ $failed -ne 0 ]; then
echo "The following tests failed:"
echo $failed_list
fi
exit $failed
......@@ -38,7 +38,9 @@
3B238F8F0E828B7100846E11 /* PBXTargetDependency */,
3B238F910E828B7100846E11 /* PBXTargetDependency */,
3B238F930E828B7100846E11 /* PBXTargetDependency */,
22C44F370E9EB800004F2913 /* PBXTargetDependency */,
3B238F950E828B7100846E11 /* PBXTargetDependency */,
22C44F390E9EB808004F2913 /* PBXTargetDependency */,
3B238F970E828B7100846E11 /* PBXTargetDependency */,
3B238F990E828B7100846E11 /* PBXTargetDependency */,
3B238F9B0E828B7100846E11 /* PBXTargetDependency */,
......@@ -74,6 +76,11 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
222ECC950E9EB33A00BEED94 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B87D22D0E96C038000D1852 /* gtest.framework */; };
222ECCA60E9EB47B00BEED94 /* gtest-test-part_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0E0E7FE13C00846E11 /* gtest-test-part_test.cc */; };
222ECCA80E9EB47B00BEED94 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B87D22D0E96C038000D1852 /* gtest.framework */; };
224A12A00E9EAD8F00BD17FD /* gtest-test-part.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A129F0E9EAD8F00BD17FD /* gtest-test-part.cc */; };
224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */ = {isa = PBXBuildFile; fileRef = 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */; settings = {ATTRIBUTES = (Public, ); }; };
22A865FD0E70A35700F7AE6E /* gtest-typed-test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22A865FC0E70A35700F7AE6E /* gtest-typed-test.cc */; };
22A866190E70A41000F7AE6E /* sample6_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22A866180E70A41000F7AE6E /* sample6_unittest.cc */; };
3B238D1D0E8283EA00846E11 /* gtest-death-test_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238BF10E7FE13B00846E11 /* gtest-death-test_test.cc */; };
......@@ -94,7 +101,6 @@
3B238F500E828B0000846E11 /* gtest_pred_impl_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */; };
3B238F510E828B0400846E11 /* gtest_prod_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */; };
3B238F520E828B0800846E11 /* gtest_repeat_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */; };
3B238F530E828B0D00846E11 /* gtest_stress_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0E0E7FE13C00846E11 /* gtest_stress_test.cc */; };
3B238F540E828B1700846E11 /* gtest_uninitialized_test_.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */; };
3B238F550E828B1F00846E11 /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };
3B238F560E828B2400846E11 /* gtest_xml_outfile1_test_.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C130E7FE13C00846E11 /* gtest_xml_outfile1_test_.cc */; };
......@@ -163,8 +169,6 @@
4048860C0E2F840E00CF7658 /* sample5_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 404884030E2F799B00CF7658 /* sample5_unittest.cc */; };
404886140E2F849100CF7658 /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 404883F80E2F799B00CF7658 /* sample1.cc */; };
406B542C0E9CD54B0041F37C /* gtest_xml_outfiles_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C150E7FE13C00846E11 /* gtest_xml_outfiles_test.py */; };
408453E00E96CE0800AC66C2 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 408453CD0E96CE0700AC66C2 /* gtest.framework */; };
408453E20E96CE0800AC66C2 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 408453CD0E96CE0700AC66C2 /* gtest.framework */; };
4084541B0E96D2A100AC66C2 /* gtest_break_on_failure_unittest.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238BF80E7FE13B00846E11 /* gtest_break_on_failure_unittest.py */; };
408454350E96D3F600AC66C2 /* gtest_test_utils.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */; };
408454740E96DBC300AC66C2 /* gtest_output_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C070E7FE13B00846E11 /* gtest_output_test.py */; };
......@@ -178,9 +182,25 @@
4084548A0E96DD8200AC66C2 /* gtest_nc_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C050E7FE13B00846E11 /* gtest_nc_test.py */; };
4084548F0E97066B00AC66C2 /* gtest_xml_test_utils.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C180E7FE13C00846E11 /* gtest_xml_test_utils.py */; };
408454BC0E97098200AC66C2 /* gtest-typed-test2_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238BF50E7FE13B00846E11 /* gtest-typed-test2_test.cc */; };
40D2095B0E9FFBE500191629 /* gtest_sole_header_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 40D209590E9FFBAA00191629 /* gtest_sole_header_test.cc */; };
40D2095C0E9FFC0700191629 /* gtest_stress_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 40D2095A0E9FFBAA00191629 /* gtest_stress_test.cc */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
222ECC910E9EB33A00BEED94 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
remoteInfo = gtest;
};
222ECCA40E9EB47B00BEED94 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
remoteInfo = gtest;
};
22A866030E70A39900F7AE6E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
......@@ -188,6 +208,20 @@
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
remoteInfo = gtest;
};
22C44F360E9EB800004F2913 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 222ECC8F0E9EB33A00BEED94;
remoteInfo = gtest_sole_header_test;
};
22C44F380E9EB808004F2913 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 222ECCA20E9EB47B00BEED94;
remoteInfo = gtest_test_part_test;
};
3B238C980E81B92000846E11 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
......@@ -605,14 +639,14 @@
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3B238E920E82894A00846E11 /* gtest_no_test_unittest */;
remoteGlobalIDString = 3B238E920E82894A00846E11;
remoteInfo = gtest_no_test_unittest;
};
406B54280E9CD4D70041F37C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3B238F0A0E828A3800846E11 /* gtest_xml_outfile1_test_ */;
remoteGlobalIDString = 3B238F0A0E828A3800846E11;
remoteInfo = gtest_xml_outfile1_test_;
};
408454360E96D40600AC66C2 /* PBXContainerItemProxy */ = {
......@@ -833,6 +867,11 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
222ECC990E9EB33A00BEED94 /* gtest_sole_header_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gtest_sole_header_test; sourceTree = BUILT_PRODUCTS_DIR; };
222ECCAC0E9EB47B00BEED94 /* gtest_test_part_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gtest_test_part_test; sourceTree = BUILT_PRODUCTS_DIR; };
224A129F0E9EAD8F00BD17FD /* gtest-test-part.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-test-part.cc"; sourceTree = "<group>"; };
224A12A10E9EADA700BD17FD /* gtest-all.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-all.cc"; sourceTree = "<group>"; };
224A12A20E9EADCC00BD17FD /* gtest-test-part.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "gtest-test-part.h"; sourceTree = "<group>"; };
22A865FC0E70A35700F7AE6E /* gtest-typed-test.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-typed-test.cc"; sourceTree = "<group>"; };
22A866180E70A41000F7AE6E /* sample6_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = sample6_unittest.cc; sourceTree = "<group>"; };
3B238BF10E7FE13B00846E11 /* gtest-death-test_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-death-test_test.cc"; sourceTree = "<group>"; };
......@@ -864,7 +903,7 @@
3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_pred_impl_unittest.cc; sourceTree = "<group>"; };
3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_prod_test.cc; sourceTree = "<group>"; };
3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_repeat_test.cc; sourceTree = "<group>"; };
3B238C0E0E7FE13C00846E11 /* gtest_stress_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_stress_test.cc; sourceTree = "<group>"; };
3B238C0E0E7FE13C00846E11 /* gtest-test-part_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-test-part_test.cc"; sourceTree = "<group>"; };
3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gtest_test_utils.py; sourceTree = "<group>"; };
3B238C100E7FE13C00846E11 /* gtest_uninitialized_test.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gtest_uninitialized_test.py; sourceTree = "<group>"; };
3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_uninitialized_test_.cc; sourceTree = "<group>"; };
......@@ -947,7 +986,9 @@
404884A90E2F7CD900CF7658 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CHANGES; path = ../CHANGES; sourceTree = SOURCE_ROOT; };
404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CONTRIBUTORS; path = ../CONTRIBUTORS; sourceTree = SOURCE_ROOT; };
404884AB0E2F7CD900CF7658 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = SOURCE_ROOT; };
408453CD0E96CE0700AC66C2 /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = gtest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
408453CD0E96CE0700AC66C2 /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = gtest.framework; path = /Volumes/Work/Repository/perforce/gtest/src/depot/branches/open_gtest_branch/google3/third_party/gtest/xcode/build/Debug/gtest.framework; sourceTree = "<absolute>"; };
40D209590E9FFBAA00191629 /* gtest_sole_header_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_sole_header_test.cc; sourceTree = "<group>"; };
40D2095A0E9FFBAA00191629 /* gtest_stress_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_stress_test.cc; sourceTree = "<group>"; };
40D4CDF10E30E07400294801 /* DebugProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugProject.xcconfig; sourceTree = "<group>"; };
40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FrameworkTarget.xcconfig; sourceTree = "<group>"; };
40D4CDF30E30E07400294801 /* General.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = "<group>"; };
......@@ -956,6 +997,22 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
222ECC940E9EB33A00BEED94 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
222ECC950E9EB33A00BEED94 /* gtest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
222ECCA70E9EB47B00BEED94 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
222ECCA80E9EB47B00BEED94 /* gtest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
22A866070E70A39900F7AE6E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
......@@ -1057,7 +1114,6 @@
buildActionMask = 2147483647;
files = (
3B87D25E0E96C038000D1852 /* gtest.framework in Frameworks */,
408453E00E96CE0800AC66C2 /* gtest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1074,7 +1130,6 @@
buildActionMask = 2147483647;
files = (
3B87D2580E96C038000D1852 /* gtest.framework in Frameworks */,
408453E20E96CE0800AC66C2 /* gtest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1209,12 +1264,16 @@
3B87D2320E96C038000D1852 /* sample3_unittest */,
3B87D2350E96C038000D1852 /* sample2_unittest */,
3B87D2380E96C038000D1852 /* sample4_unittest */,
3B87D2800E96C039000D1852 /* sample5_unittest */,
3B87D2830E96C039000D1852 /* sample6_unittest */,
3B87D23B0E96C038000D1852 /* gtest_xml_output_unittest_ */,
3B87D23E0E96C038000D1852 /* gtest_xml_outfile2_test_ */,
3B87D2410E96C038000D1852 /* gtest_xml_outfile1_test_ */,
3B87D2440E96C038000D1852 /* gtest_unittest */,
3B87D2470E96C038000D1852 /* gtest_uninitialized_test_ */,
222ECC990E9EB33A00BEED94 /* gtest_sole_header_test */,
3B87D24A0E96C038000D1852 /* gtest_stress_test */,
222ECCAC0E9EB47B00BEED94 /* gtest_test_part_test */,
3B87D24D0E96C038000D1852 /* gtest_repeat_test */,
3B87D2500E96C038000D1852 /* gtest_prod_test */,
3B87D2530E96C038000D1852 /* gtest_pred_impl_unittest */,
......@@ -1231,11 +1290,8 @@
3B87D2740E96C039000D1852 /* gtest-typed-test_test */,
3B87D27A0E96C039000D1852 /* gtest-options_test */,
3B87D27D0E96C039000D1852 /* gtest-message_test */,
3B87D2800E96C039000D1852 /* sample5_unittest */,
3B87D2830E96C039000D1852 /* sample6_unittest */,
3B87D2860E96C039000D1852 /* gtest-death-test_test */,
3B87D2890E96C039000D1852 /* gtest-filepath_test */,
408453CD0E96CE0700AC66C2 /* gtest.framework */,
);
name = Products;
sourceTree = "<group>";
......@@ -1299,7 +1355,9 @@
3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */,
3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */,
3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */,
3B238C0E0E7FE13C00846E11 /* gtest_stress_test.cc */,
40D209590E9FFBAA00191629 /* gtest_sole_header_test.cc */,
40D2095A0E9FFBAA00191629 /* gtest_stress_test.cc */,
3B238C0E0E7FE13C00846E11 /* gtest-test-part_test.cc */,
3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */,
3B238C100E7FE13C00846E11 /* gtest_uninitialized_test.py */,
3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */,
......@@ -1338,6 +1396,7 @@
404883DA0E2F799B00CF7658 /* gtest */ = {
isa = PBXGroup;
children = (
224A12A20E9EADCC00BD17FD /* gtest-test-part.h */,
404883DB0E2F799B00CF7658 /* gtest-death-test.h */,
404883DC0E2F799B00CF7658 /* gtest-message.h */,
404883DD0E2F799B00CF7658 /* gtest-spi.h */,
......@@ -1387,6 +1446,8 @@
404884070E2F799B00CF7658 /* src */ = {
isa = PBXGroup;
children = (
224A12A10E9EADA700BD17FD /* gtest-all.cc */,
224A129F0E9EAD8F00BD17FD /* gtest-test-part.cc */,
404884080E2F799B00CF7658 /* gtest-death-test.cc */,
404884090E2F799B00CF7658 /* gtest-filepath.cc */,
4048840A0E2F799B00CF7658 /* gtest-internal-inl.h */,
......@@ -1434,12 +1495,47 @@
4048843B0E2F799B00CF7658 /* gtest.h in Headers */,
4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */,
4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */,
224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
222ECC8F0E9EB33A00BEED94 /* gtest_sole_header_test */ = {
isa = PBXNativeTarget;
buildConfigurationList = 222ECC960E9EB33A00BEED94 /* Build configuration list for PBXNativeTarget "gtest_sole_header_test" */;
buildPhases = (
222ECC920E9EB33A00BEED94 /* Sources */,
222ECC940E9EB33A00BEED94 /* Frameworks */,
);
buildRules = (
);
dependencies = (
222ECC900E9EB33A00BEED94 /* PBXTargetDependency */,
);
name = gtest_sole_header_test;
productName = TypedTest2;
productReference = 222ECC990E9EB33A00BEED94 /* gtest_sole_header_test */;
productType = "com.apple.product-type.tool";
};
222ECCA20E9EB47B00BEED94 /* gtest_test_part_test */ = {
isa = PBXNativeTarget;
buildConfigurationList = 222ECCA90E9EB47B00BEED94 /* Build configuration list for PBXNativeTarget "gtest_test_part_test" */;
buildPhases = (
222ECCA50E9EB47B00BEED94 /* Sources */,
222ECCA70E9EB47B00BEED94 /* Frameworks */,
);
buildRules = (
);
dependencies = (
222ECCA30E9EB47B00BEED94 /* PBXTargetDependency */,
);
name = gtest_test_part_test;
productName = TypedTest2;
productReference = 222ECCAC0E9EB47B00BEED94 /* gtest_test_part_test */;
productType = "com.apple.product-type.tool";
};
22A866010E70A39900F7AE6E /* sample6_unittest */ = {
isa = PBXNativeTarget;
buildConfigurationList = 22A866090E70A39900F7AE6E /* Build configuration list for PBXNativeTarget "sample6_unittest" */;
......@@ -2033,7 +2129,9 @@
3B238E7A0E82894300846E11 /* gtest_main_unittest */,
3B238EC30E8289C100846E11 /* gtest_prod_test */,
3B238ECE0E8289C300846E11 /* gtest_repeat_test */,
222ECC8F0E9EB33A00BEED94 /* gtest_sole_header_test */,
3B238EDB0E8289C700846E11 /* gtest_stress_test */,
222ECCA20E9EB47B00BEED94 /* gtest_test_part_test */,
3B238E0F0E82887E00846E11 /* gtest-typed-test_test */,
3B238E9F0E82894D00846E11 /* gtest_output_test_ */,
3B238E270E82888800846E11 /* gtest_color_test_ */,
......@@ -2110,6 +2208,22 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
222ECC920E9EB33A00BEED94 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
40D2095B0E9FFBE500191629 /* gtest_sole_header_test.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
222ECCA50E9EB47B00BEED94 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
222ECCA60E9EB47B00BEED94 /* gtest-test-part_test.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
22A866040E70A39900F7AE6E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
......@@ -2268,7 +2382,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3B238F530E828B0D00846E11 /* gtest_stress_test.cc in Sources */,
40D2095C0E9FFC0700191629 /* gtest_stress_test.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -2366,17 +2480,38 @@
404884630E2F799B00CF7658 /* gtest.cc in Sources */,
404884640E2F799B00CF7658 /* gtest_main.cc in Sources */,
22A865FD0E70A35700F7AE6E /* gtest-typed-test.cc in Sources */,
224A12A00E9EAD8F00BD17FD /* gtest-test-part.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
222ECC900E9EB33A00BEED94 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
targetProxy = 222ECC910E9EB33A00BEED94 /* PBXContainerItemProxy */;
};
222ECCA30E9EB47B00BEED94 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
targetProxy = 222ECCA40E9EB47B00BEED94 /* PBXContainerItemProxy */;
};
22A866020E70A39900F7AE6E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
targetProxy = 22A866030E70A39900F7AE6E /* PBXContainerItemProxy */;
};
22C44F370E9EB800004F2913 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 222ECC8F0E9EB33A00BEED94 /* gtest_sole_header_test */;
targetProxy = 22C44F360E9EB800004F2913 /* PBXContainerItemProxy */;
};
22C44F390E9EB808004F2913 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 222ECCA20E9EB47B00BEED94 /* gtest_test_part_test */;
targetProxy = 22C44F380E9EB808004F2913 /* PBXContainerItemProxy */;
};
3B238C990E81B92000846E11 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
......@@ -2745,6 +2880,62 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
222ECC970E9EB33A00BEED94 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
};
name = Debug;
};
222ECC980E9EB33A00BEED94 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
};
name = Release;
};
222ECCAA0E9EB47B00BEED94 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
};
name = Debug;
};
222ECCAB0E9EB47B00BEED94 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
};
name = Release;
};
22A8660A0E70A39900F7AE6E /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B23903C0E830EA800846E11 /* TestTarget.xcconfig */;
......@@ -3689,6 +3880,24 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
222ECC960E9EB33A00BEED94 /* Build configuration list for PBXNativeTarget "gtest_sole_header_test" */ = {
isa = XCConfigurationList;
buildConfigurations = (
222ECC970E9EB33A00BEED94 /* Debug */,
222ECC980E9EB33A00BEED94 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
222ECCA90E9EB47B00BEED94 /* Build configuration list for PBXNativeTarget "gtest_test_part_test" */ = {
isa = XCConfigurationList;
buildConfigurations = (
222ECCAA0E9EB47B00BEED94 /* Debug */,
222ECCAB0E9EB47B00BEED94 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
22A866090E70A39900F7AE6E /* Build configuration list for PBXNativeTarget "sample6_unittest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment