Skip to content

Commit

Permalink
Merge pull request #34 from smalti/README.md-update-for-the-1.2.2-tag
Browse files Browse the repository at this point in the history
Updated README.md for the next tag
  • Loading branch information
smalti committed Jan 26, 2024
2 parents f0cddc8 + bb5c28c commit 361ae15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ ON_MODULE_FUNC_CALL(GetCurrentProcessId).WillByDefault(Return(42));
ON_MODULE_FUNC_CALL(GetProcessIdOfThread, Eq(HANDLE(42))).WillByDefault(Return(1));
```

#### 4. To validate and clear expectations after tests use the `VERIFY_AND_CLEAR_MODULE_FUNC` or `VERIFY_AND_CLEAR_MODULE_FUNC_EXPECTATIONS` macro (usually used for multiple tests with different expectations and can be executed as part of the test tear-down logic)
#### 4. To validate and clear expectations after tests use the `VERIFY_AND_CLEAR_MODULE_FUNC` or `VERIFY_AND_CLEAR_MODULE_FUNC_EXPECTATIONS` macro

In `GMock` the expectations of a mock object are verified upon its destruction. However, since we do not destroy our objects, we must manually verify our expectations after test. In the general case, we should verify expectations after every test case, similar to how a Mock object would be destroyed. This can typically be done in the `TearDown` method:

```cpp
// Verifies and removes the expectations
Expand Down Expand Up @@ -272,6 +274,13 @@ int main(int argc, char* argv[])
# Version history
## Version 1.2.2 (25 January 2024)
- Added support for `Win32 API forwarding`
- Added support for macro expansion across all macro definitions
- Added `VERIFY_AND_CLEAR_MODULE_FUNC` macro
- Fixed a typo related to 12 arguments
- Fixed C++20 compilation errors and warning 4702
## Version 1.2.1 (19 October 2023)
- Added macro expansion for redefined Win32 functions (e.g. `GetWindowLongPtrA`)
- Added `initialization` / `uninitialization` of the lib-core
Expand All @@ -288,7 +297,7 @@ int main(int argc, char* argv[])
## Version 1.1.0 (29 August 2023)
- Added support for functions with 9-13 parameters
- Added `REAL_MODULE_FUNC` macro
- Fixed problem with Windows ApiSet DLL functions redirection (AppCompat via Shimm DLL)
- Fixed problem with Windows `ApiSet` DLL functions redirection (`AppCompat` via `Shimm DLL`)
<details>
<summary>Old versions</summary>
Expand Down
10 changes: 5 additions & 5 deletions src/gmock-win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ namespace utils {
rvaToVa< IMAGE_THUNK_DATA >(base, descr->OriginalFirstThunk) : thunkIAT;

for (; thunk->u1.Function; ++thunk, ++thunkIAT)
{
if (!descr->OriginalFirstThunk || thunk->u1.Ordinal & IMAGE_ORDINAL_FLAG)
{
if (*thunkProc(thunkIAT) == funcAddr)
if (!descr->OriginalFirstThunk || thunk->u1.Ordinal & IMAGE_ORDINAL_FLAG)
{
*ppfn = thunkProc(thunkIAT);
return S_OK;
if (*thunkProc(thunkIAT) == funcAddr)
{
*ppfn = thunkProc(thunkIAT);
return S_OK;
}
}
else
Expand Down

0 comments on commit 361ae15

Please sign in to comment.