Skip to content

Commit

Permalink
Update our fork of FakeIt to 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTroyer authored Feb 27, 2023
2 parents 3e5e622 + edf08dc commit d87de53
Show file tree
Hide file tree
Showing 93 changed files with 43,088 additions and 5,101 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci_linux_clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI Linux/Clang

on:
push:
pull_request:

defaults:
run:
shell: bash

jobs:
clang-ubuntu-20-04:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build project
run: |
cd build
make -f clang_makefile all
- name: Run tests
run: |
cd build
./fakeit_tests.exe
clang-ubuntu-18-04:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build project
run: |
cd build
make -f clang_makefile all
- name: Run tests
run: |
cd build
./fakeit_tests.exe
60 changes: 60 additions & 0 deletions .github/workflows/ci_linux_gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI Linux/GCC

on:
push:
pull_request:

defaults:
run:
shell: bash

jobs:
coverage:
runs-on: ubuntu-20.04
steps:
- name: Install LCOV
run: sudo apt install -y lcov
- uses: actions/checkout@v2
- name: Build project
run: |
cd build
make coverage
- name: Run tests
run: |
cd build
./fakeit_tests.exe
- name: Generate report
run: |
cd build
gcov *.o
lcov --directory . -c -o report.info
lcov --remove report.info '/usr/*' '*/tests/*' -o report_filtered.info
- name: Upload report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./build/report_filtered.info
gcc-ubuntu-20-04:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build project
run: |
cd build
make all
- name: Run tests
run: |
cd build
./fakeit_tests.exe
gcc-ubuntu-18-04:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build project
run: |
cd build
make all
- name: Run tests
run: |
cd build
./fakeit_tests.exe
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Debug/
ipch/
TestResults/
tests/cmake-build-debug/
tests/x64/
*/.vs/

# Eclipse
.settings/
Expand All @@ -58,3 +60,4 @@ bii/

*.*~
*.nupkg

19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Don't generate single header files in your pull request, only modify the original files (the ones inside the `include` folder).

Add unit tests for your development or at least provide examples on how to test your changes in your pull request.
46 changes: 34 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FakeIt

[![Join the chat at https://gitter.im/eranpeer/FakeIt](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eranpeer/FakeIt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

GCC: [![Build Status GCC](https://travis-ci.org/eranpeer/FakeIt.svg?branch=master)](https://travis-ci.org/eranpeer/FakeIt)
[![Coverage Status](https://coveralls.io/repos/eranpeer/FakeIt/badge.svg?branch=master&service=github)](https://coveralls.io/github/eranpeer/FakeIt?branch=master)
Linux / GCC: [![Build status Linux/GCC](https://github.com/eranpeer/FakeIt/actions/workflows/ci_linux_gcc.yml/badge.svg)](https://github.com/eranpeer/FakeIt/actions/workflows/ci_linux_gcc.yml)
[![Coverage Status](https://coveralls.io/repos/github/eranpeer/FakeIt/badge.svg?branch=master)](https://coveralls.io/github/eranpeer/FakeIt?branch=master)

Linux / Clang: [![Build status Linux/Clang](https://github.com/eranpeer/FakeIt/actions/workflows/ci_linux_clang.yml/badge.svg)](https://github.com/eranpeer/FakeIt/actions/workflows/ci_linux_clang.yml)

MSC: [![Build status MSC](https://ci.appveyor.com/api/projects/status/sy2dk8se2yoxaqve)](https://ci.appveyor.com/project/eranpeer/fakeit)

Expand Down Expand Up @@ -53,7 +55,7 @@ Verify(Method(mock,foo).Using(1));
Checkout the [Quickstart](https://github.com/eranpeer/FakeIt/wiki/Quickstart) for many more examples!
Download the [Latest Release](https://github.com/eranpeer/FakeIt/releases/latest) and start using FakeIt now!
The master branch has the stable version of FakeIt. Include the most suitable single header in your test project and you are good to go.
## Features
* Packaged as a **single header file**.
Expand All @@ -75,22 +77,27 @@ If you don't find your unit testing framework on the list, simply use the *stand
### Using a pre-packaged single header file
Pre-packaged single header versions of FakeIt are located under the *single_header* folder.
Depending on the unit testing framework you use, simply add one of the pre-packaged versions to the include path of your test project:
* <fakeit_folder>/single_header/[gtest](https://github.com/google/googletest)
* <fakeit_folder>/single_header/mstest
* <fakeit_folder>/single_header/boost
* <fakeit_folder>/single_header/[catch](https://github.com/philsquared/Catch) (Tested with Catch 2.0.1)
* <fakeit_folder>/single_header/[tpunit](https://github.com/tpounds/tpunitpp)
* <fakeit_folder>/single_header/[mettle](https://github.com/jimporter/mettle)
* <fakeit_folder>/single_header/qtest
* <fakeit_folder>/single_header/standalone
* <fakeit_folder>/single\_header/[gtest](https://github.com/google/googletest)
* <fakeit_folder>/single\_header/mstest
* <fakeit_folder>/single\_header/boost
* <fakeit_folder>/single\_header/[catch](https://github.com/philsquared/Catch) (Tested with Catch 2.0.1)
* <fakeit_folder>/single\_header/[tpunit](https://github.com/tpounds/tpunitpp)
* <fakeit_folder>/single\_header/[mettle](https://github.com/jimporter/mettle)
* <fakeit_folder>/single\_header/qtest
* <fakeit_folder>/single\_header/nunit - (See caveats in config/nunit/fakeit\_instance.hpp)
* <fakeit_folder>/single\_header/[cute](https://github.com/PeterSommerlad/CUTE)
* <fakeit_folder>/single\_header/standalone
For example, to use fakeit with **Google Test** simply add the *single_header/gtest* folder to the include path of your test project:
```
-I"<fakeit_folder>/single_header/gtest"
```
### Using the source header files
Fakeit source code header files are located under the *include* foler. To use FakeIt directly from the source code all you need to do is to download the source files and add the *include* folder and the configuration folder of your choice to the include path of your project.
For example:
* To use fakeit with **Google Test** add the *include* folder and the *config/gtest* folder to the include path of your test project:
```
-I"<fakeit_folder>/include" -I"<fakeit_folder>/config/gtest"
Expand Down Expand Up @@ -119,11 +126,21 @@ For example:
```
-I"<fakeit_folder>/include" -I"<fakeit_folder>/config/qtest"
```
* To use fakeit with **NUnit** in a managed Visual Studio C++/CLI project, add the standalone/nunit folder to your project include path. Note, it is useful to define your mocks
in `#pragma unmanaged` sections so that you can use lambda expressions.
* To use fakeit with **CUTE** add the *include* folder and the *config/cute* folder to the include path of your test project:
```
-I"<fakeit_folder>/include" -I"<fakeit_folder>/config/cute"
```
* To use fakeit without any testing framework integration (**standalone**) add the *include* folder and the *config/standalone* folder to the include path of your test project:
```
-I"<fakeit_folder>/include" -I"<fakeit_folder>/config/standalone"
```
It is recommended to build and run the unit tests to make sure FakeIt fits your environment.
For GCC, it is recommended to build the test project with -O1 or -O0 flags. Some features of Fakeit may not work with stonger optimizations!!
#### Building and Running the Unit Tests with GCC
```
cd build
Expand All @@ -133,6 +150,7 @@ run the tests by typing
```
./fakeit_tests.exe
```
#### Building and Running the Unit Tests with Clang
```
cd build
Expand All @@ -142,10 +160,14 @@ run the tests by typing
```
./fakeit_tests.exe
```
#### Building and Running the Unit Tests with Visual Studio
Open the tests/all_tests.vcxproj project file with Visual Studio 2013. Build and run the project and check the test results.
Open the tests/all_tests.vcxproj project file with Visual Studio. Build and run the project and check the test results.
## Limitations
* Currently only GCC, Clang and MSC++ are supported.
* On GCC, optimization flag O2 and O3 are not supported. You must compile the test project with -O1 or -O0.
* In MSC++, your project must have Edit And Continue debug mode on (https://msdn.microsoft.com/en-us/library/esaeyddf.aspx) which is same of /ZI compiler switch. If you don't use this, you will have exceptions mocking destructors (which includes unique_ptr and other smart pointers).
* Can't mock classes with multiple inheritance.
* Can't mock classes with virtual inheritance.
* Currently mocks are not thread safe.
8 changes: 8 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
image:
- Visual Studio 2019
- Visual Studio 2015

configuration:
- Debug
- Release

build:
project: tests\all_tests.sln
Loading

0 comments on commit d87de53

Please sign in to comment.