# kaio-souza/nim-proptest architecture

> Architecture diagram of the GitHub repository kaio-souza/nim-proptest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaio-souza/nim-proptest
- Repository: https://github.com/kaio-souza/nim-proptest

## Overview

proptest is a Nim property-based testing library: users declare properties, the library generates cases, detects failures, shrinks counterexamples, and reports results that can be replayed. Its documented capabilities also include derived generators, stateful testing, coverage labels, boundary-seeking exploration, JSON Lines reporting, and a hang watchdog. The source excerpts were unavailable, so relationships below are limited to those stated in the README; module-level call details are not inferred.

Main entry points: [`src/proptest/engine.nim`](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/engine.nim) (Test engine), [`src/proptest.nim`](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest.nim) (Property API), [`src/proptest/shrink.nim`](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/shrink.nim) (Counterexample shrinking), [`src/proptest/report.nim`](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/report.nim) (Result reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Property API"]
  node_api["Property API<br/>[proptest.nim]"]
  node_assertions["Assertions<br/>[assertions.nim]"]
  node_generators["Generators<br/>[gen.nim]"]
  node_choices["Choice tracking<br/>[choices.nim]"]
end

subgraph group_execution["Property Execution"]
  node_engine["Test engine<br/>[engine.nim]"]
  node_prng["Seeded randomness<br/>[prng.nim]"]
  node_stateful["Stateful testing<br/>[stateful.nim]"]
end

subgraph group_failure["Failure Handling"]
  node_shrink["Counterexample shrinking<br/>[shrink.nim]"]
  node_database[("Failure database<br/>[database.nim]")]
  node_signature["Failure identity<br/>[signature.nim]"]
  node_watchdog["Hang watchdog<br/>[watchdog.nim]"]
end

subgraph group_insight["Exploration and Reporting"]
  node_labels["Coverage labels<br/>[labels.nim]"]
  node_mining["Boundary exploration<br/>[mining.nim]"]
  node_report["Result reporting<br/>[report.nim]"]
  node_jsonout["JSON Lines output<br/>[jsonout.nim]"]
end

node_developer(("Property author"))

node_developer -->|"declares properties"| node_api
node_api -->|"runs properties"| node_engine
node_engine -->|"generates inputs"| node_generators
node_engine -->|"uses seed"| node_prng
node_engine -->|"evaluates assertions"| node_assertions
node_engine -->|"runs stateful tests"| node_stateful
node_engine -->|"replays failures"| node_database
node_engine -->|"shrinks failures"| node_shrink
node_engine -->|"identifies failures"| node_signature
node_engine -->|"limits case runtime"| node_watchdog
node_engine -->|"tracks coverage"| node_labels
node_engine -->|"seeks boundaries"| node_mining
node_engine -->|"produces results"| node_report
node_report -->|"writes JSON Lines"| node_jsonout
node_shrink -.->|"saves failures"| node_database

click node_api "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest.nim"
click node_assertions "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/assertions.nim"
click node_generators "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/gen.nim"
click node_choices "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/choices.nim"
click node_engine "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/engine.nim"
click node_prng "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/prng.nim"
click node_stateful "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/stateful.nim"
click node_shrink "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/shrink.nim"
click node_database "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/database.nim"
click node_signature "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/signature.nim"
click node_watchdog "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/watchdog.nim"
click node_labels "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/labels.nim"
click node_mining "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/mining.nim"
click node_report "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/report.nim"
click node_jsonout "https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/jsonout.nim"

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_api,node_assertions,node_generators,node_choices toneBlue
class node_engine,node_prng,node_stateful toneAmber
class node_shrink,node_database,node_signature,node_watchdog toneMint
class node_labels,node_mining,node_report,node_jsonout toneRose
class node_developer toneIndigo
```

## Components

### Property API

- [Property API](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest.nim): `src/proptest.nim`
- [Assertions](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/assertions.nim): `src/proptest/assertions.nim`
- [Generators](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/gen.nim): `src/proptest/gen.nim`
- [Choice tracking](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/choices.nim): `src/proptest/choices.nim`

### Property Execution

- [Test engine](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/engine.nim): `src/proptest/engine.nim`
- [Seeded randomness](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/prng.nim): `src/proptest/prng.nim`
- [Stateful testing](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/stateful.nim): `src/proptest/stateful.nim`

### Failure Handling

- [Counterexample shrinking](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/shrink.nim): `src/proptest/shrink.nim`
- [Failure database](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/database.nim): `src/proptest/database.nim`
- [Failure identity](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/signature.nim): `src/proptest/signature.nim`
- [Hang watchdog](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/watchdog.nim): `src/proptest/watchdog.nim`

### Exploration and Reporting

- [Coverage labels](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/labels.nim): `src/proptest/labels.nim`
- [Boundary exploration](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/mining.nim): `src/proptest/mining.nim`
- [Result reporting](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/report.nim): `src/proptest/report.nim`
- [JSON Lines output](https://github.com/kaio-souza/nim-proptest/blob/master/src/proptest/jsonout.nim): `src/proptest/jsonout.nim`

### Other components

- **Property author**

## Connections

- Property author → Property API: declares properties (evidence: `README.md`)
- Property API → Test engine: runs properties (evidence: `README.md`)
- Test engine → Generators: generates inputs (evidence: `README.md`)
- Test engine → Seeded randomness: uses seed (evidence: `README.md`)
- Test engine → Assertions: evaluates assertions (evidence: `README.md`)
- Test engine → Stateful testing: runs stateful tests (evidence: `README.md`)
- Test engine → Failure database: replays failures (evidence: `README.md`)
- Test engine → Counterexample shrinking: shrinks failures (evidence: `README.md`)
- Test engine → Failure identity: identifies failures (evidence: `README.md`)
- Test engine → Hang watchdog: limits case runtime (evidence: `README.md`)
- Test engine → Coverage labels: tracks coverage (evidence: `README.md`)
- Test engine → Boundary exploration: seeks boundaries (evidence: `README.md`)
- Test engine → Result reporting: produces results (evidence: `README.md`)
- Result reporting → JSON Lines output: writes JSON Lines (evidence: `README.md`)
- Counterexample shrinking → Failure database: saves failures
