aboutsummaryrefslogtreecommitdiff
path: root/components/messaging/ffa/libsp/test/mock_assert.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'components/messaging/ffa/libsp/test/mock_assert.cpp')
-rw-r--r--components/messaging/ffa/libsp/test/mock_assert.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/components/messaging/ffa/libsp/test/mock_assert.cpp b/components/messaging/ffa/libsp/test/mock_assert.cpp
new file mode 100644
index 0000000..f79021a
--- /dev/null
+++ b/components/messaging/ffa/libsp/test/mock_assert.cpp
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ */
+
+#include "mock_assert.h"
+#include <assert.h>
+#include <CppUTest/TestHarness.h>
+#include <CppUTestExt/MockSupport.h>
+
+int expect_assert(assert_environment_t *env)
+{
+ mock().expectOneCall("__assert_fail").andReturnValue(env);
+ return 0;
+}
+
+void __assert_fail(const char *assertion, const char *file, unsigned int line,
+ const char *function)
+{
+ (void)assertion;
+ (void)file;
+ (void)line;
+ (void)function;
+
+ assert_environment_t *env = (assert_environment_t *)mock()
+ .actualCall("__assert_fail")
+ .returnPointerValue();
+ longjmp(*env, 1);
+}