Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-11-11 19:35:26 +0300
committerJulian Eisel <julian@blender.org>2020-11-11 19:35:26 +0300
commitca7079a44e773a26d6f6aa6730f53a16e7de6cd5 (patch)
treeb58ff6ccca5e2afd18da8365705f47112eac0a38 /tests/gtests/testing/testing.h
parentfdd9cb713e2e96e430eb022f034bfa9973afc75c (diff)
parent5b5ec0a2e910a42d7c02774a47fd9c70b6f16f06 (diff)
Merge branch 'master' into outliner-cpp-refactoroutliner-cpp-refactor
Diffstat (limited to 'tests/gtests/testing/testing.h')
-rw-r--r--tests/gtests/testing/testing.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/gtests/testing/testing.h b/tests/gtests/testing/testing.h
index 34928035b7d..8136a93314e 100644
--- a/tests/gtests/testing/testing.h
+++ b/tests/gtests/testing/testing.h
@@ -137,4 +137,22 @@ inline void EXPECT_EQ_ARRAY_ND(const T *expected, const T *actual, const size_t
}
}
+#ifdef _WIN32
+# define ABORT_PREDICATE ::testing::ExitedWithCode(3)
+#else
+# define ABORT_PREDICATE ::testing::KilledBySignal(SIGABRT)
+#endif
+
+/* Test macro for when BLI_assert() is expected to fail.
+ * Note that the EXPECT_BLI_ASSERT macro is a no-op, unless used in a debug build with
+ * WITH_ASSERT_ABORT=ON. */
+#if defined(WITH_ASSERT_ABORT) && !defined(NDEBUG)
+/* EXPECT_EXIT() is used as that's the only exit-expecting function in GTest that allows us to
+ * check for SIGABRT. */
+# define EXPECT_BLI_ASSERT(function_call, expect_message) \
+ EXPECT_EXIT(function_call, ABORT_PREDICATE, expect_message)
+#else
+# define EXPECT_BLI_ASSERT(function_call, expect_message) function_call
+#endif
+
#endif // __BLENDER_TESTING_H__