# guillaumelaurin/cest architecture

> Architecture diagram of the GitHub repository guillaumelaurin/cest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guillaumelaurin/cest
- Repository: https://github.com/guillaumelaurin/cest

## Overview

Cest is a header-only C++20 testing library. A test author declares suites, cases, hooks, and expectations through the public API; the Runner executes registered tests and reports pass, failure, and skip results. Matchers raise assertion errors that the Runner handles. Separate mocking capabilities provide call-recording dependency mocks and runtime function or method patching. The sampled source is partial, so the graph omits uncertain internal wiring; README capabilities such as custom matchers and lifecycle hooks are included where documented.

Main entry points: [`include/cest/core.hpp`](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp) (Runner), [`include/cest/mocks/mock.hpp`](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp) (MockFn), [`include/cest/mocks/hot_patch.hpp`](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch.hpp) (Function patching), [`include/cest/mocks/hot_patch_method.hpp`](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch_method.hpp) (Method patching)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Test execution"]
  node_suite_api["Suite DSL<br/>[core.hpp]"]
  node_runner["Runner<br/>[core.hpp]"]
  node_hooks["Lifecycle hooks<br/>[core.hpp]"]
  node_cases["Test cases<br/>[core.hpp]"]
  node_report["Test report<br/>[core.hpp]"]
end

subgraph group_assertions["Assertions"]
  node_expect["Expect API<br/>[core.hpp]"]
  node_matchers["Matchers<br/>[core.hpp]"]
  node_assertion_error["Assertion errors<br/>[core.hpp]"]
end

subgraph group_mocks["Mocking"]
  node_mock_fn["MockFn<br/>[mock.hpp]"]
  node_mock_state["Call state<br/>[mock.hpp]"]
  node_mock_expect["Mock matchers<br/>[mock.hpp]"]
  node_hotpatch["Function patching<br/>[hot_patch.hpp]"]
  node_method_patch["Method patching"]
  node_guard["Patch guard<br/>[hot_patch.hpp]"]
end

node_author(("Test author"))
node_terminal(("Terminal"))

node_author -->|"declares suites"| node_suite_api
node_suite_api -->|"registers tests"| node_runner
node_author -->|"writes expectations"| node_expect
node_expect -->|"creates matcher"| node_matchers
node_matchers -->|"throws on failure"| node_assertion_error
node_runner -->|"runs hooks"| node_hooks
node_runner -->|"runs cases"| node_cases
node_runner -->|"catches failures"| node_assertion_error
node_runner -->|"formats results"| node_report
node_report -->|"writes output"| node_terminal
node_author -->|"configures or calls"| node_mock_fn
node_mock_fn -->|"records calls"| node_mock_state
node_author -->|"checks calls"| node_mock_expect
node_mock_expect -->|"queries calls"| node_mock_fn
node_author -->|"patches functions"| node_hotpatch
node_hotpatch -->|"returns guard"| node_guard
node_author -->|"patches methods"| node_method_patch
node_method_patch -->|"returns guard"| node_guard

click node_suite_api "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_runner "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_hooks "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_cases "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_report "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_expect "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_matchers "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_assertion_error "https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp"
click node_mock_fn "https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp"
click node_mock_state "https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp"
click node_mock_expect "https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp"
click node_hotpatch "https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch.hpp"
click node_method_patch "https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch_method.hpp"
click node_guard "https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch.hpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_suite_api,node_runner,node_hooks,node_cases,node_report toneBlue
class node_expect,node_matchers,node_assertion_error toneAmber
class node_mock_fn,node_mock_state,node_mock_expect,node_hotpatch,node_method_patch,node_guard toneMint
class node_author,node_terminal toneIndigo
```

## Components

### Test execution

- [Suite DSL](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`
- [Runner](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`
- [Lifecycle hooks](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`
- [Test cases](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`
- [Test report](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`

### Assertions

- [Expect API](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`
- [Matchers](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`
- [Assertion errors](https://github.com/guillaumelaurin/cest/blob/main/include/cest/core.hpp): `include/cest/core.hpp`

### Mocking

- [MockFn](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp): `include/cest/mocks/mock.hpp`
- [Call state](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp): `include/cest/mocks/mock.hpp`
- [Mock matchers](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/mock.hpp): `include/cest/mocks/mock.hpp`
- [Function patching](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch.hpp): `include/cest/mocks/hot_patch.hpp`
- [Method patching](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch_method.hpp): `include/cest/mocks/hot_patch_method.hpp`
- [Patch guard](https://github.com/guillaumelaurin/cest/blob/main/include/cest/mocks/hot_patch.hpp): `include/cest/mocks/hot_patch.hpp`

### Other components

- **Test author**
- **Terminal**

## Connections

- Test author → Suite DSL: declares suites
- Suite DSL → Runner: registers tests
- Test author → Expect API: writes expectations
- Expect API → Matchers: creates matcher
- Matchers → Assertion errors: throws on failure
- Runner → Lifecycle hooks: runs hooks
- Runner → Test cases: runs cases
- Runner → Assertion errors: catches failures
- Runner → Test report: formats results
- Test report → Terminal: writes output
- Test author → MockFn: configures or calls
- MockFn → Call state: records calls
- Test author → Mock matchers: checks calls
- Mock matchers → MockFn: queries calls
- Test author → Function patching: patches functions
- Function patching → Patch guard: returns guard
- Test author → Method patching: patches methods
- Method patching → Patch guard: returns guard
