Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e8f5f2f

Browse filesBrowse files
Merge pull request FabioBatSilva#45 from RobertByrnes/master
Use of FakeIt as a dependency with supporting fixes
2 parents 45b9cf9 + 93dbb2b commit e8f5f2f
Copy full SHA for e8f5f2f

File tree

Expand file treeCollapse file tree

14 files changed

+1525
-566
lines changed
Filter options
Expand file treeCollapse file tree

14 files changed

+1525
-566
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.pioenvs
22
.piolibdeps
33
/external/unity/*-repo/
4+
/external/fakeit/*-repo/
45
/build/
56
/.cproject
67
/.project
@@ -11,4 +12,7 @@
1112
!/Makefile
1213
/Testing/*
1314
.pio/*
14-
.vscode/*
15+
.vscode/*
16+
/test/test_main.cpp
17+
output.txt
18+
error.txt

‎CMakeLists.txt

Copy file name to clipboardExpand all lines: CMakeLists.txt
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
cmake_minimum_required(VERSION 3.2.2)
22
project(ArduinoFake VERSION 0.1)
33

4-
set(CMAKE_CXX_STANDARD 11)
4+
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66

77
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
88

99
# Include external libs
10-
add_subdirectory(external)
10+
add_subdirectory(external/fakeit)
11+
add_subdirectory(external/unity)
1112

1213
# Targets that we develop here
1314
enable_testing()

‎Makefile

Copy file name to clipboardExpand all lines: Makefile
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
default_target: all
22

33
.PHONY: all
4-
all: clean build test clean
4+
all: clean build deploy test clean
55

66
.PHONY: cmake
77
cmake:
@@ -27,3 +27,8 @@ clean:
2727
@rm -rf $(CURDIR)/build/*
2828
@rm -rf $(CURDIR)/.pioenvs/*
2929
@rm -rf $(CURDIR)/.pio/*
30+
31+
.PHONY: deploy
32+
deploy:
33+
cp $(CURDIR)/external/fakeit/fakeit-repo/single_header/standalone/* $(CURDIR)/src
34+

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
`ArduinoFake` is a simple mocking framework for Arduino.
66
`ArduinoFake` is based on [FakeIt](https://github.com/eranpeer/FakeIt) and can be used for testing your arduino project natively. No arduino required !
7-
7+
#
88

99
## Quickstart
1010

‎external/CMakeLists.txt

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Include external libs
22
add_subdirectory(unity)
3+
add_subdirectory(fakeit)

‎external/fakeit/CMakeLists.txt

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cmake_minimum_required(VERSION 3.2.2)
2+
project(fakeit VERSION 2.4.0 LANGUAGES CXX)
3+
4+
include(git-download)
5+
6+
set(REPO_DIR ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-repo)
7+
8+
download_repo(
9+
URL "https://github.com/eranpeer/FakeIt.git"
10+
TAG ${PROJECT_VERSION}
11+
CLONE_DIR ${REPO_DIR}
12+
)
13+
14+
add_library(${PROJECT_NAME} INTERFACE)
15+
16+
target_include_directories(${PROJECT_NAME} INTERFACE
17+
${REPO_DIR}/single_header/standalone/
18+
)

‎platformio.ini

Copy file name to clipboard
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
111
[env:native]
212
platform = native
3-
build_flags = -std=gnu++11
4-
test_build_src = yes
13+
build_flags = -std=gnu++17
14+
test_build_src = yes

‎src/ArduinoFake.h

Copy file name to clipboardExpand all lines: src/ArduinoFake.h
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#define USBCON
66
#endif
77

8-
#include <map>
8+
#include <unordered_map>
99
#include <cstring>
1010
#include <cstdint>
1111
#include <stdexcept>
12-
#include "fakeit/fakeit.hpp"
12+
#include "fakeit.hpp"
1313

1414
#include "arduino/Arduino.h"
1515

@@ -96,7 +96,7 @@ class ArduinoFakeContext
9696
public:
9797
ArduinoFakeInstances* Instances = new ArduinoFakeInstances();
9898
ArduinoFakeMocks* Mocks = new ArduinoFakeMocks();
99-
std::map<void*, void*> Mapping;
99+
std::unordered_map<void*, void*> Mapping;
100100

101101
_ArduinoFakeInstanceGetter1(Print)
102102
_ArduinoFakeInstanceGetter1(Stream)

‎src/CMakeLists.txt

Copy file name to clipboardExpand all lines: src/CMakeLists.txt
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ aux_source_directory(./fakeit SRC_LIST)
33
aux_source_directory(./arduino SRC_LIST)
44

55
add_library(${PROJECT_NAME} SHARED ${SRC_LIST})
6+
7+
target_link_libraries(${PROJECT_NAME} fakeit)

‎src/FunctionFake.h

Copy file name to clipboardExpand all lines: src/FunctionFake.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "fakeit/fakeit.hpp"
3+
#include "fakeit.hpp"
44

55
struct FunctionFake
66
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.