Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for withMemoryBufferParameter function #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mocking_manual.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The main idea is to make manual mocking easier, rather than to make automated mo
* [Using Parameters](#parameters)
* [Objects as Parameters](#objects_as_parameters)
* [Output Parameters](#output_parameters)
* [Memory Buffer Parameters](#memory_buffer_parameters)
* [Output Parameters Using Objects](#output_parameters_using_objects)
* [Return Values](#return_values)
* [Passing other data](#other_data)
Expand Down Expand Up @@ -241,6 +242,22 @@ Comparators are *not* copied, instead it uses the exact instance as passed to th

When using the MockPlugin (recommended), then it's best to install the comparators via the MockPlugin or put them in global space. The checkExpectations will be called *after* teardown and if your comparator was destroyed in the teardown then this will cause a crash.

<a id="memory_buffer_parameters"> </a>

### Memory Buffer Parameters

When testing a function that accepts a pointer to data as a parameter you may want to check the value of the data referenced by the pointer instead of the value of the pointer itself. This can be done using withMemoryBufferParameter like:

{% highlight c++ %}
mock().expectOneCall("function").onObject(object).withMemoryBufferParameter("buffer", buffer, length);
{% endhighlight %}

and the actual call would be:

{% highlight c++ %}
mock().actualCall("function").onObject(this).withMemoryBufferParameter("buffer", buffer, length);
{% endhighlight %}

<a id="output_parameters"> </a>

### Output Parameters
Expand Down