/* 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 "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);

/* 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 <ztest.h>

#include "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);

/**
 * @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);
}

ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);

Add a test rule to reset the FFF fakes
zephyr: Add a test rule to reset the FFF fakes

Add a test rule to reset all the fakes so that tests no longer
have to be responsible for it.

BRANCH=none
BUG=none
TEST=zmake configure --clobber --test test-drivers

Signed-off-by: Yuval Peress <50dc11c009bd4d7e9d9d15a383c1743ce5ee82ef@google.com>
Change-Id: Ifbb9107aec843b5b127e8842ac4fc5c0e4c8086b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500299
Reviewed-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>
