Now that googletest has moved to C++11, it should no longer
use NULL or 0 for the null pointer. This patch converts all
such usages to nullptr using clang-tidy.
This prevents LLVM from issuing -Wzero-as-null-pointer-constant
warnings.
PiperOrigin-RevId: 215814400
Fix Clang warning:
| warning: definition of implicit copy constructor for 'ValueArray2<bool, bool>'
| is deprecated because it has a user-declared copy assignment operator [-Wdeprecated]
Add the possibility of specifying the name in type parameterized tests.
Similar to how the last parameter of INSTANTIATE_TEST_CASE_P allows to override the name for (non-type) parametrized tests, this adds the possibility of adding a parameter to INSTANTIATE_TYPED_TEST_CASE_P. The argument has to be a class, which contains a static templated function GetName<T>(int), returning the name for type T.
PiperOrigin-RevId: 210532231
Fix Theta(N^2) memory usage of EXPECT_EQ(string) when the strings don't match.
The underlying CalculateOptimalEdits() implementation used a simple
dynamic-programming approach that always used N^2 memory and time. This meant
that tests for equality of large strings were ticking time bombs: They'd work
fine as long as the test passed, but as soon as the strings differed the test
would OOM, which is very hard to debug.
I switched it out for a Dijkstra search, which is still worst-case O(N^2), but
in the usual case of mostly-matching strings, it is much closer to linear.
PiperOrigin-RevId: 210405025
GTEST_TEST_FILTER_ENV_VAR_ was used to specify an environment variable to obtain
the default test filter from. By default it was unset which broke
"--test_filter" for bazel. This CL eliminates GTEST_TEST_FILTER_ENV_VAR_ and
explicitly obtains the default test filter from the environment variable
TESTBRIDGE_TEST_ONLY if it exists.
This canonicalizes demangled names by omitting a nested inline namespace within namespace std if the name of the nested namespace begins with a double underscore. This improves compatibility with libc++.
This allows doing things like TEST_P(TestFixture, MAYBE(TestName))
for nicer conditional test disabling.
Upstream of cr/188748737.
Tested:
Added unit tests MacroNamingTest and MacroNamingTestNonParametrized.
Google Test has recently (02/09/2018) switched the default death test
style from "fast" to "threadsafe" in
ec7faa943d
Threadsafe death tests have been used internally for a while, and are
proven to be a better default.
However, adopting this better default can be challenging for large
projects with a significant investment in custom infrastructure built on
top of Google Test. The same custom infrastructure can make it difficult
for large projects to switch back to the old default by passing in
--gtest_death_test_style=fast.
For the reasons above, the default switch is considered too disruptive,
and this CL reverts it. This CL also introduces the
GTEST_DEFAULT_DEATH_TEST_STYLE preprocesor macro, which replaces the
hard-coded default. The macro can be defined in
gtest/internal/custom/gtest-port.h by projects that are ready to migrate
to thread-safe death tests.
_HAS_EXCEPTIONS is specific to the MSVC STL and defining it to 0 causes
problems with libc++, so libc++ users may leave it undefined. This can
cause GTEST_HAS_EXCEPTIONS to be defined incorrectly if the user has
disabled exceptions via the compiler, which can lead to build errors.
_CPPUNWIND is a builtin macro provided by the compiler so it should
work with both STLs.