blob: f79021a36993f43024f17457293cdcb85ac6912d [file] [log] [blame]
Imre Kis721104f2020-11-30 20:52:38 +01001// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
4 */
5
6#include "mock_assert.h"
7#include <assert.h>
8#include <CppUTest/TestHarness.h>
9#include <CppUTestExt/MockSupport.h>
10
11int expect_assert(assert_environment_t *env)
12{
13 mock().expectOneCall("__assert_fail").andReturnValue(env);
14 return 0;
15}
16
17void __assert_fail(const char *assertion, const char *file, unsigned int line,
18 const char *function)
19{
20 (void)assertion;
21 (void)file;
22 (void)line;
23 (void)function;
24
25 assert_environment_t *env = (assert_environment_t *)mock()
26 .actualCall("__assert_fail")
27 .returnPointerValue();
28 longjmp(*env, 1);
29}