forked from 3rd-party/fff
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
995f26b939 | ||
|
|
0b9e9f5064 | ||
|
|
2c5ecf5495 | ||
|
|
f38b06e939 | ||
|
|
96827e3a39 | ||
|
|
fe54d15393 | ||
|
|
b76c7c7168 | ||
|
|
35b26878a7 | ||
|
|
eabb622ea0 | ||
|
|
4e031416d6 | ||
|
|
5b930a1382 | ||
|
|
8e0e312556 | ||
|
|
955db6c60c | ||
|
|
0376823b0c | ||
|
|
5fb4dc64e8 | ||
|
|
6011dfde79 | ||
|
|
d0328c9e4a | ||
|
|
840a619e19 | ||
|
|
11b70375a6 | ||
|
|
54c35b6a1b | ||
|
|
3553583f57 | ||
|
|
dc667cbf82 | ||
|
|
15cb0ecbac | ||
|
|
e0ca6b9e72 | ||
|
|
1cac9afc41 | ||
|
|
45c4d31690 | ||
|
|
1c981604a1 | ||
|
|
d0a214c584 | ||
|
|
a31a9ee38c | ||
|
|
cd727d4195 | ||
|
|
86c5e44614 | ||
|
|
b8f9e65387 |
13
.appveyor.yml
Normal file
13
.appveyor.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
version: '{build}-appveyor'
|
||||
image: Visual Studio 2017
|
||||
build:
|
||||
verbosity: minimal
|
||||
test_script:
|
||||
- cmd: >-
|
||||
C:\projects\fff\test\ms_vc_fff_test\x64\Debug\ms_vc_fff_test_c.exe
|
||||
|
||||
C:\projects\fff\test\ms_vc_fff_test\x64\Debug\ms_vc_fff_test_cpp.exe
|
||||
|
||||
C:\projects\fff\test\ms_vc_fff_test\x64\Debug\ms_vc_fff_test_global_cpp.exe
|
||||
|
||||
C:\projects\fff\test\ms_vc_fff_test\x64\Debug\ms_vc_fff_test_global_c.exe
|
||||
28
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Compiler, toolset, platform (please complete the following information):**
|
||||
- OS: [e.g. Ubuntu 16.04 LTS]
|
||||
- Compiler: [e.g. gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
Thank you for your contribution.
|
||||
|
||||
Before submitting this PR, please make sure:
|
||||
|
||||
- [ ] Your code builds clean without any errors or warnings
|
||||
- [ ] You are not breaking consistency
|
||||
- [ ] You have added unit tests
|
||||
- [ ] All tests and other checks pass
|
||||
33
.gitignore
vendored
33
.gitignore
vendored
@@ -2,3 +2,36 @@ build/
|
||||
*~
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
112
README.md
112
README.md
@@ -2,6 +2,31 @@
|
||||
-----------------------------
|
||||
|
||||
[](https://travis-ci.org/meekrosoft/fff)
|
||||
[](https://ci.appveyor.com/project/wulfgarpro/fff/branch/master)
|
||||
[](https://gitter.im/wulfgarpro/fff?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
|
||||
|
||||
- [A Fake Function Framework for C](#a-fake-function-framework-for-c)
|
||||
- [Hello fake world!](#hello-fake-world)
|
||||
- [Capturing arguments](#capturing-arguments)
|
||||
- [Return values](#return-values)
|
||||
- [Resetting a fake](#resetting-a-fake)
|
||||
- [Call history](#call-history)
|
||||
- [Default Argument History](#default-argument-history)
|
||||
- [User Defined Argument History](#user-defined-argument-history)
|
||||
- [Function Return Value Sequences](#function-return-value-sequences)
|
||||
- [Custom Return Value Delegate](#custom-return-value-delegate)
|
||||
- [Custom Return Value Delegate Sequences](#custom-return-value-delegate-sequences)
|
||||
- [Return value history](#return-value-history)
|
||||
- [Variadic Functions](#variadic-functions)
|
||||
- [How do I specify calling conventions for my fake functions?](#how-do-i-specify-calling-conventions-for-my-fake-functions)
|
||||
- [How do I fake a function that returns a value by reference?](#how-do-i-fake-a-function-that-returns-a-value-by-reference)
|
||||
- [How do I fake a function with a function pointer parameter?](#how-do-i-fake-a-function-with-a-function-pointer-parameter)
|
||||
- [How do I reuse a fake across multiple test-suites?](#how-do-i-reuse-a-fake-across-multiple-test-suites)
|
||||
- [Specifying GCC Function Attributes](#specifying-gcc-function-attributes)
|
||||
- [Find out more...](#find-out-more)
|
||||
- [Benefits](#benefits)
|
||||
- [Under the hood](#under-the-hood)
|
||||
- [Cheat Sheet](#cheat-sheet)
|
||||
|
||||
## A Fake Function Framework for C
|
||||
fff is a micro-framework for creating fake C functions for tests. Because life
|
||||
@@ -198,7 +223,7 @@ void setup()
|
||||
|
||||
## Call history
|
||||
Say you want to test that a function calls functionA, then functionB, then
|
||||
functionA again, how would you do that? Well `fff` maintains a call
|
||||
functionA again, how would you do that? Well fff maintains a call
|
||||
history so that it is easy to assert these expectations.
|
||||
|
||||
Here's how it works:
|
||||
@@ -260,7 +285,7 @@ The other is to check if the call count is greater than the history size:
|
||||
ASSERT(voidfunc2_fake.arg_history_len < voidfunc2_fake.call_count);
|
||||
```
|
||||
|
||||
The argument histories for a fake function are reset when the RESET_FAKE
|
||||
The argument histories for a fake function are reset when the `RESET_FAKE`
|
||||
function is called
|
||||
|
||||
## User Defined Argument History
|
||||
@@ -308,7 +333,7 @@ value in the sequence indefinitely.
|
||||
## Custom Return Value Delegate
|
||||
|
||||
You can specify your own function to provide the return value for the fake. This
|
||||
is done by setting the custom_fake member of the fake. Here's an example:
|
||||
is done by setting the `custom_fake` member of the fake. Here's an example:
|
||||
|
||||
```c
|
||||
#define MEANING_OF_LIFE 42
|
||||
@@ -330,7 +355,7 @@ Say you have a function with an out parameter, and you want it to have a differe
|
||||
on the first three calls, for example: set the value 'x' to the out parameter on the first call,
|
||||
the value 'y' to the out parameter on the second call, and the value 'z' to the out parameter
|
||||
on the third call. You can specify a sequence of custom functions to a non-variadic function
|
||||
using the SET_CUSTOM_FAKE_SEQ macro. Here's an example:
|
||||
using the `SET_CUSTOM_FAKE_SEQ` macro. Here's an example:
|
||||
|
||||
```c
|
||||
void voidfunc1outparam_custom_fake1(char *a)
|
||||
@@ -366,14 +391,15 @@ TEST_F(FFFTestSuite, custom_fake_sequence_not_exausthed)
|
||||
}
|
||||
```
|
||||
|
||||
The fake will call your custom functions in the order specified by the SET_CUSTOM_FAKE_SEQ
|
||||
The fake will call your custom functions in the order specified by the `SET_CUSTOM_FAKE_SEQ`
|
||||
macro. When the last custom fake is reached the fake will keep calling the last custom
|
||||
fake in the sequence. This macro works much like the SET_RETURN_SEQ macro.
|
||||
fake in the sequence. This macro works much like the `SET_RETURN_SEQ` macro.
|
||||
|
||||
## Return value history
|
||||
|
||||
Say you have two functions f1 and f2. f2 must be called to release some resource
|
||||
allocated by f1, but only in the cases where f1 returns zero. f1 could be
|
||||
pthread_mutex_trylock and f2 could be pthread_mutex_unlock. <tt>fff</tt> will
|
||||
pthread_mutex_trylock and f2 could be pthread_mutex_unlock. fff will
|
||||
save the history of returned values so this can be easily checked, even when
|
||||
you use a sequence of custom fakes. Here's a simple example:
|
||||
|
||||
@@ -389,18 +415,18 @@ you use a sequence of custom fakes. Here's a simple example:
|
||||
ASSERT_EQ(myReturnVals[2], longfunc0_fake.return_val_history[2]);
|
||||
}
|
||||
|
||||
You access the returned values in the <tt>return_val_history</tt> field.
|
||||
You access the returned values in the `return_val_history` field.
|
||||
|
||||
## Variadic Functions
|
||||
|
||||
You can fake variadic functions using the macros <tt>FAKE_VALUE_FUNC_VARARG</tt>
|
||||
and <tt>FAKE_VOID_FUNC_VARARG</tt>. For instance:
|
||||
You can fake variadic functions using the macros `FAKE_VALUE_FUNC_VARARG`
|
||||
and `FAKE_VOID_FUNC_VARARG`. For instance:
|
||||
|
||||
FAKE_VALUE_FUNC_VARARG(int, fprintf, FILE *, const char*, ...);
|
||||
|
||||
In order to access the variadic parameters from a custom fake function, declare a
|
||||
<tt>va_list</tt> parameter. For instance, a custom fake for <tt>fprintf()</tt>
|
||||
could call the real <tt>fprintf()</tt> like this:
|
||||
`va_list` parameter. For instance, a custom fake for `fprintf()`
|
||||
could call the real `fprintf()` like this:
|
||||
|
||||
int fprintf_custom(FILE *stream, const char *format, va_list ap) {
|
||||
if (fprintf0_fake.return_val < 0) // should we fail?
|
||||
@@ -408,8 +434,29 @@ could call the real <tt>fprintf()</tt> like this:
|
||||
return vfprintf(stream, format, ap);
|
||||
}
|
||||
|
||||
Just like [return value delegates](#custom-return-value-delegate-sequences), you can also specify sequences for variadic functions using `SET_CUSTOM_FAKE_SEQ`.
|
||||
See the test files for examples.
|
||||
|
||||
## How do I specify calling conventions for my fake functions?
|
||||
|
||||
fff has a limited capability for enabling specification of Microsoft's Visual C/C++ calling conventions, but this support must be enabled when generating fff's header file `fff.h`.
|
||||
|
||||
```bash
|
||||
ruby fakegen.rb --with-calling-conventions > fff.h
|
||||
```
|
||||
|
||||
By enabling this support, all of fff's fake function scaffolding will necessitate the specification of a calling convention, e.g. `__cdecl` for each VALUE or VOID fake.
|
||||
|
||||
Here are some basic examples: take note that the placement of the calling convention being specified is different depending on whether the fake is a VOID or VALUE function.
|
||||
|
||||
```c
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
|
||||
FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
|
||||
```
|
||||
|
||||
## How do I fake a function that returns a value by reference?
|
||||
The basic mechanism that FFF provides you in this case is the custom_fake field described in the *Custom Return Value Delegate* example above.
|
||||
|
||||
The basic mechanism that fff provides you in this case is the custom_fake field described in the *Custom Return Value Delegate* example above.
|
||||
|
||||
You need to create a custom function (e.g. getTime_custom_fake) to produce the output optionally by use of a helper variable (e.g. getTime_custom_now) to retrieve that output from. Then some creativity to tie it all together. The most important part (IMHO) is to keep your test case readable and maintainable.
|
||||
|
||||
@@ -448,7 +495,8 @@ TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_output
|
||||
```
|
||||
|
||||
## How do I fake a function with a function pointer parameter?
|
||||
Using FFF to stub functions that have function pointer parameter can cause problems when trying to stub them. Presented here is an example how to deal with this situation.
|
||||
|
||||
Using fff to stub functions that have function pointer parameter can cause problems when trying to stub them. Presented here is an example how to deal with this situation.
|
||||
|
||||
If you need to stub a function that has a function pointer parameter, e.g. something like:
|
||||
|
||||
@@ -458,7 +506,7 @@ typedef int timer_handle;
|
||||
extern int timer_start(timer_handle handle, long delay, void (*cb_function) (int arg), int arg);
|
||||
```
|
||||
|
||||
Then creating a fake like below will horribly fail when trying to compile because the FFF macro will internally expand into an illegal variable ```int (*)(int) arg2_val```.
|
||||
Then creating a fake like below will horribly fail when trying to compile because the fff macro will internally expand into an illegal variable ```int (*)(int) arg2_val```.
|
||||
|
||||
```c
|
||||
/* The fake, attempt one */
|
||||
@@ -473,7 +521,7 @@ FAKE_VALUE_FUNC(int,
|
||||
The solution to this problem is to create a bridging type that needs only to be visible in the unit tester. The fake will use that intermediate type. This way the compiler will not complain because the types match.
|
||||
|
||||
```c
|
||||
/* Additional type needed to be able to use callback in FFF */
|
||||
/* Additional type needed to be able to use callback in fff */
|
||||
typedef void (*timer_cb) (int argument);
|
||||
|
||||
/* The fake, attempt two */
|
||||
@@ -531,7 +579,8 @@ TEST_F(FFFTestSuite, test_fake_with_function_pointer)
|
||||
}
|
||||
```
|
||||
## How do I reuse a fake across multiple test-suites?
|
||||
FFF functions like FAKE_VALUE_FUNC will perform both the declaration AND the definition of the fake function and the corresponding data structs. This cannot be placed in a header, since it will lead to multiple definitions of the fake functions.
|
||||
|
||||
fff functions like `FAKE_VALUE_FUNC` will perform both the declaration AND the definition of the fake function and the corresponding data structs. This cannot be placed in a header, since it will lead to multiple definitions of the fake functions.
|
||||
|
||||
The solution is to separate declaration and definition of the fakes, and place the declaration into a public header file, and the definition into a private source file.
|
||||
|
||||
@@ -556,6 +605,26 @@ DEFINE_FAKE_VALUE_FUNC_VARARG(int, value_function_vargs, const char *, int, ...)
|
||||
DEFINE_FAKE_VOID_FUNC_VARARG(void_function_vargs, const char *, int, ...);
|
||||
|
||||
```
|
||||
## Specifying GCC Function Attributes
|
||||
|
||||
You can specify GCC function attributes for your fakes using the `FFF_GCC_FUNCTION_ATTRIBUTES` directive.
|
||||
|
||||
### Weak Functions
|
||||
|
||||
One usful attribute is the _weak_ attribute that marks a function such that it can be overridden by a non-weak variant at link time. Using weak functions in combination with FFF can help simplify your testing approach.
|
||||
|
||||
For example:
|
||||
* Define a library of fake functions, e.g. libfake.a.
|
||||
* Link a binary (you might have many) that defines a subset of real variants of the fake functions to the aforementioned fake library.
|
||||
* This has the benefit of allowing a binary to selectively use a subset of the required fake functions while testing the real variants without the need for many different make targets.
|
||||
|
||||
You can mark all fakes with the weak attribute like so:
|
||||
```
|
||||
#define FFF_GCC_FUNCTION_ATTRIBUTES __attribute__((weak))
|
||||
#include "fff.h"
|
||||
```
|
||||
|
||||
See the example project that demonstrates the above approach: _./examples/weak_linking_.
|
||||
|
||||
## Find out more...
|
||||
|
||||
@@ -572,10 +641,11 @@ So whats the point?
|
||||
* To work in both C and C++ test environments
|
||||
|
||||
|
||||
## Under the hood:
|
||||
## Under the Hood
|
||||
* The fff.h header file is generated by a ruby script
|
||||
* There are tests under src/test
|
||||
* There is an example for testing an embedded UI and a hardware driver under src/examples
|
||||
* There are tests under _./test_
|
||||
* There is an example for testing an embedded UI and a hardware driver under _./examples_
|
||||
* There is an example of weak_linking under _./examples_
|
||||
|
||||
|
||||
## Cheat Sheet
|
||||
@@ -583,4 +653,6 @@ So whats the point?
|
||||
|-------|-------------|---------|
|
||||
| FAKE_VOID_FUNC(fn [,arg_types*]); | Define a fake function named fn returning void with n arguments | FAKE_VOID_FUNC(DISPLAY_output_message, const char*); |
|
||||
| FAKE_VALUE_FUNC(return_type, fn [,arg_types*]); | Define a fake function returning a value with type return_type taking n arguments | FAKE_VALUE_FUNC(int, DISPLAY_get_line_insert_index); |
|
||||
| FAKE_VOID_FUNC_VARARG(fn [,arg_types*], ...); | Define a fake variadic function returning void with type return_type taking n arguments and n variadic arguments | FAKE_VOID_FUNC_VARARG(fn, const char*, ...) |
|
||||
| FAKE_VALUE_FUNC_VARARG(return_type, fn [,arg_types*], ...); | Define a fake variadic function returning a value with type return_type taking n arguments and n variadic arguments | FAKE_VALUE_FUNC_VARARG(int, fprintf, FILE*, const char*, ...) |
|
||||
| RESET_FAKE(fn); | Reset the state of fake function called fn | RESET_FAKE(DISPLAY_init); |
|
||||
|
||||
@@ -14,3 +14,7 @@ build/fff_test_glob_c
|
||||
build/fff_test_glob_cpp --gtest_output=xml:build/test_global_results.xml
|
||||
build/driver_testing --gtest_output=xml:build/driver_testing.xml
|
||||
build/driver_testing_fff --gtest_output=xml:build/driver_testing_fff.xml
|
||||
build/weak_linking/test_display
|
||||
build/weak_linking/test_sensor
|
||||
build/weak_linking/test_main
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
all:
|
||||
cd embedded_ui; $(MAKE) all
|
||||
cd driver_testing; $(MAKE) all
|
||||
|
||||
cd weak_linking; $(MAKE) all
|
||||
clean:
|
||||
cd embedded_ui; $(MAKE) clean
|
||||
cd driver_testing; $(MAKE) clean
|
||||
cd weak_linking; $(MAKE) clean
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extern "C"{
|
||||
#include "driver.h"
|
||||
#include "registers.h"
|
||||
#include "hardware_abstraction.h"
|
||||
}
|
||||
#include "../../fff.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
39
examples/weak_linking/Makefile
Normal file
39
examples/weak_linking/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
BUILD_DIR = ../../build
|
||||
INCLUDE_DIRS = -I "../../" -I "./src/"
|
||||
|
||||
BUILD_DIR_FAKE = $(BUILD_DIR)/weak_linking
|
||||
CC = gcc
|
||||
WEAK_FLAGS=-Wall -DFFF_GCC_FUNCTION_ATTRIBUTES="__attribute__((weak))"
|
||||
|
||||
$(BUILD_DIR_FAKE)/%.o: test/%.c
|
||||
@echo "Compiling "$@
|
||||
$(CC) $(WEAK_FLAGS) $(INCLUDE_DIRS) -g -O0 -c $< -o $@
|
||||
|
||||
FAKE_OBJECTS = $(BUILD_DIR_FAKE)/display.fake.o $(BUILD_DIR_FAKE)/sensor.fake.o $(BUILD_DIR_FAKE)/sensor.fake.o $(BUILD_DIR_FAKE)/error.fake.o $(BUILD_DIR_FAKE)/bus.fake.o $(BUILD_DIR_FAKE)/test_common.o
|
||||
|
||||
TEST_BINARIES = $(BUILD_DIR_FAKE)/test_main $(BUILD_DIR_FAKE)/test_display $(BUILD_DIR_FAKE)/test_sensor
|
||||
mkdir:
|
||||
mkdir -p $(BUILD_DIR_FAKE)/
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR_FAKE)/
|
||||
|
||||
$(BUILD_DIR_FAKE)/libfakes.a: $(FAKE_OBJECTS)
|
||||
ar r $@ $^
|
||||
|
||||
# First case where we need __weak__ linking:
|
||||
# - If we have the build objects (for some reason) in order where the fake object comes first.
|
||||
$(BUILD_DIR_FAKE)/test_display: ./test/display.test.c $(BUILD_DIR_FAKE)/libfakes.a ./src/display.c
|
||||
$(CC) $(WEAK_FLAGS) $(INCLUDE_DIRS) -o $@ $^
|
||||
|
||||
# Second case where we need weak linking:
|
||||
# - If we use an object from the fake object -> gcc linker will include it.
|
||||
$(BUILD_DIR_FAKE)/test_sensor: ./test/sensor.test.c ./src/sensor.c $(BUILD_DIR_FAKE)/libfakes.a
|
||||
$(CC) $(WEAK_FLAGS) $(INCLUDE_DIRS) -o $@ $^
|
||||
|
||||
# Third case where we need weak linking:
|
||||
# - We want to fake one function but not all.
|
||||
$(BUILD_DIR_FAKE)/test_main: ./test/main.test.c ./src/main.c $(BUILD_DIR_FAKE)/libfakes.a
|
||||
$(CC) $(WEAK_FLAGS) $(INCLUDE_DIRS) -o $@ $^
|
||||
|
||||
all: mkdir $(TEST_BINARIES)
|
||||
30
examples/weak_linking/src/bus.c
Normal file
30
examples/weak_linking/src/bus.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
uint16_t* BUS_REGISTER_BASE = (uint16_t*)0xDEADBEEF;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t action;
|
||||
uint16_t reg;
|
||||
uint8_t input;
|
||||
uint8_t output
|
||||
} BusDevice;
|
||||
|
||||
BusDevice* BUS = (BusDevice*)BUS_REGISTER_BASE;
|
||||
|
||||
bool bus_read_write( uint8_t dev, uint8_t registry, uint8_t* buffer, int len, bool assume_echo )
|
||||
{
|
||||
// Something that we dont want to run, since the emulation would be hard.
|
||||
BUS->action = 0x01;
|
||||
BUS->reg = registry;
|
||||
for ( int loop =0 ; loop < len; loop ++ )
|
||||
{
|
||||
char output = buffer[loop];
|
||||
BUS->output = output;
|
||||
buffer[loop] = BUS->input;
|
||||
|
||||
if ( ( assume_echo ) && ( buffer[loop] != output ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
6
examples/weak_linking/src/bus.h
Normal file
6
examples/weak_linking/src/bus.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "error.h"
|
||||
|
||||
bool bus_read_write( uint8_t dev, uint8_t registry, uint8_t* buffer, int len, bool assume_echo );
|
||||
bool bus_write( uint8_t dev, uint8_t registry, const uint8_t* buffer, int len, bool assume_echo );
|
||||
29
examples/weak_linking/src/display.c
Normal file
29
examples/weak_linking/src/display.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "bus.h"
|
||||
|
||||
#define DISPLAY_ADDRESS 0xAF
|
||||
#define DISPLAY_REG_INIT 0x10
|
||||
#define DISPLAY_REG_UPDATE 0x20
|
||||
|
||||
bool display_init()
|
||||
{
|
||||
char init_config[] = { 0xDE, 0xFE, 0x00 };
|
||||
bus_read_write( DISPLAY_ADDRESS, DISPLAY_REG_INIT, (uint8_t*)init_config, 3, false );
|
||||
|
||||
if (init_config[2] != 0x10)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void display_update( const char* info )
|
||||
{
|
||||
int len = strlen( info );
|
||||
|
||||
if ( bus_write( DISPLAY_ADDRESS, DISPLAY_REG_UPDATE, (const uint8_t*)info, len, true ) != true )
|
||||
{
|
||||
runtime_error("display update failed!");
|
||||
}
|
||||
}
|
||||
5
examples/weak_linking/src/display.h
Normal file
5
examples/weak_linking/src/display.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include "error.h"
|
||||
|
||||
bool display_init();
|
||||
void display_update( const char* info );
|
||||
10
examples/weak_linking/src/error.c
Normal file
10
examples/weak_linking/src/error.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <assert.h>
|
||||
#include "error.h"
|
||||
|
||||
char* runtime_error_nice_print( const char* msg )
|
||||
{
|
||||
char* buffer = malloc(512);
|
||||
snprintf(buffer, 512, "Got error: %s", msg );
|
||||
buffer[511] = 0;
|
||||
return buffer;
|
||||
}
|
||||
7
examples/weak_linking/src/error.h
Normal file
7
examples/weak_linking/src/error.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
void runtime_error( const char* msg );
|
||||
char* runtime_error_nice_print( const char* msg );
|
||||
27
examples/weak_linking/src/main.c
Normal file
27
examples/weak_linking/src/main.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "sensor.h"
|
||||
|
||||
void give_error( const char* msg )
|
||||
{
|
||||
char* buffer = runtime_error_nice_print( msg );
|
||||
runtime_error( buffer );
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
int update_main( void )
|
||||
{
|
||||
if ( !sensor_init() )
|
||||
runtime_error("sensor init failed");
|
||||
|
||||
if ( !display_init() )
|
||||
runtime_error("display init failed");
|
||||
|
||||
char buffer[32];
|
||||
float reading = sensor_read();
|
||||
snprintf( buffer, 32, "Sensor: %0.1f", reading );
|
||||
display_update( buffer );
|
||||
return 0;
|
||||
}
|
||||
29
examples/weak_linking/src/sensor.c
Normal file
29
examples/weak_linking/src/sensor.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "sensor.h"
|
||||
#include "bus.h"
|
||||
|
||||
#define SENSOR_ADDRESS 0xAA
|
||||
#define SENSOR_REG_READ 0xF0
|
||||
|
||||
float LOCAL_buffer[4];
|
||||
|
||||
bool sensor_init()
|
||||
{
|
||||
memset( LOCAL_buffer, 0x00, sizeof(LOCAL_buffer));
|
||||
return true;
|
||||
}
|
||||
|
||||
float sensor_read()
|
||||
{
|
||||
char data[4] = { 0xFF, 0xFF, 0x00, 0x00 };
|
||||
bus_read_write( SENSOR_ADDRESS, SENSOR_REG_READ, (uint8_t*)&data, 4, false );
|
||||
|
||||
if (data[0] != 0x10)
|
||||
{
|
||||
runtime_error("sensor read failed");
|
||||
}
|
||||
|
||||
float ret_value = data[1] + data[2] / 256.0;
|
||||
return ret_value;
|
||||
}
|
||||
6
examples/weak_linking/src/sensor.h
Normal file
6
examples/weak_linking/src/sensor.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "error.h"
|
||||
|
||||
bool sensor_init();
|
||||
float sensor_read();
|
||||
4
examples/weak_linking/test/bus.fake.c
Normal file
4
examples/weak_linking/test/bus.fake.c
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "bus.fake.h"
|
||||
|
||||
DEFINE_FAKE_VALUE_FUNC( bool, bus_read_write, uint8_t, uint8_t, uint8_t*, int, bool );
|
||||
DEFINE_FAKE_VALUE_FUNC( bool, bus_write, uint8_t, uint8_t, const uint8_t*, int, bool );
|
||||
10
examples/weak_linking/test/bus.fake.h
Normal file
10
examples/weak_linking/test/bus.fake.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _AUTOFAKE_BUS_H
|
||||
#define _AUTOFAKE_BUS_H
|
||||
|
||||
#include "fff.h"
|
||||
#include "bus.h"
|
||||
|
||||
DECLARE_FAKE_VALUE_FUNC( bool, bus_read_write, uint8_t, uint8_t, uint8_t*, int, bool );
|
||||
DECLARE_FAKE_VALUE_FUNC( bool, bus_write, uint8_t, uint8_t, const uint8_t*, int, bool );
|
||||
|
||||
#endif // _AUTOFAKE_BUS_H
|
||||
4
examples/weak_linking/test/display.fake.c
Normal file
4
examples/weak_linking/test/display.fake.c
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "display.fake.h"
|
||||
|
||||
DEFINE_FAKE_VALUE_FUNC( bool, display_init );
|
||||
DEFINE_FAKE_VOID_FUNC( display_update, const char* );
|
||||
10
examples/weak_linking/test/display.fake.h
Normal file
10
examples/weak_linking/test/display.fake.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _AUTOFAKE_DISPLAY_H
|
||||
#define _AUTOFAKE_DISPLAY_H
|
||||
|
||||
#include "fff.h"
|
||||
#include "display.h"
|
||||
|
||||
DECLARE_FAKE_VALUE_FUNC( bool, display_init );
|
||||
DECLARE_FAKE_VOID_FUNC( display_update, const char* );
|
||||
|
||||
#endif // _AUTOFAKE_DISPLAY_H
|
||||
24
examples/weak_linking/test/display.test.c
Normal file
24
examples/weak_linking/test/display.test.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "test_common.h"
|
||||
#include "display.h"
|
||||
|
||||
DEFINE_FFF_GLOBALS;
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init_tests(); // Resets common and hook errors to asserts.
|
||||
|
||||
GLOBAL_TEST_bus_read_ret[2] = 0x10;
|
||||
assert( display_init() == true );
|
||||
assert( bus_read_write_fake.call_count == 1);
|
||||
|
||||
display_update( "TEST INFO" );
|
||||
assert( bus_read_write_fake.call_count == 1 );
|
||||
assert( bus_write_fake.call_count == 1 );
|
||||
|
||||
GLOBAL_TEST_bus_read_ret[2] = 0x00;
|
||||
assert( display_init() == false );
|
||||
|
||||
printf("Test " __FILE__ " ok\n");
|
||||
return 0;
|
||||
}
|
||||
4
examples/weak_linking/test/error.fake.c
Normal file
4
examples/weak_linking/test/error.fake.c
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "error.fake.h"
|
||||
|
||||
DEFINE_FAKE_VOID_FUNC( runtime_error, const char* );
|
||||
DEFINE_FAKE_VALUE_FUNC( char*, runtime_error_nice_print, const char* );
|
||||
10
examples/weak_linking/test/error.fake.h
Normal file
10
examples/weak_linking/test/error.fake.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _AUTOFAKE_ERROR_H
|
||||
#define _AUTOFAKE_ERROR_H
|
||||
|
||||
#include "fff.h"
|
||||
#include "error.h"
|
||||
|
||||
DECLARE_FAKE_VOID_FUNC( runtime_error, const char* );
|
||||
DECLARE_FAKE_VALUE_FUNC( char*, runtime_error_nice_print, const char* );
|
||||
|
||||
#endif // _AUTOFAKE_ERROR_H
|
||||
26
examples/weak_linking/test/main.test.c
Normal file
26
examples/weak_linking/test/main.test.c
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#include "display.fake.h"
|
||||
#include "sensor.fake.h"
|
||||
#include "test_common.h"
|
||||
|
||||
DEFINE_FFF_GLOBALS;
|
||||
|
||||
|
||||
int update_main( void );
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init_tests(); // Resets common and hook errors to asserts.
|
||||
|
||||
sensor_init_fake.return_val = true;
|
||||
display_init_fake.return_val = true;
|
||||
|
||||
update_main();
|
||||
|
||||
assert( sensor_init_fake.call_count == 1 );
|
||||
assert( display_init_fake.call_count == 1 );
|
||||
assert( display_update_fake.call_count == 1 );
|
||||
|
||||
printf("Test " __FILE__ " ok\n");
|
||||
return 0;
|
||||
}
|
||||
11
examples/weak_linking/test/sensor.fake.c
Normal file
11
examples/weak_linking/test/sensor.fake.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "sensor.fake.h"
|
||||
|
||||
DEFINE_FAKE_VALUE_FUNC( bool, sensor_init );
|
||||
DEFINE_FAKE_VALUE_FUNC( float, sensor_read );
|
||||
|
||||
void TEST_sensor_generate_data( char* buffer, float value )
|
||||
{
|
||||
buffer[0] = 0x10;
|
||||
buffer[1] = (int)(value);
|
||||
buffer[2] = (value - buffer[1])*255;
|
||||
}
|
||||
13
examples/weak_linking/test/sensor.fake.h
Normal file
13
examples/weak_linking/test/sensor.fake.h
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
#ifndef _AUTOMOCK_SENSOR_H
|
||||
#define _AUTOMOCK_SENSOR_H
|
||||
|
||||
#include "fff.h"
|
||||
#include "sensor.h"
|
||||
|
||||
DECLARE_FAKE_VALUE_FUNC( bool, sensor_init );
|
||||
DECLARE_FAKE_VALUE_FUNC( float, sensor_read );
|
||||
|
||||
void TEST_sensor_generate_data( char* buffer, float value );
|
||||
|
||||
#endif // _AUTOMOCK_SENSOR_H
|
||||
23
examples/weak_linking/test/sensor.test.c
Normal file
23
examples/weak_linking/test/sensor.test.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_common.h"
|
||||
|
||||
#include "sensor.h"
|
||||
#include "sensor.fake.h"
|
||||
|
||||
DEFINE_FFF_GLOBALS;
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init_tests();
|
||||
|
||||
assert( sensor_init() == true );
|
||||
|
||||
TEST_sensor_generate_data( GLOBAL_TEST_bus_read_ret, 1.5f );
|
||||
float value = sensor_read();
|
||||
float value_error = value - 1.5f;
|
||||
assert( value_error < 0.1f && value_error > -0.1f );
|
||||
printf("Test " __FILE__ " ok\n");
|
||||
return 0;
|
||||
}
|
||||
33
examples/weak_linking/test/test_common.c
Normal file
33
examples/weak_linking/test/test_common.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "test_common.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char GLOBAL_TEST_bus_read_ret[32];
|
||||
|
||||
|
||||
void spoof_runtime_error( const char* info )
|
||||
{
|
||||
fprintf(stderr, "Runtime error: %s\n", info );
|
||||
assert(0);
|
||||
}
|
||||
|
||||
bool spoof_bus_read_write( uint8_t dev, uint8_t registry, uint8_t* buffer, int len, bool assume_echo )
|
||||
{
|
||||
memcpy( buffer, GLOBAL_TEST_bus_read_ret, len );
|
||||
fprintf(stderr, "bus spoof %d %d\n", (int)dev, (int)registry );
|
||||
return true;
|
||||
}
|
||||
|
||||
void init_tests()
|
||||
{
|
||||
memset( GLOBAL_TEST_bus_read_ret, 0x00, sizeof(GLOBAL_TEST_bus_read_ret));
|
||||
FFF_RESET_HISTORY();
|
||||
|
||||
RESET_FAKE(bus_read_write);
|
||||
RESET_FAKE(bus_write);
|
||||
RESET_FAKE(runtime_error);
|
||||
|
||||
runtime_error_fake.custom_fake = spoof_runtime_error;
|
||||
bus_read_write_fake.custom_fake = spoof_bus_read_write;
|
||||
bus_write_fake.return_val = true;
|
||||
}
|
||||
13
examples/weak_linking/test/test_common.h
Normal file
13
examples/weak_linking/test/test_common.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fff.h"
|
||||
#include "bus.fake.h"
|
||||
#include "error.fake.h"
|
||||
|
||||
|
||||
void init_tests();
|
||||
|
||||
extern char GLOBAL_TEST_bus_read_ret[32];
|
||||
260
fakegen.rb
260
fakegen.rb
@@ -26,6 +26,12 @@ def output_constants
|
||||
putd "#define FFF_CALL_HISTORY_LEN (#{$MAX_CALL_HISTORY}u)"
|
||||
}
|
||||
putd "#endif"
|
||||
putd "#ifndef FFF_GCC_FUNCTION_ATTRIBUTES"
|
||||
indent {
|
||||
putd "#define FFF_GCC_FUNCTION_ATTRIBUTES"
|
||||
}
|
||||
putd "#endif"
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -159,9 +165,9 @@ def define_value_function_variables_helper
|
||||
puts
|
||||
putd_backslash "#define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE)"
|
||||
indent {
|
||||
putd_backslash "RETURN_TYPE return_val;"
|
||||
putd_backslash "int return_val_seq_len;"
|
||||
putd_backslash "int return_val_seq_idx;"
|
||||
putd_backslash "RETURN_TYPE return_val;"
|
||||
putd_backslash "int return_val_seq_len;"
|
||||
putd_backslash "int return_val_seq_idx;"
|
||||
putd_backslash "RETURN_TYPE * return_val_seq;"
|
||||
}
|
||||
end
|
||||
@@ -208,8 +214,8 @@ def define_extern_c_helper
|
||||
puts
|
||||
putd "#ifdef __cplusplus"
|
||||
indent {
|
||||
putd "#define FFF_EXTERN_C extern \"C\"{"
|
||||
putd "#define FFF_END_EXTERN_C } "
|
||||
putd "#define FFF_EXTERN_C extern \"C\"{"
|
||||
putd "#define FFF_END_EXTERN_C } "
|
||||
}
|
||||
putd "#else /* ansi c */"
|
||||
indent {
|
||||
@@ -254,12 +260,12 @@ def popd
|
||||
end
|
||||
|
||||
def indent
|
||||
pushd
|
||||
pushd
|
||||
yield
|
||||
popd
|
||||
end
|
||||
|
||||
def output_macro(arg_count, has_varargs, is_value_function)
|
||||
def output_macro(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
|
||||
vararg_name = has_varargs ? "_VARARG" : ""
|
||||
fake_macro_name = is_value_function ? "FAKE_VALUE_FUNC#{arg_count}#{vararg_name}" : "FAKE_VOID_FUNC#{arg_count}#{vararg_name}"
|
||||
@@ -269,53 +275,50 @@ def output_macro(arg_count, has_varargs, is_value_function)
|
||||
return_type = is_value_function ? "RETURN_TYPE" : ""
|
||||
|
||||
puts
|
||||
output_macro_header(declare_macro_name, saved_arg_count, has_varargs, return_type)
|
||||
output_macro_header(declare_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
indent {
|
||||
extern_c { # define argument capture variables
|
||||
output_variables(saved_arg_count, has_varargs, is_value_function)
|
||||
}
|
||||
output_variables(saved_arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
}
|
||||
|
||||
|
||||
puts
|
||||
output_macro_header(define_macro_name, saved_arg_count, has_varargs, return_type)
|
||||
output_macro_header(define_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
indent {
|
||||
extern_c {
|
||||
putd_backslash "FUNCNAME##_Fake FUNCNAME##_fake;"
|
||||
putd_backslash function_signature(saved_arg_count, has_varargs, is_value_function) + "{"
|
||||
indent {
|
||||
output_function_body(saved_arg_count, has_varargs, is_value_function)
|
||||
}
|
||||
putd_backslash "}"
|
||||
putd_backslash "DEFINE_RESET_FUNCTION(FUNCNAME)"
|
||||
putd_backslash "FUNCNAME##_Fake FUNCNAME##_fake;"
|
||||
putd_backslash function_signature(saved_arg_count, has_varargs, has_calling_conventions, is_value_function) + "{"
|
||||
indent {
|
||||
output_function_body(saved_arg_count, has_varargs, is_value_function)
|
||||
}
|
||||
putd_backslash "}"
|
||||
putd_backslash "DEFINE_RESET_FUNCTION(FUNCNAME)"
|
||||
}
|
||||
|
||||
|
||||
puts
|
||||
|
||||
output_macro_header(fake_macro_name, saved_arg_count, has_varargs, return_type)
|
||||
|
||||
output_macro_header(fake_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
indent {
|
||||
putd macro_signature_for(declare_macro_name, saved_arg_count, has_varargs, return_type)
|
||||
putd macro_signature_for(define_macro_name, saved_arg_count, has_varargs, return_type)
|
||||
putd macro_signature_for(declare_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
putd macro_signature_for(define_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
puts
|
||||
}
|
||||
end
|
||||
|
||||
def output_macro_header(macro_name, arg_count, has_varargs, return_type)
|
||||
output_macro_name(macro_name, arg_count, has_varargs, return_type)
|
||||
def output_macro_header(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
output_macro_name(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
end
|
||||
|
||||
# #define #macro_name(RETURN_TYPE, FUNCNAME, ARG0,...)
|
||||
def output_macro_name(macro_name, arg_count, has_varargs, return_type)
|
||||
putd "#define " + macro_signature_for(macro_name, arg_count, has_varargs, return_type)
|
||||
def output_macro_name(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
putd "#define " + macro_signature_for(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
end
|
||||
|
||||
# #macro_name(RETURN_TYPE, FUNCNAME, ARG0,...) \
|
||||
def macro_signature_for(macro_name, arg_count, has_varargs, return_type)
|
||||
def macro_signature_for(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
|
||||
parameter_list = "#{macro_name}("
|
||||
if return_type != ""
|
||||
parameter_list += return_type
|
||||
parameter_list += ", "
|
||||
end
|
||||
parameter_list += "CALLING_CONVENTION, " if (has_calling_conventions)
|
||||
parameter_list += "FUNCNAME"
|
||||
|
||||
arg_count.times { |i| parameter_list += ", ARG#{i}_TYPE" }
|
||||
@@ -327,21 +330,21 @@ def macro_signature_for(macro_name, arg_count, has_varargs, return_type)
|
||||
parameter_list
|
||||
end
|
||||
|
||||
def output_variables(arg_count, has_varargs, is_value_function)
|
||||
def output_variables(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
in_struct{
|
||||
arg_count.times { |argN|
|
||||
arg_count.times { |argN|
|
||||
putd_backslash "DECLARE_ARG(ARG#{argN}_TYPE, #{argN}, FUNCNAME)"
|
||||
}
|
||||
putd_backslash "DECLARE_ALL_FUNC_COMMON"
|
||||
putd_backslash "DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE)" unless not is_value_function
|
||||
putd_backslash "DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE)" unless not is_value_function
|
||||
putd_backslash "DECLARE_CUSTOM_FAKE_SEQ_VARIABLES"
|
||||
output_custom_function_signature(arg_count, has_varargs, is_value_function)
|
||||
output_custom_function_array(arg_count, has_varargs, is_value_function)
|
||||
output_custom_function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
output_custom_function_array(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
}
|
||||
putd_backslash "extern FUNCNAME##_Fake FUNCNAME##_fake;"
|
||||
putd_backslash "void FUNCNAME##_reset(void);"
|
||||
putd_backslash function_signature(arg_count, has_varargs, is_value_function) + ";"
|
||||
putd_backslash function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function) + ";"
|
||||
end
|
||||
|
||||
#example: ARG0_TYPE arg0, ARG1_TYPE arg1
|
||||
@@ -360,26 +363,35 @@ def arg_list(args_count)
|
||||
end
|
||||
|
||||
# RETURN_TYPE (*custom_fake)(ARG0_TYPE arg0);\
|
||||
# OR
|
||||
# RETURN_TYPE (CALLING_CONVENTION *custom_fake)(ARG0_TYPE arg0);\
|
||||
#
|
||||
# void (*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2);\
|
||||
def output_custom_function_signature(arg_count, has_varargs, is_value_function)
|
||||
def output_custom_function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
return_type = is_value_function ? "RETURN_TYPE" : "void"
|
||||
ap_list = has_varargs ? ", va_list ap" : ""
|
||||
signature = "(*custom_fake)(#{arg_val_list(arg_count)}#{ap_list});"
|
||||
signature = has_calling_conventions ? "(CALLING_CONVENTION *custom_fake)" : "(*custom_fake)"
|
||||
signature += "(#{arg_val_list(arg_count)}#{ap_list});"
|
||||
putd_backslash return_type + signature
|
||||
end
|
||||
|
||||
def output_custom_function_array(arg_count, has_varargs, is_value_function)
|
||||
def output_custom_function_array(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
return_type = is_value_function ? "RETURN_TYPE" : "void"
|
||||
ap_list = has_varargs ? ", va_list ap" : ""
|
||||
custom_array = "(**custom_fake_seq)(#{arg_val_list(arg_count)}#{ap_list});"
|
||||
custom_array = has_calling_conventions ? "(CALLING_CONVENTION **custom_fake_seq)" : "(**custom_fake_seq)"
|
||||
custom_array += "(#{arg_val_list(arg_count)}#{ap_list});"
|
||||
putd_backslash return_type + custom_array
|
||||
end
|
||||
|
||||
# example: RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1)
|
||||
def function_signature(arg_count, has_varargs, is_value_function)
|
||||
# OR
|
||||
# RETURN_TYPE CALLING_CONVENTION FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1)
|
||||
def function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)
|
||||
return_type = is_value_function ? "RETURN_TYPE" : "void"
|
||||
varargs = has_varargs ? ", ..." : ""
|
||||
"#{return_type} FUNCNAME(#{arg_val_list(arg_count)}#{varargs})"
|
||||
calling_conventions = has_calling_conventions ?
|
||||
"#{return_type} FFF_GCC_FUNCTION_ATTRIBUTES CALLING_CONVENTION FUNCNAME(#{arg_val_list(arg_count)}#{varargs})" :
|
||||
"#{return_type} FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(#{arg_val_list(arg_count)}#{varargs})"
|
||||
end
|
||||
|
||||
def output_function_body(arg_count, has_varargs, is_value_function)
|
||||
@@ -398,6 +410,35 @@ def output_function_body(arg_count, has_varargs, is_value_function)
|
||||
putd_backslash "REGISTER_CALL(FUNCNAME);"
|
||||
|
||||
if has_varargs
|
||||
return_type = is_value_function ? "return " : ""
|
||||
putd_backslash "if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */"
|
||||
indent {
|
||||
putd_backslash "if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){"
|
||||
indent {
|
||||
putd_backslash "va_list ap;"
|
||||
putd_backslash "va_start(ap, arg#{arg_count-1});"
|
||||
putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](#{arg_list(arg_count)}, ap);" unless not is_value_function
|
||||
putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
|
||||
putd_backslash "va_end(ap);" unless not is_value_function
|
||||
putd_backslash "return ret;" unless not is_value_function
|
||||
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](#{arg_list(arg_count)}, ap);" unless is_value_function
|
||||
putd_backslash "va_end(ap);" unless is_value_function
|
||||
}
|
||||
putd_backslash "}"
|
||||
putd_backslash "else{"
|
||||
indent {
|
||||
putd_backslash "va_list ap;"
|
||||
putd_backslash "va_start(ap, arg#{arg_count-1});"
|
||||
putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)}, ap);" unless not is_value_function
|
||||
putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
|
||||
putd_backslash "va_end(ap);" unless not is_value_function
|
||||
putd_backslash "return ret;" unless not is_value_function
|
||||
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)}, ap);"
|
||||
putd_backslash "va_end(ap);" unless is_value_function
|
||||
}
|
||||
putd_backslash "}"
|
||||
}
|
||||
putd_backslash "}"
|
||||
putd_backslash "if(FUNCNAME##_fake.custom_fake){"
|
||||
indent {
|
||||
putd_backslash "RETURN_TYPE ret;" if is_value_function
|
||||
@@ -453,9 +494,9 @@ def define_fff_globals
|
||||
}
|
||||
putd "} fff_globals_t;"
|
||||
puts
|
||||
putd_backslash "FFF_EXTERN_C"
|
||||
putd "FFF_EXTERN_C"
|
||||
putd "extern fff_globals_t fff;"
|
||||
putd_backslash "FFF_END_EXTERN_C"
|
||||
putd "FFF_END_EXTERN_C"
|
||||
puts
|
||||
putd_backslash "#define DEFINE_FFF_GLOBALS"
|
||||
indent {
|
||||
@@ -466,25 +507,21 @@ def define_fff_globals
|
||||
putd "FFF_END_EXTERN_C"
|
||||
}
|
||||
puts
|
||||
putd "#define FFF_RESET_HISTORY() fff.call_history_idx = 0;"
|
||||
putd_backslash "#define FFF_RESET_HISTORY()"
|
||||
indent {
|
||||
putd_backslash "fff.call_history_idx = 0;"
|
||||
putd "memset(fff.call_history, 0, sizeof(fff.call_history));"
|
||||
}
|
||||
puts
|
||||
putd_backslash "#define REGISTER_CALL(function)"
|
||||
indent {
|
||||
putd_backslash "if(fff.call_history_idx < FFF_CALL_HISTORY_LEN)"
|
||||
indent {
|
||||
putd "fff.call_history[fff.call_history_idx++] = (fff_function_t)function;"
|
||||
putd "fff.call_history[fff.call_history_idx++] = (fff_function_t)function;"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def extern_c
|
||||
putd_backslash "FFF_EXTERN_C"
|
||||
indent {
|
||||
yield
|
||||
}
|
||||
putd_backslash "FFF_END_EXTERN_C"
|
||||
end
|
||||
|
||||
def in_struct
|
||||
putd_backslash "typedef struct FUNCNAME##_Fake {"
|
||||
indent {
|
||||
@@ -505,18 +542,22 @@ def include_guard
|
||||
end
|
||||
|
||||
def msvc_expand_macro_fix
|
||||
putd "/* MSVC expand macro fix */"
|
||||
putd "#define EXPAND(x) x"
|
||||
putd "/* MSVC expand macro fix */"
|
||||
putd "#define EXPAND(x) x"
|
||||
end
|
||||
|
||||
def generate_arg_sequence(args, prefix, do_reverse, joinstr)
|
||||
fmap = (0..args).flat_map {|i| [prefix + i.to_s]}
|
||||
if do_reverse then fmap.reverse.join(joinstr) else fmap.join(", ") end
|
||||
fmap = (0..args).flat_map {|i| [prefix + i.to_s]}
|
||||
if do_reverse then fmap.reverse.join(joinstr) else fmap.join(", ") end
|
||||
end
|
||||
|
||||
def counting_macro_instance(type, vararg = :non_vararg, prefix = "")
|
||||
def counting_macro_instance(type, has_calling_conventions, vararg = :non_vararg, prefix = "")
|
||||
appendix = (vararg == :vararg) ? "_VARARG" : ""
|
||||
minus_count = (type == :VOID) ? 1 : 2
|
||||
if has_calling_conventions
|
||||
minus_count = (type == :VOID) ? 2 : 3
|
||||
else
|
||||
minus_count = (type == :VOID) ? 1 : 2
|
||||
end
|
||||
|
||||
<<-MACRO_COUNTING_INSTANCE
|
||||
#define #{prefix}FAKE_#{type.to_s}_FUNC#{appendix}(...) \
|
||||
@@ -531,78 +572,95 @@ def counting_macro_instance(type, vararg = :non_vararg, prefix = "")
|
||||
MACRO_COUNTING_INSTANCE
|
||||
end
|
||||
|
||||
def output_macro_counting_shortcuts
|
||||
def output_macro_counting_shortcuts(has_calling_conventions)
|
||||
has_calling_conventions ?
|
||||
(arg_depth = ["3", "2"]; calling_conv = "callingConv, ") :
|
||||
(arg_depth = ["2", "1"]; calling_conv = "")
|
||||
|
||||
msvc_expand_macro_fix
|
||||
putd <<-MACRO_COUNTING
|
||||
|
||||
#define PP_NARG_MINUS2(...) \
|
||||
EXPAND(PP_NARG_MINUS2_(__VA_ARGS__, PP_RSEQ_N_MINUS2()))
|
||||
#define PP_NARG_MINUS#{arg_depth[0]}(...) \
|
||||
EXPAND(PP_NARG_MINUS#{arg_depth[0]}_(__VA_ARGS__, PP_RSEQ_N_MINUS#{arg_depth[0]}()))
|
||||
|
||||
#define PP_NARG_MINUS2_(...) \
|
||||
EXPAND(PP_ARG_MINUS2_N(__VA_ARGS__))
|
||||
#define PP_NARG_MINUS#{arg_depth[0]}_(...) \
|
||||
EXPAND(PP_ARG_MINUS#{arg_depth[0]}_N(__VA_ARGS__))
|
||||
|
||||
#define PP_ARG_MINUS2_N(returnVal, #{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...) N
|
||||
#define PP_ARG_MINUS#{arg_depth[0]}_N(returnVal, #{calling_conv} #{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...) N
|
||||
|
||||
#define PP_RSEQ_N_MINUS2() \
|
||||
#{generate_arg_sequence($MAX_ARGS, '', true, ',')}
|
||||
#define PP_RSEQ_N_MINUS#{arg_depth[0]}() \
|
||||
#{generate_arg_sequence($MAX_ARGS, '', true, ',')}
|
||||
|
||||
#define PP_NARG_MINUS#{arg_depth[1]}(...) \
|
||||
EXPAND(PP_NARG_MINUS#{arg_depth[1]}_(__VA_ARGS__, PP_RSEQ_N_MINUS#{arg_depth[1]}()))
|
||||
|
||||
#define PP_NARG_MINUS1(...) \
|
||||
EXPAND(PP_NARG_MINUS1_(__VA_ARGS__, PP_RSEQ_N_MINUS1()))
|
||||
#define PP_NARG_MINUS#{arg_depth[1]}_(...) \
|
||||
EXPAND(PP_ARG_MINUS#{arg_depth[1]}_N(__VA_ARGS__))
|
||||
|
||||
#define PP_NARG_MINUS1_(...) \
|
||||
EXPAND(PP_ARG_MINUS1_N(__VA_ARGS__))
|
||||
#define PP_ARG_MINUS#{arg_depth[1]}_N(#{calling_conv} #{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...) N
|
||||
|
||||
#define PP_ARG_MINUS1_N(#{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...) N
|
||||
|
||||
#define PP_RSEQ_N_MINUS1() \
|
||||
#{generate_arg_sequence($MAX_ARGS, '', true, ',')}
|
||||
#define PP_RSEQ_N_MINUS#{arg_depth[1]}() \
|
||||
#{generate_arg_sequence($MAX_ARGS, '', true, ',')}
|
||||
|
||||
|
||||
|
||||
/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
|
||||
|
||||
#{counting_macro_instance(:VALUE)}
|
||||
#{counting_macro_instance(:VOID)}
|
||||
#{counting_macro_instance(:VALUE, :vararg)}
|
||||
#{counting_macro_instance(:VOID, :vararg)}
|
||||
#{counting_macro_instance(:VALUE, has_calling_conventions)}
|
||||
#{counting_macro_instance(:VOID, has_calling_conventions)}
|
||||
#{counting_macro_instance(:VALUE, has_calling_conventions, :vararg)}
|
||||
#{counting_macro_instance(:VOID, has_calling_conventions, :vararg)}
|
||||
|
||||
/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
|
||||
|
||||
#{counting_macro_instance(:VALUE, :non_vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VOID, :non_vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VALUE, :vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VOID, :vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VALUE, has_calling_conventions, :non_vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VOID, has_calling_conventions, :non_vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VALUE, has_calling_conventions, :vararg, "DECLARE_")}
|
||||
#{counting_macro_instance(:VOID, has_calling_conventions, :vararg, "DECLARE_")}
|
||||
|
||||
/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
|
||||
|
||||
#{counting_macro_instance(:VALUE, :non_vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VOID, :non_vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VALUE, :vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VOID, :vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VALUE, has_calling_conventions, :non_vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VOID, has_calling_conventions, :non_vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VALUE, has_calling_conventions, :vararg, "DEFINE_")}
|
||||
#{counting_macro_instance(:VOID, has_calling_conventions, :vararg, "DEFINE_")}
|
||||
|
||||
MACRO_COUNTING
|
||||
end
|
||||
|
||||
def output_c_and_cpp
|
||||
|
||||
def output_c_and_cpp(has_calling_conventions)
|
||||
include_guard {
|
||||
include_dependencies
|
||||
output_constants
|
||||
output_internal_helper_macros
|
||||
yield
|
||||
output_macro_counting_shortcuts
|
||||
output_macro_counting_shortcuts(has_calling_conventions)
|
||||
}
|
||||
end
|
||||
|
||||
# lets generate!!
|
||||
output_c_and_cpp{
|
||||
define_fff_globals
|
||||
# Create fake generators for 0..MAX_ARGS
|
||||
num_fake_generators = $MAX_ARGS + 1
|
||||
num_fake_generators.times {|arg_count| output_macro(arg_count, false, false)}
|
||||
num_fake_generators.times {|arg_count| output_macro(arg_count, false, true)}
|
||||
# generate the varargs variants
|
||||
(2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, false)}
|
||||
(2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, true)}
|
||||
def help
|
||||
# Check if we should generate _with_ support for specifying calling conventions
|
||||
if (ARGV[0] == "--help" or ARGV[0] == "-h")
|
||||
puts "Usage: fakegen.rb [options]
|
||||
-h, --help Show this help message
|
||||
-wcc, --with-calling-conventions Support specifying calling conventions"
|
||||
exit
|
||||
end
|
||||
yield
|
||||
end
|
||||
|
||||
help {
|
||||
# Determine if we should generate with support for calling conventions
|
||||
has_calling_conventions = true if (ARGV[0] == "--with-calling-conventions" or ARGV[0] == "-wcc")
|
||||
# lets generate!!
|
||||
output_c_and_cpp(has_calling_conventions) {
|
||||
define_fff_globals
|
||||
# Create fake generators for 0..MAX_ARGS
|
||||
num_fake_generators = $MAX_ARGS + 1
|
||||
num_fake_generators.times {|arg_count| output_macro(arg_count, false, has_calling_conventions, false)}
|
||||
num_fake_generators.times {|arg_count| output_macro(arg_count, false, has_calling_conventions, true)}
|
||||
# generate the varargs variants
|
||||
(2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, has_calling_conventions, false)}
|
||||
(2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, has_calling_conventions, true)}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,18 +21,31 @@ struct MyStruct {
|
||||
int y;
|
||||
};
|
||||
|
||||
|
||||
#ifndef TEST_WITH_CALLING_CONVENTIONS
|
||||
FAKE_VOID_FUNC(voidfunc1, int);
|
||||
FAKE_VOID_FUNC(voidfunc2, char, char);
|
||||
FAKE_VOID_FUNC(voidfunc1outparam, char *);
|
||||
FAKE_VALUE_FUNC(long, longfunc0);
|
||||
FAKE_VALUE_FUNC(enum MYBOOL, enumfunc0);
|
||||
FAKE_VALUE_FUNC(struct MyStruct, structfunc0);
|
||||
FAKE_VOID_FUNC_VARARG(voidfunc3var, char *, int, ...);
|
||||
FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, char *, int, ...);
|
||||
FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
|
||||
FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
|
||||
FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t);
|
||||
FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#else
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
|
||||
FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
|
||||
FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0);
|
||||
FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0);
|
||||
FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, char *, int, ...);
|
||||
FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, char *, int, ...);
|
||||
FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t);
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#endif
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -103,6 +116,10 @@ int main()
|
||||
|
||||
RUN_TEST(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments);
|
||||
RUN_TEST(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_not_exhausted);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_seq_return_values_saved_in_history);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_exhausted);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_reset);
|
||||
|
||||
RUN_TEST(FFFTestSuite, can_capture_upto_20_arguments_correctly);
|
||||
RUN_TEST(FFFTestSuite, value_func_can_capture_upto_20_arguments_correctly);
|
||||
|
||||
@@ -17,12 +17,25 @@
|
||||
|
||||
DEFINE_FFF_GLOBALS
|
||||
|
||||
#ifndef TEST_WITH_CALLING_CONVENTIONS
|
||||
FAKE_VOID_FUNC(voidfunc1, int);
|
||||
FAKE_VOID_FUNC(voidfunc2, char, char);
|
||||
FAKE_VOID_FUNC(voidfunc1outparam, char *);
|
||||
FAKE_VALUE_FUNC(long, longfunc0);
|
||||
FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
|
||||
FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
|
||||
FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#else
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
|
||||
FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
|
||||
FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...);
|
||||
FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...);
|
||||
FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#endif
|
||||
|
||||
class FFFTestSuite: public testing::Test
|
||||
{
|
||||
@@ -33,12 +46,12 @@ public:
|
||||
RESET_FAKE(voidfunc2);
|
||||
RESET_FAKE(longfunc0);
|
||||
RESET_FAKE(voidfunc1outparam);
|
||||
RESET_FAKE(voidfunc3var);
|
||||
RESET_FAKE(valuefunc3var);
|
||||
FFF_RESET_HISTORY();
|
||||
}
|
||||
};
|
||||
|
||||
#include "test_cases.include"
|
||||
|
||||
TEST_F(FFFTestSuite, default_constants_can_be_overridden)
|
||||
{
|
||||
unsigned sizeCallHistory = (sizeof fff.call_history) / (sizeof fff.call_history[0]);
|
||||
@@ -46,3 +59,43 @@ TEST_F(FFFTestSuite, default_constants_can_be_overridden)
|
||||
ASSERT_EQ(OVERRIDE_ARG_HIST_LEN, voidfunc2_fake.arg_history_len);
|
||||
}
|
||||
|
||||
// Fake declared in C++ context (not extern "C", using namespace)
|
||||
// before the fake is declared
|
||||
namespace cxx
|
||||
{
|
||||
typedef int int_t;
|
||||
void voidfunc1(cxx::int_t);
|
||||
}
|
||||
|
||||
// Now declare the fake. Must be in the same namespace as the
|
||||
// original declaration.
|
||||
namespace cxx
|
||||
{
|
||||
#ifndef TEST_WITH_CALLING_CONVENTIONS
|
||||
FAKE_VOID_FUNC(voidfunc1, cxx::int_t);
|
||||
#else
|
||||
FAKE_VOID_FUNC(_cdecl, voidfunc1, cxx::int_t);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, cxx_fake_is_called)
|
||||
{
|
||||
cxx::voidfunc1(66);
|
||||
ASSERT_EQ(cxx::voidfunc1_fake.call_count, 1u);
|
||||
ASSERT_EQ(cxx::voidfunc1_fake.arg0_val, 66);
|
||||
}
|
||||
|
||||
static int cxx_my_custom_fake_called = 0;
|
||||
void cxx_my_custom_fake(cxx::int_t i)
|
||||
{
|
||||
cxx_my_custom_fake_called++;
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, cxx_can_register_custom_fake)
|
||||
{
|
||||
cxx::voidfunc1_fake.custom_fake = cxx_my_custom_fake;
|
||||
cxx::voidfunc1(66);
|
||||
ASSERT_EQ(1, cxx_my_custom_fake_called);
|
||||
}
|
||||
|
||||
#include "test_cases.include"
|
||||
|
||||
@@ -68,6 +68,10 @@ int main()
|
||||
|
||||
RUN_TEST(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments);
|
||||
RUN_TEST(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_not_exhausted);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_seq_return_values_saved_in_history);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_exhausted);
|
||||
RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_reset);
|
||||
|
||||
RUN_TEST(FFFTestSuite, can_capture_upto_20_arguments_correctly);
|
||||
RUN_TEST(FFFTestSuite, value_func_can_capture_upto_20_arguments_correctly);
|
||||
|
||||
@@ -15,6 +15,8 @@ public:
|
||||
RESET_FAKE(voidfunc2);
|
||||
RESET_FAKE(longfunc0);
|
||||
RESET_FAKE(voidfunc1outparam);
|
||||
RESET_FAKE(voidfunc3var);
|
||||
RESET_FAKE(valuefunc3var);
|
||||
FFF_RESET_HISTORY();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "global_fakes.h"
|
||||
#include <string.h> // for memcpy
|
||||
|
||||
#ifndef TEST_WITH_CALLING_CONVENTIONS
|
||||
DEFINE_FAKE_VOID_FUNC(voidfunc1, int);
|
||||
DEFINE_FAKE_VOID_FUNC(voidfunc2, char, char);
|
||||
DEFINE_FAKE_VOID_FUNC(voidfunc1outparam, char *);
|
||||
@@ -15,3 +16,19 @@ DEFINE_FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size
|
||||
#endif /* __cplusplus */
|
||||
DEFINE_FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#else
|
||||
DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
|
||||
DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
|
||||
DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
|
||||
|
||||
DEFINE_FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
|
||||
DEFINE_FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0);
|
||||
DEFINE_FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0);
|
||||
DEFINE_FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...);
|
||||
DEFINE_FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...);
|
||||
#ifndef __cplusplus
|
||||
DEFINE_FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t);
|
||||
#endif /* __cplusplus */
|
||||
DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, __cdecl,valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef GLOBAL_FAKES_H_
|
||||
#define GLOBAL_FAKES_H_
|
||||
|
||||
@@ -16,6 +15,7 @@ enum MYBOOL enumfunc();
|
||||
struct MyStruct structfunc();
|
||||
//// End Imaginary production code header file ///
|
||||
|
||||
#ifndef TEST_WITH_CALLING_CONVENTIONS
|
||||
DECLARE_FAKE_VOID_FUNC(voidfunc1, int);
|
||||
DECLARE_FAKE_VOID_FUNC(voidfunc2, char, char);
|
||||
DECLARE_FAKE_VOID_FUNC(voidfunc1outparam, char *);
|
||||
@@ -26,8 +26,24 @@ DECLARE_FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
|
||||
DECLARE_FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
|
||||
DECLARE_FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#else
|
||||
DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
|
||||
DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
|
||||
DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
|
||||
DECLARE_FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
|
||||
DECLARE_FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0);
|
||||
DECLARE_FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0);
|
||||
DECLARE_FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...);
|
||||
DECLARE_FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...);
|
||||
DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef TEST_WITH_CALLING_CONVENTIONS
|
||||
DECLARE_FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t);
|
||||
#else
|
||||
DECLARE_FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t);
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
#endif /* GLOBAL_FAKES_H_ */
|
||||
|
||||
140
test/ms_vc_fff_test/fff/fff.vcxproj
Normal file
140
test/ms_vc_fff_test/fff/fff.vcxproj
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{CDBC5A3A-59B8-4638-B818-935395302DAF}</ProjectGuid>
|
||||
<RootNamespace>fff2</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>fff</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<PreBuildEvent>
|
||||
<Command>del $(SolutionDir)..\..\fff.h
|
||||
ruby.exe $(SolutionDir)..\..\fakegen.rb -wcc > $(SolutionDir)..\..\fff.h</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<PreBuildEvent>
|
||||
<Command>del $(SolutionDir)..\..\fff.h
|
||||
ruby.exe $(SolutionDir)..\..\fakegen.rb -wcc > $(SolutionDir)..\..\fff.h</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>del $(SolutionDir)..\..\fff.h
|
||||
ruby.exe $(SolutionDir)..\..\fakegen.rb -wcc > $(SolutionDir)..\..\fff.h</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>del $(SolutionDir)..\..\fff.h
|
||||
ruby.exe $(SolutionDir)..\..\fakegen.rb -wcc > $(SolutionDir)..\..\fff.h</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
test/ms_vc_fff_test/fff/fff.vcxproj.filters
Normal file
22
test/ms_vc_fff_test/fff/fff.vcxproj.filters
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
163
test/ms_vc_fff_test/gtest/gtest.vcxproj
Normal file
163
test/ms_vc_fff_test/gtest/gtest.vcxproj
Normal file
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>gtest</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-all.cc" />
|
||||
<ClCompile Include="..\..\..\gtest\gtest-main.cc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\gtest\gtest.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
30
test/ms_vc_fff_test/gtest/gtest.vcxproj.filters
Normal file
30
test/ms_vc_fff_test/gtest/gtest.vcxproj.filters
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-all.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-main.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\gtest\gtest.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
93
test/ms_vc_fff_test/ms_vc_fff_test.sln
Normal file
93
test/ms_vc_fff_test/ms_vc_fff_test.sln
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2036
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ms_vc_fff_test_c", "ms_vc_fff_test_c\ms_vc_fff_test_c.vcxproj", "{B7658726-71D3-48B3-8BD2-6D383A60DC8E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF} = {CDBC5A3A-59B8-4638-B818-935395302DAF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "gtest\gtest.vcxproj", "{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ms_vc_fff_test_cpp", "ms_vc_fff_test_cpp\ms_vc_fff_test_cpp.vcxproj", "{00EE1499-1C86-4F7B-8A00-9EBE696D0142}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF} = {CDBC5A3A-59B8-4638-B818-935395302DAF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ms_vc_fff_test_global_cpp", "ms_vc_fff_test_global_cpp\ms_vc_fff_test_global_cpp.vcxproj", "{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF} = {CDBC5A3A-59B8-4638-B818-935395302DAF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ms_vc_fff_test_global_c", "ms_vc_fff_test_global_c\ms_vc_fff_test_global_c.vcxproj", "{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF} = {CDBC5A3A-59B8-4638-B818-935395302DAF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fff", "fff\fff.vcxproj", "{CDBC5A3A-59B8-4638-B818-935395302DAF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Debug|x64.Build.0 = Debug|x64
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Release|x64.ActiveCfg = Release|x64
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Release|x64.Build.0 = Release|x64
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{B7658726-71D3-48B3-8BD2-6D383A60DC8E}.Release|x86.Build.0 = Release|Win32
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Debug|x64.Build.0 = Debug|x64
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Release|x64.ActiveCfg = Release|x64
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Release|x64.Build.0 = Release|x64
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{792FDC07-43A6-42BB-ABD5-18BA1A8B17E7}.Release|x86.Build.0 = Release|Win32
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Debug|x64.Build.0 = Debug|x64
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Debug|x86.Build.0 = Debug|Win32
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Release|x64.ActiveCfg = Release|x64
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Release|x64.Build.0 = Release|x64
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Release|x86.ActiveCfg = Release|Win32
|
||||
{00EE1499-1C86-4F7B-8A00-9EBE696D0142}.Release|x86.Build.0 = Release|Win32
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Debug|x64.Build.0 = Debug|x64
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Release|x64.ActiveCfg = Release|x64
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Release|x64.Build.0 = Release|x64
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}.Release|x86.Build.0 = Release|Win32
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Debug|x64.Build.0 = Debug|x64
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Release|x64.ActiveCfg = Release|x64
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Release|x64.Build.0 = Release|x64
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}.Release|x86.Build.0 = Release|Win32
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Debug|x64.Build.0 = Debug|x64
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Debug|x86.Build.0 = Debug|Win32
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Release|x64.ActiveCfg = Release|x64
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Release|x64.Build.0 = Release|x64
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CDBC5A3A-59B8-4638-B818-935395302DAF}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9DEDA619-1153-4BD1-B292-069D4954391E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
150
test/ms_vc_fff_test/ms_vc_fff_test_c/ms_vc_fff_test_c.vcxproj
Normal file
150
test/ms_vc_fff_test/ms_vc_fff_test_c/ms_vc_fff_test_c.vcxproj
Normal file
@@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\fff_test_c.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h" />
|
||||
<ClInclude Include="..\..\c_test_framework.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{B7658726-71D3-48B3-8BD2-6D383A60DC8E}</ProjectGuid>
|
||||
<RootNamespace>msvcffftest</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>ms_vc_fff_test_c</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;._MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;._MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;._MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;._MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\fff_test_c.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\c_test_framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\fff.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{00EE1499-1C86-4F7B-8A00-9EBE696D0142}</ProjectGuid>
|
||||
<RootNamespace>msvcffftestcpp</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-main.cc" />
|
||||
<ClCompile Include="..\..\fff_test_cpp.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gtest\gtest.vcxproj">
|
||||
<Project>{792fdc07-43a6-42bb-abd5-18ba1a8b17e7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\fff_test_cpp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-main.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{0F70375A-2C80-4B07-9EA0-A64E9679B0C7}</ProjectGuid>
|
||||
<RootNamespace>msvcffftestglobalc</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\fff_test_global_c.c" />
|
||||
<ClCompile Include="..\..\global_fakes.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h" />
|
||||
<ClInclude Include="..\..\c_test_framework.h" />
|
||||
<ClInclude Include="..\..\global_fakes.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\fff_test_global_c.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\global_fakes.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\global_fakes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\c_test_framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\fff.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{4384428B-E0FE-404D-A6EB-8CD9A3C88E5C}</ProjectGuid>
|
||||
<RootNamespace>msvcffftestglobalcpp</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(SolutionDir)..\..\gtest;$(SolutionDir)..\..\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;TEST_WITH_CALLING_CONVENTIONS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gtest\gtest.vcxproj">
|
||||
<Project>{792fdc07-43a6-42bb-abd5-18ba1a8b17e7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-main.cc" />
|
||||
<ClCompile Include="..\..\fff_test_global_cpp.cpp" />
|
||||
<ClCompile Include="..\..\global_fakes.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\fff.h" />
|
||||
<ClInclude Include="..\..\global_fakes.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\fff_test_global_cpp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\gtest\gtest-main.cc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\global_fakes.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\global_fakes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\fff.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -158,11 +158,13 @@ TEST_F(FFFTestSuite, register_call_macro_registers_two_calls)
|
||||
TEST_F(FFFTestSuite, reset_call_history_resets_call_history)
|
||||
{
|
||||
REGISTER_CALL(longfunc0);
|
||||
REGISTER_CALL(voidfunc1);
|
||||
FFF_RESET_HISTORY();
|
||||
REGISTER_CALL(voidfunc2);
|
||||
|
||||
ASSERT_EQ(1u, fff.call_history_idx);
|
||||
ASSERT_EQ(fff.call_history[0], (void *)voidfunc2);
|
||||
ASSERT_EQ(fff.call_history[1], (void *)0);
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, call_history_will_not_write_past_array_bounds)
|
||||
@@ -284,17 +286,18 @@ TEST_F(FFFTestSuite, return_value_saved_in_history)
|
||||
ASSERT_EQ(longfunc0_fake.return_val_history[i], i + 1);
|
||||
}
|
||||
}
|
||||
long custom_longfunc1()
|
||||
|
||||
long custom_longfunc1(void)
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
long custom_longfunc2()
|
||||
long custom_longfunc2(void)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
long custom_longfunc3()
|
||||
long custom_longfunc3(void)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
@@ -304,6 +307,7 @@ TEST_F(FFFTestSuite, custom_fake_seq_return_values_saved_in_history)
|
||||
long (*custom_fakes[])(void) = {custom_longfunc1,
|
||||
custom_longfunc2,
|
||||
custom_longfunc3};
|
||||
|
||||
SET_CUSTOM_FAKE_SEQ(longfunc0, custom_fakes, 3);
|
||||
|
||||
longfunc0();
|
||||
@@ -350,7 +354,88 @@ TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return
|
||||
ASSERT_EQ(MEANING_OF_LIFE, retval);
|
||||
}
|
||||
|
||||
#ifndef __cplusplus
|
||||
int valuefunc3var_custom_fake1(const char *str, int a, va_list vl)
|
||||
{
|
||||
int arg;
|
||||
while ((arg = va_arg(vl, int)) != 0)
|
||||
a += arg;
|
||||
return a;
|
||||
}
|
||||
|
||||
int valuefunc3var_custom_fake2(const char *str, int a, va_list vl)
|
||||
{
|
||||
int arg;
|
||||
while ((arg = va_arg(vl, int)) != 0)
|
||||
a -= arg;
|
||||
return a;
|
||||
}
|
||||
|
||||
int valuefunc3var_custom_fake3(const char *str, int a, va_list vl)
|
||||
{
|
||||
int arg;
|
||||
while ((arg = va_arg(vl, int)) != 0)
|
||||
a *= arg;
|
||||
return a;
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, vararg_custom_fake_sequence_not_exhausted)
|
||||
{
|
||||
int (*custom_fakes[])(const char *, int, va_list) = {valuefunc3var_custom_fake1,
|
||||
valuefunc3var_custom_fake2,
|
||||
valuefunc3var_custom_fake3};
|
||||
SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
|
||||
int a = 1;
|
||||
ASSERT_EQ(valuefunc3var("a", a, 2, 3, 4, 0), 10);
|
||||
ASSERT_EQ(valuefunc3var("aa", a, 2, 3, 4, 2, 0), -10);
|
||||
ASSERT_EQ(valuefunc3var("aaa", a, 2, 3, 0), 6);
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, vararg_custom_fake_seq_return_values_saved_in_history)
|
||||
{
|
||||
int (*custom_fakes[])(const char *, int, va_list) = {valuefunc3var_custom_fake1,
|
||||
valuefunc3var_custom_fake2,
|
||||
valuefunc3var_custom_fake3};
|
||||
SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
|
||||
int a = 1;
|
||||
valuefunc3var("a", a, 2, 3, 4, 0);
|
||||
valuefunc3var("aa", a, 2, 3, 4, 2, 0);
|
||||
valuefunc3var("aaa", a, 2, 3, 0);
|
||||
ASSERT_EQ(10, valuefunc3var_fake.return_val_history[0]);
|
||||
ASSERT_EQ(-10, valuefunc3var_fake.return_val_history[1]);
|
||||
ASSERT_EQ(6, valuefunc3var_fake.return_val_history[2]);
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, vararg_custom_fake_sequence_exhausted)
|
||||
{
|
||||
int (*custom_fakes[])(const char *, int, va_list) = {valuefunc3var_custom_fake1,
|
||||
valuefunc3var_custom_fake2,
|
||||
valuefunc3var_custom_fake3};
|
||||
SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
|
||||
int a = 1;
|
||||
ASSERT_EQ(valuefunc3var("a", a, 2, 3, 4, 0), 10);
|
||||
ASSERT_EQ(valuefunc3var("aa", a, 2, 3, 4, 2, 0), -10);
|
||||
ASSERT_EQ(valuefunc3var("aaa", a, 2, 3, 0), 6);
|
||||
ASSERT_EQ(valuefunc3var("aaa", a, 4, 5, 1, 0), 20);
|
||||
ASSERT_EQ(valuefunc3var("aaa", a, 4, 0), 4);
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, vararg_custom_fake_sequence_reset)
|
||||
{
|
||||
int (*custom_fakes[])(const char *, int, va_list) = {valuefunc3var_custom_fake1,
|
||||
valuefunc3var_custom_fake2,
|
||||
valuefunc3var_custom_fake3};
|
||||
SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
|
||||
int a = 1;
|
||||
ASSERT_EQ(valuefunc3var("a", a, 2, 3, 4, 0), 10);
|
||||
ASSERT_EQ(valuefunc3var("aa", a, 2, 3, 4, 2, 0), -10);
|
||||
RESET_FAKE(valuefunc3var);
|
||||
ASSERT_EQ(0, valuefunc3var("b", 7, 4, 5));
|
||||
valuefunc3var_fake.return_val = 1;
|
||||
ASSERT_EQ(1, valuefunc3var("c", 5, 4, 4));
|
||||
valuefunc3var_fake.return_val = 2;
|
||||
ASSERT_EQ(2, valuefunc3var("d", 6, 3, 5));
|
||||
}
|
||||
|
||||
TEST_F(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments)
|
||||
{
|
||||
voidfunc3var("0 parameters", 0);
|
||||
@@ -358,7 +443,7 @@ TEST_F(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments)
|
||||
voidfunc3var("2 parameters", 2, 10, 20);
|
||||
voidfunc3var("3 parameters", 3, 10, 20, 30);
|
||||
|
||||
ASSERT_EQ(voidfunc3var_fake.call_count, 4);
|
||||
ASSERT_EQ(voidfunc3var_fake.call_count, 4u);
|
||||
char msg[] = "3 parameters";
|
||||
ASSERT_EQ(strcmp(voidfunc3var_fake.arg0_val, msg), 0);
|
||||
ASSERT_EQ(3, voidfunc3var_fake.arg1_val);
|
||||
@@ -371,12 +456,11 @@ TEST_F(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments)
|
||||
valuefunc3var("2 parameters", 2, 10, 20);
|
||||
valuefunc3var("3 parameters", 3, 10, 20, 30);
|
||||
|
||||
ASSERT_EQ(valuefunc3var_fake.call_count, 4);
|
||||
ASSERT_EQ(valuefunc3var_fake.call_count, 4u);
|
||||
char msg[] = "3 parameters";
|
||||
ASSERT_EQ(strcmp(valuefunc3var_fake.arg0_val, msg), 0);
|
||||
ASSERT_EQ(3, valuefunc3var_fake.arg1_val);
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
TEST_F(FFFTestSuite, can_capture_upto_20_arguments_correctly)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user