From c12f63214e9b7761d27e68353e4aaf1761c9cf88 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Tue, 7 Apr 2009 21:03:22 +0000 Subject: Adds sample4_unittest to scons (by Vlad Losev); adds logic for getting the thread count on Mac (by Vlad Losev); adds HasFailure() and HasNonfatalFailure() (by Zhanyong Wan). --- src/gtest.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/gtest.cc') diff --git a/src/gtest.cc b/src/gtest.cc index ac5ed9d5..5903f2ae 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -1852,7 +1852,7 @@ int TestResult::failed_part_count() const { } // Returns true iff the test part fatally failed. -static bool TestPartFatallyFailed(const TestPartResult & result) { +static bool TestPartFatallyFailed(const TestPartResult& result) { return result.fatally_failed(); } @@ -1861,6 +1861,16 @@ bool TestResult::HasFatalFailure() const { return test_part_results_.CountIf(TestPartFatallyFailed) > 0; } +// Returns true iff the test part non-fatally failed. +static bool TestPartNonfatallyFailed(const TestPartResult& result) { + return result.nonfatally_failed(); +} + +// Returns true iff the test has a non-fatal failure. +bool TestResult::HasNonfatalFailure() const { + return test_part_results_.CountIf(TestPartNonfatallyFailed) > 0; +} + // Gets the number of all test parts. This is the sum of the number // of successful test parts and the number of failed test parts. int TestResult::total_part_count() const { @@ -2059,6 +2069,12 @@ bool Test::HasFatalFailure() { return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure(); } +// Returns true iff the current test has a non-fatal failure. +bool Test::HasNonfatalFailure() { + return internal::GetUnitTestImpl()->current_test_result()-> + HasNonfatalFailure(); +} + // class TestInfo // Constructs a TestInfo object. It assumes ownership of the test factory -- cgit v1.2.3