A minimal mocking utility for C projects.
Project description
🔧 narmock
A minimal mocking utility for C projects.
🚧 Work in progress 🚧
Narmock identifies the mocks being used in your tests and generates easy-to-use implementations with a slick API.
#include <time.h>
#include "__mocks__.h"
#include "narwhal.h"
TEST(example)
{
MOCK(time)->mock_return(42);
ASSERT_EQ(time(NULL), 42);
}
Most of the examples in this README are tests written with Narwhal but Narmock can be used with other test frameworks and anywhere in regular source code.
Installation
The package can be installed with pip
.
$ pip install narmock
Contributing
Contributions are welcome. Feel free to open issues and suggest improvements. This project uses poetry so you'll need to install it first if you want to be able to work with the project locally.
$ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
You should now be able to install the required dependencies.
$ poetry install
The code follows the black code style.
$ poetry run black narmock
You can run the tests with poetry run make -C tests
. The test suite is built with Narwhal.
$ poetry run make -C tests
License - MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file narmock-0.1.3.tar.gz
.
File metadata
- Download URL: narmock-0.1.3.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76de8a0993a4b3741074aec4887755f47bb9ab9f25e7c54512a0dc38760a3efe |
|
MD5 | de2b29eea2ec9319b3f0e192c3b6d056 |
|
BLAKE2b-256 | 2f318b6ecfb736c4c3446477acbf5df7b850eb2fbba498c017879dfb32ca7e39 |
File details
Details for the file narmock-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: narmock-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 864a01fcb066f2b3b3092caedb30fdc16b028fb1bcea1cd3926d315b30de57d5 |
|
MD5 | 025feab580d90c5df25fd5327c07c6a0 |
|
BLAKE2b-256 | d805cff506222e16de5622996ac7114c1effd4218aeb3c355266c4d5f073dbdd |