File tree Expand file tree Collapse file tree 14 files changed +1525
-566
lines changed Expand file tree Collapse file tree 14 files changed +1525
-566
lines changed Original file line number Diff line number Diff line change 1
1
.pioenvs
2
2
.piolibdeps
3
3
/external /unity /* -repo /
4
+ /external /fakeit /* -repo /
4
5
/build /
5
6
/.cproject
6
7
/.project
11
12
! /Makefile
12
13
/Testing /*
13
14
.pio /*
14
- .vscode /*
15
+ .vscode /*
16
+ /test /test_main.cpp
17
+ output.txt
18
+ error.txt
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.2.2 )
2
2
project (ArduinoFake VERSION 0.1 )
3
3
4
- set (CMAKE_CXX_STANDARD 11 )
4
+ set (CMAKE_CXX_STANDARD 17 )
5
5
set (CMAKE_CXX_STANDARD_REQUIRED ON )
6
6
7
7
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} /cmake )
8
8
9
9
# Include external libs
10
- add_subdirectory (external )
10
+ add_subdirectory (external/fakeit )
11
+ add_subdirectory (external/unity )
11
12
12
13
# Targets that we develop here
13
14
enable_testing ()
Original file line number Diff line number Diff line change 1
1
default_target : all
2
2
3
3
.PHONY : all
4
- all : clean build test clean
4
+ all : clean build deploy test clean
5
5
6
6
.PHONY : cmake
7
7
cmake :
27
27
@rm -rf $(CURDIR ) /build/*
28
28
@rm -rf $(CURDIR ) /.pioenvs/*
29
29
@rm -rf $(CURDIR ) /.pio/*
30
+
31
+ .PHONY : deploy
32
+ deploy :
33
+ cp $(CURDIR ) /external/fakeit/fakeit-repo/single_header/standalone/* $(CURDIR ) /src
34
+
Original file line number Diff line number Diff line change 4
4
5
5
` ArduinoFake ` is a simple mocking framework for Arduino.
6
6
` 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
+ #
8
8
9
9
## Quickstart
10
10
Original file line number Diff line number Diff line change 1
1
# Include external libs
2
2
add_subdirectory (unity )
3
+ add_subdirectory (fakeit )
Original file line number Diff line number Diff line change
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
+ )
Original file line number Diff line number Diff line change
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
+
1
11
[env:native]
2
12
platform = native
3
- build_flags = -std =gnu++11
4
- test_build_src = yes
13
+ build_flags = -std =gnu++17
14
+ test_build_src = yes
Original file line number Diff line number Diff line change 5
5
#define USBCON
6
6
#endif
7
7
8
- #include < map >
8
+ #include < unordered_map >
9
9
#include < cstring>
10
10
#include < cstdint>
11
11
#include < stdexcept>
12
- #include " fakeit/fakeit .hpp"
12
+ #include " fakeit.hpp"
13
13
14
14
#include " arduino/Arduino.h"
15
15
@@ -96,7 +96,7 @@ class ArduinoFakeContext
96
96
public:
97
97
ArduinoFakeInstances* Instances = new ArduinoFakeInstances();
98
98
ArduinoFakeMocks* Mocks = new ArduinoFakeMocks();
99
- std::map <void *, void *> Mapping;
99
+ std::unordered_map <void *, void *> Mapping;
100
100
101
101
_ArduinoFakeInstanceGetter1 (Print)
102
102
_ArduinoFakeInstanceGetter1 (Stream)
Original file line number Diff line number Diff line change @@ -3,3 +3,5 @@ aux_source_directory(./fakeit SRC_LIST)
3
3
aux_source_directory (./arduino SRC_LIST )
4
4
5
5
add_library (${PROJECT_NAME} SHARED ${SRC_LIST} )
6
+
7
+ target_link_libraries (${PROJECT_NAME} fakeit )
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
- #include "fakeit/fakeit .hpp"
3
+ #include "fakeit.hpp"
4
4
5
5
struct FunctionFake
6
6
{
You can’t perform that action at this time.
0 commit comments