Commit c5f08bf9 by Abseil Team Committed by Gennadiy Civil

Googletest export

One macro to rule them all. PiperOrigin-RevId: 221462515
parent d5932506
...@@ -153,6 +153,7 @@ $env:Path = \"$project_bin;$env:Path\" ...@@ -153,6 +153,7 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_test(gmock-actions_test gmock_main) cxx_test(gmock-actions_test gmock_main)
cxx_test(gmock-cardinalities_test gmock_main) cxx_test(gmock-cardinalities_test gmock_main)
cxx_test(gmock_ex_test gmock_main) cxx_test(gmock_ex_test gmock_main)
cxx_test(gmock-function-mocker_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main) cxx_test(gmock-generated-actions_test gmock_main)
cxx_test(gmock-generated-function-mockers_test gmock_main) cxx_test(gmock-generated-function-mockers_test gmock_main)
cxx_test(gmock-generated-internal-utils_test gmock_main) cxx_test(gmock-generated-internal-utils_test gmock_main)
......
...@@ -28,6 +28,7 @@ lib_libgmock_la_SOURCES = src/gmock-all.cc ...@@ -28,6 +28,7 @@ lib_libgmock_la_SOURCES = src/gmock-all.cc
pkginclude_HEADERS = \ pkginclude_HEADERS = \
include/gmock/gmock-actions.h \ include/gmock/gmock-actions.h \
include/gmock/gmock-cardinalities.h \ include/gmock/gmock-cardinalities.h \
include/gmock/gmock-function-mocker.h \
include/gmock/gmock-generated-actions.h \ include/gmock/gmock-generated-actions.h \
include/gmock/gmock-generated-function-mockers.h \ include/gmock/gmock-generated-function-mockers.h \
include/gmock/gmock-generated-matchers.h \ include/gmock/gmock-generated-matchers.h \
...@@ -43,6 +44,7 @@ pkginclude_internal_HEADERS = \ ...@@ -43,6 +44,7 @@ pkginclude_internal_HEADERS = \
include/gmock/internal/gmock-generated-internal-utils.h \ include/gmock/internal/gmock-generated-internal-utils.h \
include/gmock/internal/gmock-internal-utils.h \ include/gmock/internal/gmock-internal-utils.h \
include/gmock/internal/gmock-port.h \ include/gmock/internal/gmock-port.h \
include/gmock/internal/gmock-pp.h \
include/gmock/internal/custom/gmock-generated-actions.h \ include/gmock/internal/custom/gmock-generated-actions.h \
include/gmock/internal/custom/gmock-matchers.h \ include/gmock/internal/custom/gmock-matchers.h \
include/gmock/internal/custom/gmock-port.h include/gmock/internal/custom/gmock-port.h
...@@ -107,6 +109,7 @@ EXTRA_DIST += \ ...@@ -107,6 +109,7 @@ EXTRA_DIST += \
test/gmock-cardinalities_test.cc \ test/gmock-cardinalities_test.cc \
test/gmock_ex_test.cc \ test/gmock_ex_test.cc \
test/gmock-generated-actions_test.cc \ test/gmock-generated-actions_test.cc \
test/gmock-function-mocker_test.cc \
test/gmock-generated-function-mockers_test.cc \ test/gmock-generated-function-mockers_test.cc \
test/gmock-generated-internal-utils_test.cc \ test/gmock-generated-internal-utils_test.cc \
test/gmock-generated-matchers_test.cc \ test/gmock-generated-matchers_test.cc \
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "gmock/gmock-actions.h" #include "gmock/gmock-actions.h"
#include "gmock/gmock-cardinalities.h" #include "gmock/gmock-cardinalities.h"
#include "gmock/gmock-function-mocker.h"
#include "gmock/gmock-generated-actions.h" #include "gmock/gmock-generated-actions.h"
#include "gmock/gmock-generated-function-mockers.h" #include "gmock/gmock-generated-function-mockers.h"
#include "gmock/gmock-generated-matchers.h" #include "gmock/gmock-generated-matchers.h"
......
#include "gmock/internal/gmock-pp.h"
// Static assertions.
namespace testing {
namespace internal {
namespace gmockpp {
static_assert(GMOCK_PP_CAT(1, 4) == 14, "");
static_assert(GMOCK_PP_INTERNAL_INTERNAL_16TH(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18) == 16,
"");
static_assert(GMOCK_PP_NARG() == 1, "");
static_assert(GMOCK_PP_NARG(x) == 1, "");
static_assert(GMOCK_PP_NARG(x, y) == 2, "");
static_assert(GMOCK_PP_NARG(x, y, z) == 3, "");
static_assert(GMOCK_PP_NARG(x, y, z, w) == 4, "");
static_assert(!GMOCK_PP_HAS_COMMA(), "");
static_assert(GMOCK_PP_HAS_COMMA(b, ), "");
static_assert(!GMOCK_PP_HAS_COMMA((, )), "");
static_assert(!GMOCK_PP_IS_EMPTY(, ), "");
static_assert(!GMOCK_PP_IS_EMPTY(a), "");
static_assert(!GMOCK_PP_IS_EMPTY(()), "");
static_assert(GMOCK_PP_IF(1, 1, 2) == 1, "");
static_assert(GMOCK_PP_IF(0, 1, 2) == 2, "");
static_assert(GMOCK_PP_NARG0(x) == 1, "");
static_assert(GMOCK_PP_NARG0(x, y) == 2, "");
static_assert(GMOCK_PP_HEAD(1) == 1, "");
static_assert(GMOCK_PP_HEAD(1, 2) == 1, "");
static_assert(GMOCK_PP_HEAD(1, 2, 3) == 1, "");
static_assert(GMOCK_PP_TAIL(1, 2) == 2, "");
static_assert(GMOCK_PP_HEAD(GMOCK_PP_TAIL(1, 2, 3)) == 2, "");
static_assert(!GMOCK_PP_IS_BEGIN_PARENS(sss), "");
static_assert(!GMOCK_PP_IS_BEGIN_PARENS(sss()), "");
static_assert(!GMOCK_PP_IS_BEGIN_PARENS(sss() sss), "");
static_assert(GMOCK_PP_IS_BEGIN_PARENS((sss)), "");
static_assert(GMOCK_PP_IS_BEGIN_PARENS((sss)ss), "");
static_assert(!GMOCK_PP_IS_ENCLOSED_PARENS(sss), "");
static_assert(!GMOCK_PP_IS_ENCLOSED_PARENS(sss()), "");
static_assert(!GMOCK_PP_IS_ENCLOSED_PARENS(sss() sss), "");
static_assert(!GMOCK_PP_IS_ENCLOSED_PARENS((sss)ss), "");
static_assert(GMOCK_PP_REMOVE_PARENS((1 + 1)) * 2 == 3, "");
static_assert(GMOCK_PP_INC(4) == 5, "");
template <class... Args>
struct Test {
static constexpr int kArgs = sizeof...(Args);
};
#define GMOCK_PP_INTERNAL_TYPE_TEST(_i, _Data, _element) \
GMOCK_PP_COMMA_IF(_i) _element
static_assert(Test<GMOCK_PP_FOR_EACH(GMOCK_PP_INTERNAL_TYPE_TEST, ~,
(int, float, double, char))>::kArgs == 4,
"");
#define GMOCK_PP_INTERNAL_VAR_TEST_1(_x) 1
#define GMOCK_PP_INTERNAL_VAR_TEST_2(_x, _y) 2
#define GMOCK_PP_INTERNAL_VAR_TEST_3(_x, _y, _z) 3
#define GMOCK_PP_INTERNAL_VAR_TEST(...) \
GMOCK_PP_VARIADIC_CALL(GMOCK_PP_INTERNAL_VAR_TEST_, __VA_ARGS__)
static_assert(GMOCK_PP_INTERNAL_VAR_TEST(x, y) == 2, "");
static_assert(GMOCK_PP_INTERNAL_VAR_TEST(silly) == 1, "");
static_assert(GMOCK_PP_INTERNAL_VAR_TEST(x, y, z) == 3, "");
// TODO(iserna): The following asserts fail in --config=lexan.
#define GMOCK_PP_INTERNAL_IS_EMPTY_TEST_1
static_assert(GMOCK_PP_IS_EMPTY(GMOCK_PP_INTERNAL_IS_EMPTY_TEST_1), "");
static_assert(GMOCK_PP_IS_EMPTY(), "");
static_assert(GMOCK_PP_IS_ENCLOSED_PARENS((sss)), "");
static_assert(GMOCK_PP_IS_EMPTY(GMOCK_PP_TAIL(1)), "");
static_assert(GMOCK_PP_NARG0() == 0, "");
} // namespace gmockpp
} // namespace internal
} // namespace testing
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