Skip to main content

C++ mock object generator

Project description

drmock generator

Linux Windows macOS

drmock-generator is a component of the C++ testing/mocking framework DrMock. It takes a C++ .h file as input and generates the files for a mock implementation of the interface specified in the original header file, which the DrMock framework then consumes.

The framework contains a CMake integration of drmock-generator. Unless you're using a different build manager, you will not need to call drmock-generator directly. If you're interested in writing integrations for other build managers, feel free to contact us for support!

Installing

Run pip install . or make install install. Usage requires python>=3.7, python-clang>=11.0 and libclang. Install python-clang via pip install clang. For libclang:

sudo apt-get install libclang-7.0-dev       (on Linux)
choco install llvm                          (on Windows)

See chocolatey.org for details. On macOS, libclang is installed by default.

Using

Type drmock-generator --help for instructions. You must pass the path to the libclang.dll/.so/.dylib in one of two ways:

  • Set the environment variable CLANG_LIBRARY_FILE to the absolute path of the libclang.dll/.so/.dylib
  • Specify the absolute path to the libclang.dll/.so/.dylib using the -l parameter

The following paths are usually correct:

/usr/lib/llvm-7/lib/libclang.so                              (on Linux)
C:\Program Files\LLVM\bin\libclang.dll                       (on Windows using choco)
/Library/Developer/CommandLineTools/usr/lib/libclang.dylib   (on macOS)

On Windows, if you have trouble including STL headers, you may need to set the environment variable DRMOCK_GENERATOR_INCLUDE to the directory which contains the C++ headers. drmock-generator will then add an automatics -I%DRMOCK_GENERATOR_INCLUDE% flags to the compiler call.

Testing

To run all tests, call make. The environment variable CLANG_LIBRARY_FILE must be set in order to test the translator module.

Due to the irreducible complexity of the output of drmock-generator, any significant changes should be tested against the latest version of test suite of the C++ framework, as well.

Contributing

See CONTRIBUTING.md.

Developer notes

Details on the interface implemented by output code of drmock-generator is compliant with the specification of the C++ framework. See the documentation of the main framework for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drmock-generator-0.6.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drmock_generator-0.6.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file drmock-generator-0.6.0.tar.gz.

File metadata

  • Download URL: drmock-generator-0.6.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for drmock-generator-0.6.0.tar.gz
Algorithm Hash digest
SHA256 1dc91e50e87f2174f2b4f3df5dd3837ef643ffb3c112bfa89a9e713bdd7bfcd9
MD5 898274f7b7879ee5bb830838ab9611e2
BLAKE2b-256 b29ee42be1a059666b92edb3e30961ecbe4e5e666d59a0a5a1386bff64992e1a

See more details on using hashes here.

File details

Details for the file drmock_generator-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: drmock_generator-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for drmock_generator-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efc95a4c62df7a50e0b24d1787b75f25ddb60333502694b1bda813926cdf94f2
MD5 2c600181becc5b78c62fcba6b10f40d7
BLAKE2b-256 2f8d60513c11a15ab819609f7d71cbe228c0d11f7d7428f20080e0d37bd1d7d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page