summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/common/src/test_mocks.c
blob: 3c8f31b9f20a6ef7201bf4ba8b7e2a74ad5b68ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <zephyr/ztest.h>

#include "test/drivers/test_mocks.h"

DEFINE_FFF_GLOBALS;

/* Mocks for common/init_rom.c */
DEFINE_FAKE_VALUE_FUNC(const void *, init_rom_map, const void *, int);
DEFINE_FAKE_VOID_FUNC(init_rom_unmap, const void *, int);
DEFINE_FAKE_VALUE_FUNC(int, init_rom_copy, int, int, int);

/* Mocks for common/system.c */
DEFINE_FAKE_VALUE_FUNC(int, system_jumped_late);

/**
 * @brief Reset all the fakes before each test.
 */
static void fff_reset_rule_before(const struct ztest_unit_test *test,
				  void *data)
{
	ARG_UNUSED(test);
	ARG_UNUSED(data);

	RESET_FAKE(init_rom_map);
	RESET_FAKE(init_rom_unmap);
	RESET_FAKE(init_rom_copy);
	RESET_FAKE(system_jumped_late);
}

ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);