conan/cppstub/README.md
This is a Conan package for cpp-stub, a simple and easy-to-use C++ stub library for unit testing.
cpp-stub is a lightweight C++ library for creating test stubs/mocks. It provides:
stub.h - Main stub functionalityaddr_any.h - Platform-specific address manipulation (Linux, macOS, Windows)# Create the package locally
conan create . --build=missing
# Verify installation
conan list "cppstub/*"
Add to your conanfile.txt:
[requires]
cppstub/1.0.0
[generators]
CMakeDeps
CMakeToolchain
Or in your conanfile.py:
def requirements(self):
self.requires("cppstub/1.0.0")
cmake_minimum_required(VERSION 3.15)
project(MyProject CXX)
find_package(cppstub REQUIRED CONFIG)
add_executable(mytest test.cpp)
target_link_libraries(mytest cppstub::cppstub)
#include <stub.h>
#include <addr_any.h>
// Your test code here
// The stub.h provides functionality for function stubbing
// The addr_any.h provides platform-specific address manipulation
The package exports header files from the cpp-stub repository:
cppstub/ directorystub.h from src/addr_any.h from platform-specific directory (src_linux/, src_darwin/, or src_win/)The package automatically selects the correct addr_any.h based on your OS:
src_linux/addr_any.hsrc_darwin/addr_any.hsrc_win/addr_any.hMIT License - See LICENSE file for details.