Skip to content

Commit

Permalink
Update README.md and MANUAL.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonzalezdr committed Feb 23, 2022
1 parent 2e02ee9 commit 64c7f40
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
17 changes: 14 additions & 3 deletions MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ To use the expectations, you must:
| OPTION | Description |
| - | - |
| `-i, --input <input> ` | Input file |
| `-m, --mock-output <mock-output>` | Mock output path |
| `-e, --expect-output <expect-output>` | Expectation output path |
| `-i, --input <input> ` | Input file path |
| `-m, --mock-output <mock-output>` | Mock output directory or file path |
| `-e, --expect-output <expect-output>` | Expectation output directory or file path |
| `-x, --cpp` | Force interpretation of the input file as C++ |
| `-s, --std` | Set language standard (c\+\+14, c\+\+17, etc.)|
| `-I, --include-path <path>` | Include path |
| `-B, --base-directory <path>` | Base directory path |
| `-t, --type-override <expr>` | Override generic type |
| `-f, --config-file <file>` | Configuration file to be parsed for options |
| `-v, --version` | Print version |
Expand All @@ -190,6 +191,16 @@ To force the interpretation of a header file as C++ use the `-x` / `--cpp` optio
CppUMockGen, just as any C/C++ compiler, needs to know where to find other header files included by the input file in order to interpret it properly. Pass the paths to the necessary include directories by using the `-I` / `--include-path` option. Like with most compilers, you may use this option several times to indicate multiple include directories.
#### Base Directory
Mocks and expectations generated by CppUMockGen need to include the mocked header file. By default, the mocked header file will be referenced with a relative path from the directory where the mocks/expectations are generated.
> **Example:** When generating a mock for a file in _&lt;project-path&gt;/sources/MockedClass/MockedClass.h_ into _&lt;project-path&gt;/tests/mocks/_, the mocked header will be included as `#include "../../sources/MockedClass/MockedClass.h"`.
This behavior may be overriden (e.g., to generate files that can be moved in the directory structure) using the `-B` / `--base-directory` option to set a base directory to reference included mocked headers (e.g., set it to a directory that is in the include path when compiling tests).
> **Example:** When generating a mock for a file in _&lt;project-path&gt;/sources/MockedClass/MockedClass.h_ into _&lt;project-path&gt;/tests/mocks/_ using the option `-B <project-path>/sources`, the mocked header will be included as `#include "MockedClass/MockedClass.h"`.
#### Language
CppUMockGen parses C code according to the `gnu11` language standard, and parses C\+\+ code according to the `gnu++14` language standard. To indicate a different standard, use the `-s` / `--std` and pass a supported language standard. The list of supported language standards can be found in the [Clang compiler command line help](https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-std).
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ On Ubuntu systems you can install CppUMockGen from the [CppUMockGen PPA reposito
| OPTION | Description |
| - | - |
| `-i, --input <input> ` | Input file |
| `-m, --mock-output <mock-output>` | Mock output path |
| `-e, --expect-output <expect-output>` | Expectation output path |
| `-i, --input <input> ` | Input file path |
| `-m, --mock-output <mock-output>` | Mock output directory or file path |
| `-e, --expect-output <expect-output>` | Expectation output directory or file path |
| `-x, --cpp` | Force interpretation of the input file as C++ |
| `-s, --std` | Set language standard (c\+\+14, c\+\+17, etc.)|
| `-I, --include-path <path>` | Include path |
| `-B, --base-directory <path>` | Base directory path |
| `-t, --type-override <expr>` | Override generic type |
| `-f, --config-file <file>` | Configuration file to be parsed for options |
| `-v, --version` | Print version |
Expand All @@ -123,7 +124,9 @@ To generate a mock from a header file containing the functions that you want to
To generate expectations, pass the path where you want the files with the expectation to be generated as output using the `-e` / `--expect-output` option (additionally to or instead of the `-m` option).
CppUMock, just as any C/C++ compiler, needs to know where to find other include files referenced by the input file in order to interpret it properly. Pass the paths to the necessary include directories by using the `-I` / `--include-path` option. Like with most compilers, you may use this option several times to indicate multiple include directories.
CppUMockGen, just as any C/C++ compiler, needs to know where to find other include files referenced by the input file in order to interpret it properly. Pass the paths to the necessary include directories by using the `-I` / `--include-path` option. Like with most compilers, you may use this option several times to indicate multiple include directories.
Mocks and expectations generated by CppUMockGen need to include the mocked header file. By default, the mocked header file will be referenced with a relative path from the directory where the mocks/expectations are generated. This behavior may be overriden using the `-B` / `--base-directory` option to set a base directory to reference included mocked headers (e.g., set it to a directory that is in the include path when compiling tests).
CppUMockGen deduces the data types to use with CppUMock from the actual function parameters and return types. If the API that you are mocking is well designed (e.g. pointers to non-const values are not used for input parameters), CppUMockGen will guess properly in most cases the correct types. Nevertheless, mocked data types can be overridden by using `-t` / `--type-override` options to indicate the type of function parameters or function returns. Type overriding can be defined in generic form, which apply to any function parameter or return types that match the specified type, or can be defined in function-specific form, which apply to parameters and return types of the specified function.
Expand Down

0 comments on commit 64c7f40

Please sign in to comment.