1
0
mirror of https://github.com/meekrosoft/fff synced 2026-01-23 00:15:59 +01:00

Added test case for FAKE_VALUE_FUNC_VARARG.

This commit is contained in:
Rubio R. C. Terra
2016-06-07 09:45:40 -03:00
committed by Rubio Ribeiro Canario Terra
parent 8c7bd6912f
commit 88864216d3
5 changed files with 20 additions and 4 deletions

View File

@@ -27,7 +27,8 @@ FAKE_VOID_FUNC(voidfunc2, char, char);
FAKE_VALUE_FUNC(long, longfunc0);
FAKE_VALUE_FUNC(enum MYBOOL, enumfunc0);
FAKE_VALUE_FUNC(struct MyStruct, structfunc0);
FAKE_VOID_FUNC3_VARARG(voidfunc3var, char *, int, ...);
FAKE_VOID_FUNC_VARARG(voidfunc3var, char *, int, ...);
FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, char *, int, ...);
FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t);
FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
@@ -39,6 +40,7 @@ void setup()
RESET_FAKE(enumfunc0);
RESET_FAKE(structfunc0);
RESET_FAKE(voidfunc3var);
RESET_FAKE(valuefunc3var);
RESET_FAKE(strlcpy3);
FFF_RESET_HISTORY();
}
@@ -96,7 +98,8 @@ int main()
RUN_TEST(FFFTestSuite, can_register_custom_fake);
RUN_TEST(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value);
RUN_TEST(FFFTestSuite, use_vararg_fake_with_different_number_of_arguments);
RUN_TEST(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments);
RUN_TEST(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments);
RUN_TEST(FFFTestSuite, can_capture_upto_20_arguments_correctly);

View File

@@ -14,6 +14,7 @@ void setup()
RESET_FAKE(enumfunc0);
RESET_FAKE(structfunc0);
RESET_FAKE(voidfunc3var);
RESET_FAKE(valuefunc3var);
RESET_FAKE(strlcpy3);
FFF_RESET_HISTORY();
@@ -64,7 +65,8 @@ int main()
RUN_TEST(FFFTestSuite, can_register_custom_fake);
RUN_TEST(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value);
RUN_TEST(FFFTestSuite, use_vararg_fake_with_different_number_of_arguments);
RUN_TEST(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments);
RUN_TEST(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments);
RUN_TEST(FFFTestSuite, can_capture_upto_20_arguments_correctly);

View File

@@ -7,6 +7,7 @@ DEFINE_FAKE_VALUE_FUNC0(long, longfunc0);
DEFINE_FAKE_VALUE_FUNC0(enum MYBOOL, enumfunc0);
DEFINE_FAKE_VALUE_FUNC0(struct MyStruct, structfunc0);
DEFINE_FAKE_VOID_FUNC3_VARARG(voidfunc3var, const char *, int, ...);
DEFINE_FAKE_VALUE_FUNC3_VARARG(int, valuefunc3var, const char *, int, ...);
#ifndef __cplusplus
DEFINE_FAKE_VALUE_FUNC3(int, strlcpy3, char* const, const char* const, const size_t);
#endif /* __cplusplus */

View File

@@ -11,6 +11,7 @@ void voidfunc1(int);
void voidfunc2(char, char);
long longfunc0();
void voidfunc3var(const char *fmt, int argc, ...);
int valuefunc3var(const char *fmt, int argc, ...);
void voidfunc20(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
enum MYBOOL { FALSE = 899, TRUE };
@@ -28,6 +29,7 @@ DECLARE_FAKE_VALUE_FUNC0(long, longfunc0);
DECLARE_FAKE_VALUE_FUNC0(enum MYBOOL, enumfunc0);
DECLARE_FAKE_VALUE_FUNC0(struct MyStruct, structfunc0);
DECLARE_FAKE_VOID_FUNC3_VARARG(voidfunc3var, const char *, int, ...);
DECLARE_FAKE_VALUE_FUNC3_VARARG(int, valuefunc3var, const char *, int, ...);
DECLARE_FAKE_VOID_FUNC20(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
#ifndef __cplusplus

View File

@@ -239,13 +239,21 @@ TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return
}
#ifndef __cplusplus
TEST_F(FFFTestSuite, use_vararg_fake_with_different_number_of_arguments)
TEST_F(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments)
{
voidfunc3var("0 parameters", 0);
voidfunc3var("1 parameter", 1, 10);
voidfunc3var("2 parameters", 2, 10, 20);
voidfunc3var("3 parameters", 3, 10, 20, 30);
}
TEST_F(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments)
{
valuefunc3var("0 parameters", 0);
valuefunc3var("1 parameter", 1, 10);
valuefunc3var("2 parameters", 2, 10, 20);
valuefunc3var("3 parameters", 3, 10, 20, 30);
}
#endif /* __cplusplus */
TEST_F(FFFTestSuite, can_capture_upto_20_arguments_correctly)