Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fake function framework (fff) #5114

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/fff/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.1":
url: https://github.com/meekrosoft/fff/archive/refs/tags/v1.1.zip
sha256: 5a8329878f59bd1ea19b734573d63c228f742384b8c78d00e4d005909b90ee83
26 changes: 26 additions & 0 deletions recipes/fff/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from conans import ConanFile, tools
import os

class TypeSafe(ConanFile):
name = 'fff'
description = 'A testing micro framework for creating function test doubles'
url = 'https://github.com/conan-io/conan-center-index'
homepage = 'https://github.com/meekrosoft/fff'
license = 'MIT'
topics = 'conan', 'c', 'c++', 'embedded', 'tdd', 'micro-framework', 'fake-functions'

no_copy_source = True

@property
def _source_subfolder(self):
return "source_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)

def package(self):
self.copy("LICENSE*", dst="licenses", src=self._source_subfolder)
self.copy("fff.h", dst="include", src=self._source_subfolder)

def package_id(self):
self.info.header_only()
8 changes: 8 additions & 0 deletions recipes/fff/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
17 changes: 17 additions & 0 deletions recipes/fff/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
16 changes: 16 additions & 0 deletions recipes/fff/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdint.h>
#include "fff.h"

DEFINE_FFF_GLOBALS;

FAKE_VOID_FUNC(TestFunction, uint32_t, uint8_t);

int main()
{
RESET_FAKE(TestFunction);
FFF_RESET_HISTORY();

TestFunction(8, 16);

return 0;
}
3 changes: 3 additions & 0 deletions recipes/fff/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
'1.1':
folder: all