# -*- coding: utf-8 -*-
from distutils.core import setup

packages = \
['narmock', 'narmock.templates']

package_data = \
{'': ['*']}

install_requires = \
['jinja2>=2.10,<3.0', 'pycparser>=2.19,<3.0']

entry_points = \
{'console_scripts': ['narmock = narmock.cli:main']}

setup_kwargs = {
    'name': 'narmock',
    'version': '0.2.0',
    'description': 'A minimal mocking utility for C projects.',
    'long_description': '# 🎣 narmock\n\n[![Build Status](https://travis-ci.com/vberlier/narmock.svg?branch=master)](https://travis-ci.com/vberlier/narmock)\n[![PyPI](https://img.shields.io/pypi/v/narmock.svg)](https://pypi.org/project/narmock/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/narmock.svg)](https://pypi.org/project/narmock/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n> A minimal mocking utility for C projects.\n\n**🚧 Work in progress 🚧**\n\nNarmock finds the functions mocked in your tests and generates mocks with a slick API.\n\n```c\n#include <time.h>\n\n#include "__mocks__.h"\n#include "narwhal.h"\n\nTEST(example)\n{\n    MOCK(time)->mock_return(42);\n    ASSERT_EQ(time(NULL), 42);\n}\n```\n\n> This example is a test written with [Narwhal](https://github.com/vberlier/narwhal) but Narmock can be used with other test frameworks and anywhere in regular source code.\n\n## Installation\n\nThe package can be installed with `pip`.\n\n```bash\n$ pip install narmock\n```\n\n## Getting started\n\nThe command-line utility provides two essential commands that should make it possible to integrate Narmock in any kind of build system.\n\n```\nusage: narmock [-h] (-g [<code>] | -f) [-d <directory>]\n\nA minimal mocking utility for C projects.\n\noptional arguments:\n  -h, --help      show this help message and exit\n  -g [<code>]     generate mocks\n  -f              output linker flags\n  -d <directory>  mocks directory\n```\n\n> Check out the [basic example](https://github.com/vberlier/narmock/tree/master/examples/basic) for a simple Makefile that integrates both [Narwhal](https://github.com/vberlier/narwhal) and Narmock.\n\n### Generating mocks\n\nThe `narmock -g` command finds the functions mocked in your code and generates a `__mocks__.c` file and a `__mocks__.h` file that respectively define and declare all the required mocks.\n\n```bash\n$ gcc -E *.c | narmock -g\n```\n\nNarmock requires source code to be expanded by the preprocessor. You can directly pipe the output of `gcc -E` to the command-line utility.\n\nBy default, `__mocks__.c` and `__mocks__.h` will be created in the current directory. You can specify a different output directory with the `-d` option.\n\n```bash\n$ gcc -E tests/*.c | narmock -g -d tests\n```\n\n### Retrieving linker flags\n\nThe `narmock -f` command reads the generated `__mocks__.h` file and outputs the necessary linker flags for linking all your source files together.\n\n```bash\n$ gcc $(narmock -f) *.c\n```\n\nBy default, the command looks for `__mocks__.h` in the current directory. You can specify a different directory with the `-d` option.\n\n```bash\n$ gcc $(narmock -f -d tests) tests/*.c\n```\n\n## Mock API\n\nThe `MOCK` macro returns a pointer to the mock API of a given function.\n\n```c\nMOCK(time);\n```\n\n### Mock return\n\nYou can make a function return a specific value without calling its original implementation.\n\n```c\nMOCK(time)->mock_return(42);\n\nprintf("%ld\\n", time(NULL));  // Outputs 42\n```\n\n### Mock implementation\n\nYou can switch the implementation of a function.\n\n```c\ntime_t time_stub(time_t *timer)\n{\n    return 42;\n}\n\nMOCK(time)->mock_implementation(time_stub);\n\nprintf("%ld\\n", time(NULL));  // Outputs 42\n```\n\n### Disable mock\n\nYou can disable the mock and make the function call its original implementation.\n\n```c\nMOCK(time)->disable_mock();\n\nprintf("%ld\\n", time(NULL));  // Outputs the current time\n```\n\n## Contributing\n\nContributions are welcome. Feel free to open issues and suggest improvements. This project uses [poetry](https://poetry.eustace.io/) so you\'ll need to install it first if you want to be able to work with the project locally.\n\n```bash\n$ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python\n```\n\nYou should now be able to install the required dependencies.\n\n```bash\n$ poetry install\n```\n\nThe code follows the [black](https://github.com/ambv/black) code style.\n\n```bash\n$ poetry run black narmock\n```\n\nYou can run the tests with `poetry run make -C tests`. The test suite is built with [Narwhal](https://github.com/vberlier/narwhal).\n\n```bash\n$ poetry run make -C tests\n```\n\n---\n\nLicense - [MIT](https://github.com/vberlier/narmock/blob/master/LICENSE)\n',
    'author': 'Valentin Berlier',
    'author_email': 'berlier.v@gmail.com',
    'url': 'https://github.com/vberlier/narmock',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
