MCPcopy Index your code
hub / github.com/ThrowTheSwitch/CMock

github.com/ThrowTheSwitch/CMock @v2.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.6.0 ↗ · + Follow
1,200 symbols 2,020 edges 150 files 671 documented · 56%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CMock CI

CMock is a mock and stub generator and runtime for unit testing C. It's been designed to work smoothly with Unity Test, another of the embedded-software testing tools developed by ThrowTheSwitch.org. CMock automagically parses your C headers and creates useful and usable mock interfaces for unit testing. Give it a try!

If you don't care to manage unit testing builds yourself, consider checking out Ceedling, a test-centered build manager for unit testing C code.

Getting Started

Your first step is to get yourself a copy of CMock. There are a number of ways to do this:

  1. If you're using Ceedling, there is no need to install CMock. It will handle it for you.

  2. The simplest way is to grab it off github. The Github method looks something like this:

    git clone --recursive https://github.com/throwtheswitch/cmock.git

  3. You can also grab the zip file from github. If you do this, you'll also need to grab yourself a copy of Unity and CException, because github unfortunately doesn't bake dependencies into the zip files.

Contributing to this Project

If you plan to help with the development of CMock (or just want to verify that it can perform its self tests on your system) then you can grab its self-testing dependencies, then run its self-tests:

> cd cmock
> bundle install   # Ensures you have all RubyGems needed
> cd test
> rake             # Run all CMock self tests

Before working on this project, you're going to want to read our guidelines on contributing.

API Documentation

Core symbols most depended-on inside this repo

parse
called by 60
lib/cmock_header_parser.rb
CMock_Guts_MemBytesFree
called by 37
src/cmock.c
CMock_Guts_MemBytesUsed
called by 36
src/cmock.c
CMock_Guts_MemNew
called by 31
src/cmock.c
mock_function_declarations
called by 28
lib/cmock_generator_plugin_array.rb
AT91F_PMC_EnablePeriphClock
called by 25
test/iar/iar_v4/incIAR/lib_AT91SAM7X256.h
AT91F_PMC_EnablePeriphClock
called by 25
test/iar/iar_v5/incIAR/lib_AT91SAM7X256.h
import_source
called by 24
lib/cmock_header_parser.rb

Shape

Function 926
Method 193
Class 81

Languages

C++59%
C21%
Ruby19%

Modules by API surface

test/iar/iar_v5/incIAR/lib_AT91SAM7X256.h326 symbols
test/iar/iar_v4/incIAR/lib_AT91SAM7X256.h326 symbols
test/iar/iar_v4/incIAR/ioat91sam7x256.h26 symbols
examples/temp_sensor/src/AT91SAM7X256.h26 symbols
test/rakefile_helper.rb25 symbols
lib/cmock_generator.rb22 symbols
examples/temp_sensor/rakefile_helper.rb20 symbols
lib/cmock_header_parser.rb19 symbols
lib/cmock_generator_utils.rb14 symbols
examples/temp_sensor/test/TestTimerConfigurator.c14 symbols
test/system/systest_generator.rb12 symbols
test/c/TestCMockC.c11 symbols

For agents

$ claude mcp add CMock \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact