Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
usr42 committed Feb 4, 2017
2 parents 3d0919b + 74c07a8 commit 3ec2c2b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 96 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ you would use a syntax like this:

Good tests are isolated tests, so it is important to reset the fakes for each
unit test. All the fakes have a reset function to reset their arguments and
call counts. It is good prectice is to call the reset function for all the
call counts. It is good practice is to call the reset function for all the
fakes in the setup function of your test suite.

void setup()
Expand Down Expand Up @@ -478,7 +478,7 @@ DEFINE_FAKE_VOID_FUNC_VARARG(void_function_vargs, const char *, int, ...);

## Find out more...

Look under the examlples directory for full length examples in both C and C++.
Look under the examples directory for full length examples in both C and C++.
There is also a test suite for the framework under the test directory.

-------------------------
Expand Down
10 changes: 6 additions & 4 deletions fakegen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def define_reset_fake_helper
puts
putd_backslash "#define DEFINE_RESET_FUNCTION(FUNCNAME)"
indent {
putd_backslash "void FUNCNAME##_reset(){"
putd_backslash "void FUNCNAME##_reset(void){"
indent {
putd_backslash "memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake));"
putd_backslash "FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN;"
Expand Down Expand Up @@ -315,11 +315,12 @@ def output_variables(arg_count, has_varargs, is_value_function)
output_custom_function_array(arg_count, has_varargs, is_value_function)
}
putd_backslash "extern FUNCNAME##_Fake FUNCNAME##_fake;"
putd_backslash "void FUNCNAME##_reset();"
putd_backslash "void FUNCNAME##_reset(void);"
end

#example: ARG0_TYPE arg0, ARG1_TYPE arg1
def arg_val_list(args_count)
return "void" if (args_count == 0)
arguments = []
args_count.times { |i| arguments << "ARG#{i}_TYPE arg#{i}" }
arguments.join(", ")
Expand Down Expand Up @@ -411,9 +412,10 @@ def output_function_body(arg_count, has_varargs, is_value_function)
end

def define_fff_globals
putd "typedef void (*fff_function_t)(void);"
putd "typedef struct { "
indent {
putd "void * call_history[FFF_CALL_HISTORY_LEN];"
putd "fff_function_t call_history[FFF_CALL_HISTORY_LEN];"
putd "unsigned int call_history_idx;"
}
putd "} fff_globals_t;"
Expand All @@ -437,7 +439,7 @@ def define_fff_globals
indent {
putd_backslash "if(fff.call_history_idx < FFF_CALL_HISTORY_LEN)"
indent {
putd "fff.call_history[fff.call_history_idx++] = (void *)function;"
putd "fff.call_history[fff.call_history_idx++] = (fff_function_t)function;"
}
}
end
Expand Down
Loading

0 comments on commit 3ec2c2b

Please sign in to comment.