150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek/*
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek Authors:
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek Jakub Hrozek <jhrozek@redhat.com>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek Copyright (C) 2013 Red Hat
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek SSSD tests: Common utilities for tests that exercise domains
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek This program is free software; you can redistribute it and/or modify
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek it under the terms of the GNU General Public License as published by
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek the Free Software Foundation; either version 3 of the License, or
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek (at your option) any later version.
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek This program is distributed in the hope that it will be useful,
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek but WITHOUT ANY WARRANTY; without even the implied warranty of
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek GNU General Public License for more details.
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek You should have received a copy of the GNU General Public License
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek along with this program. If not, see <http://www.gnu.org/licenses/>.
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek*/
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#ifndef __COMMON_MOCK_H_
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#define __COMMON_MOCK_H_
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek/*
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * from cmocka.c:
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * These headers or their equivalents should be included prior to
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * including
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * this header file.
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek *
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * #include <stdarg.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * #include <stddef.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * #include <setjmp.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek *
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * This allows test applications to use custom definitions of C standard
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek * library functions and types.
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek */
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#include <stdarg.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#include <stddef.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#include <setjmp.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#include <cmocka.h>
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#include "tests/common.h"
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#define sss_mock_type(type) ((type) mock())
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#define sss_mock_ptr_type(type) ((type) (uintptr_t) mock())
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
7139afb1e632a700040c813ebdffe2c177dadc75Pavel Březina#define sss_will_return_always(fn, value) will_return_count(fn, (value), -1)
7139afb1e632a700040c813ebdffe2c177dadc75Pavel Březina
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozekenum sss_test_wrapper_call {
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek WRAP_CALL_WRAPPER,
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek WRAP_CALL_REAL
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek};
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek
150b76e13b7c4f3ccf1d709bf517ca2af6b2c9a2Jakub Hrozek#endif /* __COMMON_MOCK_H_ */