Metadata-Version: 2.4
Name: testforge-unittest
Version: 0.1.1
Summary: Automated unit test generator for embedded C, C++, Python, and assembly
Author-email: Myattech <support@myattech.com>
License-Expression: LicenseRef-Proprietary
Keywords: embedded,testing,unity,firmware,c,cpp,assembly,mcp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Requires-Dist: tree-sitter>=0.20
Requires-Dist: tree-sitter-c
Requires-Dist: tree-sitter-cpp
Requires-Dist: tree-sitter-python
Requires-Dist: customtkinter
Provides-Extra: mcp
Requires-Dist: mcp>=1.0; extra == "mcp"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: mcp>=1.0; extra == "dev"
Requires-Dist: ruff; extra == "dev"

# TestForge

**Stop writing unit tests by hand.**

TestForge reads your embedded C, C++, Python, and assembly source files and generates ready-to-compile unit test files for Unity (primary), CppUTest, or Google Test. It extracts function signatures, detects hardware-dependent calls, inserts boundary-value test cases, and produces stubs so your tests compile without the full hardware or RTOS.

No more hand-written boilerplate that rots the first time the HAL changes. Run `testforge report` to see what it finds, then `testforge generate` to get the first draft of tests in seconds.

---

## Quick Start

```bash
# Install (requires Python 3.10+ for now; standalone binaries after launch)
git clone https://github.com/tommy0x2a/TestForge.git
cd TestForge
pip install -e ".[dev]"

# One-time project setup (downloads Unity + creates build files)
testforge init

# See what functions are in a file
testforge report -i test_data/blink.c
```

Or launch the GUI:
```bash
testforge gui
```

Actual output:

```
TestForge Report - 2026-06-02 21:56:57
========================================
Parsed 1 file(s) | Skipped 0 | Functions: 4 | Warnings: 0

Functions found:
  1. SystemClock_Config(void) -> void  [line 3-5]
  2. GPIO_Init(GPIO_TypeDef GPIOx, GPIO_InitTypeDef GPIO_Init) -> void  [line 7-9]
  3. delay_ms(uint32_t ms) -> void  [line 11-13]
  4. main(void) -> int  [line 15-23]

Warnings (0): none

Run 'testforge generate' to produce test files.
```

```bash
# Generate Unity tests (writes tests/blink_test.c and blink_test.h)
testforge generate -i test_data/blink.c
```

---

## What TestForge generates

From `test_data/blink.c`, `testforge generate` produces (excerpt — one test function shown verbatim):

```c
/**
 * Test: delay_ms
 * Lines: 11–13 in blink.c
 */
void test_delay_ms(void) {
    /* --- Arrange --- */
    /* Boundary values for 'ms' (uint32_t): 0, 1, 4294967295UL */
    uint32_t ms = 0;
    /* --- Act --- */
    delay_ms(ms);
    /* --- Assert --- */
    /* No return value to assert — verify behavior via side effects or stubs */
    TEST_PASS();
}
```

Full file also includes setUp/tearDown, a main() runner, and hardware stubs for functions flagged as I/O dependent. The generated tests compile but are starting points — an engineer reviews and strengthens assertions before committing.

---

## Supported languages

| Language | Parser          | Output Frameworks          | Status     |
|----------|-----------------|----------------------------|------------|
| C        | tree-sitter + libclang | Unity (primary), CppUTest, Google Test | Complete (M3) |
| C++      | tree-sitter + libclang | Unity, CppUTest, Google Test | Complete (M3) |
| Python   | tree-sitter     | Unity, CppUTest, Google Test | Complete (M3) |
| ARM Assembly | custom boundary + register scan | Unity (register comments) | Complete (M4) |

All parsers and the Unity formatter are covered by the test suite. CppUTest and Google Test formatters exist and produce compilable output but have received less battle-testing than Unity.

---

## AI Assistant Integration (MCP)

TestForge™ exposes its full engine as MCP tools — Claude, Cursor, 
and Grok can discover functions, generate tests, and run constraint 
plans directly inside your AI coding session.

**Setup:** See [docs/mcp_setup.md](docs/mcp_setup.md)  
**Available on:** [Smithery](https://smithery.ai/server/testforge)

---

## AI Assistant Integration (MCP)

TestForge™ exposes its full engine as MCP tools — Claude, Cursor, 
and Grok can discover functions, generate tests, and run constraint 
plans directly inside your AI coding session.

**Setup:** See [docs/mcp_setup.md](docs/mcp_setup.md)  
**Available on:** [Smithery](https://smithery.ai/server/testforge)

---

## Pricing

- **30-day free trial** — full features, no restrictions, no telemetry, air-gap friendly after activation.
- **Individual license**: $149 one-time
- **Team license (5 seats)**: $499 one-time

Purchase at [myattech.com](https://myattech.com) (storefront live after GitHub release). License keys are RSA-PSS signed and verified locally — works in air-gapped labs.

---

## Why not [competitor]?

- **VectorCAST / Tessy**: $10,000–$50,000 per seat. Overkill for teams that just need fast unit test scaffolding on a handful of modules.
- **Unity / CppUTest / Google Test by hand**: Excellent frameworks. Still require you to write every test function, every boundary case, and every hardware stub yourself. TestForge feeds those frameworks.
- **GitHub Copilot / general LLMs**: Helpful for boilerplate in application code. Weak on embedded specifics (volatile registers, HAL call sites, assembly, deterministic boundary values, and the exact include/stub patterns your project needs). No air-gap option and no reproducible local license model.

TestForge is narrow and deep: it does one job for one audience and does it offline.

---

## License

Proprietary software from Myattech, LLC.  
30-day fully-featured trial included.  
Commercial use requires a purchased license key.  
See [myattech.com](https://myattech.com) for current terms and 30-day money-back guarantee.

---

## Roadmap

**Completed (Phase 1 — Garage):**
- M1: C parser (tree-sitter + libclang)
- M2: Unity test generator + boundary values + hardware stubs
- M3: C++ and Python parsers + formatters
- M4: ARM assembly function boundary + register sequence extraction
- M5: Local RSA-PSS licensing (trial + paid keys), `license` subcommands, air-gap support
- M6–M8: Packaging, GUI foundations, path mirroring, init command, header generation
- M9: Boundary explosion, guard detection, multi-vendor isolation, pytest output
- M10: Bidirectional constraint test plans (`--with-plan` / `--plan`), Option C protection, full IP/trademark injection
- M11: End-to-end compilable builds (BlinkApp): source isolation wrappers, per-app CMakeLists, VSCode debug launch.json/tasks, meaningful pre-annotated plans
- M12: Discovery → Curation → Execution (DCE) workflow — `testforge discover`, live `testforge run --plan` with constraints/stress/mocks, MockBackend + SerialBackend (socat loopback), PlanRunner + rich reports, `mock_valid_struct` + ctypes struct/buffer simulation for training, canonical SerialApp example with fully annotated plan. All prior tests unbroken.

**Current capabilities (beyond original M6 launch vision):**
- Full static test generation for C/C++/Python/ASM → Unity (primary) + other frameworks
- Compilable test binaries with source wrappers + debuggable in VSCode (no manual edits)
- Powerful live constraint execution engine (DCE) for validation, demos, and "spec-driven" testing of HAL/drivers
- 30-day air-gap trial + local license validation

**Future (post first customers / Phase 2+):**
- macOS binary + notarization
- GUI integration for plan curation + one-click DCE runs
- Real shared-lib execution path for C functions in `run`
- CI-friendly report artifacts + more backends
- Additional assembly architectures; RegisterGen companion tool

No vaporware. The committed code and passing test suite are the source of truth. The DCE live runner + SerialApp is the recommended way to experience the full power of the constraint + mock system.

---

## Contact

- GitHub Issues: https://github.com/tommy0x2a/TestForge/issues
- Direct: message @tommy0x2a on GitHub
- Support: support@myattech.com

Bugs, surprising parse results, and "it generated X but I needed Y" reports are all welcome. This tool is built by one embedded engineer who got tired of writing the same tests.

---

*Built by [Myattech, LLC](https://myattech.com) — bootstrapped developer tools for people who ship firmware.*
