diff options
Diffstat (limited to 'deps/fff/test/include')
-rw-r--r-- | deps/fff/test/include/c_test_framework.h | 15 | ||||
-rw-r--r-- | deps/fff/test/include/custom_function.hpp | 10 | ||||
-rw-r--r-- | deps/fff/test/include/fff_wrapper.hpp | 11 | ||||
-rw-r--r-- | deps/fff/test/include/global_fakes.h | 49 |
4 files changed, 85 insertions, 0 deletions
diff --git a/deps/fff/test/include/c_test_framework.h b/deps/fff/test/include/c_test_framework.h new file mode 100644 index 0000000..297a33a --- /dev/null +++ b/deps/fff/test/include/c_test_framework.h @@ -0,0 +1,15 @@ +#ifndef C_TEST_FRAMEWORK_H_ +#define C_TEST_FRAMEWORK_H_ + +#include <assert.h> +#include <stdio.h> +#include <string.h> + +/* Test Framework :-) */ +void setup(); +#define TEST_F(SUITE, NAME) void NAME() +#define RUN_TEST(SUITE, TESTNAME) do { printf(" Running %s.%s: \n", #SUITE, #TESTNAME); setup(); TESTNAME(); printf(" SUCCESS\n"); } while (0) +#define ASSERT_EQ(A, B) assert((A) == (B)) +#define ASSERT_TRUE(A) assert((A)) + +#endif /* C_TEST_FRAMEWORK_H_ */ diff --git a/deps/fff/test/include/custom_function.hpp b/deps/fff/test/include/custom_function.hpp new file mode 100644 index 0000000..d9f3934 --- /dev/null +++ b/deps/fff/test/include/custom_function.hpp @@ -0,0 +1,10 @@ +/* Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include <functional> + +#define CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN, FUNCNAME, ...) \ + std::function<RETURN (__VA_ARGS__)> FUNCNAME diff --git a/deps/fff/test/include/fff_wrapper.hpp b/deps/fff/test/include/fff_wrapper.hpp new file mode 100644 index 0000000..e3c0cac --- /dev/null +++ b/deps/fff/test/include/fff_wrapper.hpp @@ -0,0 +1,11 @@ +/* Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include <functional> + +#include "custom_function.hpp" + +#include <fff.h>
\ No newline at end of file diff --git a/deps/fff/test/include/global_fakes.h b/deps/fff/test/include/global_fakes.h new file mode 100644 index 0000000..b76a9aa --- /dev/null +++ b/deps/fff/test/include/global_fakes.h @@ -0,0 +1,49 @@ +#ifndef GLOBAL_FAKES_H_ +#define GLOBAL_FAKES_H_ + +#include <fff.h> +#include <string.h> + + +//// Imaginary production code header file /// +enum MYBOOL { FALSE = 899, TRUE }; +struct MyStruct { + int x; + int y; +}; +enum MYBOOL enumfunc(); +struct MyStruct structfunc(); +//// End Imaginary production code header file /// + +#ifndef TEST_WITH_CALLING_CONVENTIONS +DECLARE_FAKE_VOID_FUNC(voidfunc1, int); +DECLARE_FAKE_VOID_FUNC(voidfunc2, char, char); +DECLARE_FAKE_VOID_FUNC(voidfunc1outparam, char *); +DECLARE_FAKE_VALUE_FUNC(long, longfunc0); +DECLARE_FAKE_VALUE_FUNC(enum MYBOOL, enumfunc0); +DECLARE_FAKE_VALUE_FUNC(struct MyStruct, structfunc0); +DECLARE_FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...); +DECLARE_FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...); +DECLARE_FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); +DECLARE_FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); +#else +DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc1, int); +DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char); +DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *); +DECLARE_FAKE_VALUE_FUNC(long, __cdecl, longfunc0); +DECLARE_FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0); +DECLARE_FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0); +DECLARE_FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...); +DECLARE_FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...); +DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); +DECLARE_FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); +#endif + +#ifndef __cplusplus +#ifndef TEST_WITH_CALLING_CONVENTIONS +DECLARE_FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t); +#else +DECLARE_FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t); +#endif +#endif /* __cplusplus */ +#endif /* GLOBAL_FAKES_H_ */ |