{"id":49293589,"url":"https://github.com/nalediym/difftest","last_synced_at":"2026-04-26T02:02:45.890Z","repository":{"id":344363157,"uuid":"1181526111","full_name":"nalediym/difftest","owner":"nalediym","description":"Differential testing CLI — run two programs with the same inputs, compare outputs. Zero config. Language agnostic. CI friendly.","archived":false,"fork":false,"pushed_at":"2026-04-09T21:37:38.000Z","size":32784,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-20T18:14:05.052Z","etag":null,"topics":["ai-rewrite","cli","developer-tools","differential-testing","migration","rust","testing","verification"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nalediym.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-14T09:01:42.000Z","updated_at":"2026-04-16T19:58:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nalediym/difftest","commit_stats":null,"previous_names":["nalediym/difftest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nalediym/difftest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalediym%2Fdifftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalediym%2Fdifftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalediym%2Fdifftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalediym%2Fdifftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nalediym","download_url":"https://codeload.github.com/nalediym/difftest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalediym%2Fdifftest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32283294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"online","status_checked_at":"2026-04-26T02:00:05.962Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-rewrite","cli","developer-tools","differential-testing","migration","rust","testing","verification"],"created_at":"2026-04-26T02:02:45.285Z","updated_at":"2026-04-26T02:02:45.883Z","avatar_url":"https://github.com/nalediym.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# difftest\n\n[![Crates.io](https://img.shields.io/crates/v/difftest.svg)](https://crates.io/crates/difftest)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![CI](https://github.com/nalediym/difftest/actions/workflows/ci.yml/badge.svg)](https://github.com/nalediym/difftest/actions/workflows/ci.yml)\n\n**Differential testing for the AI rewrite era.**\n\nYou rewrote something — a function, a service, an entire codebase. Maybe you did it by hand. Maybe AI did it for you. Either way: **does it still work the same?**\n\ndifftest runs two programs with the same inputs and compares their outputs. If they match, the rewrite is behaviorally equivalent. If they don't, you see exactly where they diverge.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"demo/hero.gif\" alt=\"difftest demo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n## Install\n\n```bash\ncargo install difftest\n```\n\nOr build from source:\n\n```bash\ngit clone https://github.com/nalediym/difftest\ncd difftest\ncargo build --release\n```\n\n## Usage\n\n```bash\n# Auto-generate smoke test inputs\ndifftest ./old ./new\n\n# Custom inputs (each value is one test case)\ndifftest ./old ./new --inputs \"hello\" \"world\" \"\"\n\n# Compare programs written in different languages\ndifftest \"python3 old.py\" \"bun new.ts\" --inputs test\n\n# Pipe stdin to both\ncat data.txt | difftest ./old ./new --stdin\n\n# Also compare stderr\ndifftest ./old ./new --stderr\n\n# Quiet mode — just pass/fail, no diffs\ndifftest ./old ./new -q\n\n# Set a timeout (default: 30s) — kills programs that hang\ndifftest ./old ./new --timeout 10\n```\n\n## What it compares\n\nFor each input, difftest runs both programs and checks three things:\n\n| Check | Default | Flag |\n|-------|---------|------|\n| **stdout** | Always compared | — |\n| **exit code** | Always compared | — |\n| **stderr** | Ignored | `--stderr` |\n| **timeout** | 30 seconds | `--timeout N` |\n\nIf all checks match: **PASS**. If any differ: **FAIL** with a line-by-line diff.\n\n## Use cases\n\n### AI rewrites\nYou asked Claude to rewrite your Python service in Rust. difftest tells you if the output is identical.\n\n### Language migrations\nMoving from Python to Elixir? Express to Hono? Rails to Phoenix? Run both versions side-by-side.\n\n### Refactoring\nYou rewrote a gnarly function to be cleaner. difftest catches behavioral regressions your tests might miss.\n\n### Compiler testing\nLike [Csmith](https://github.com/csmith-project/csmith) — compile the same code with two compilers, compare outputs.\n\n### Binary verification\nExtract capabilities from a binary with [Ursula](https://github.com/nalediym/ursula), then verify the extraction is correct:\n```bash\nursula extract /usr/bin/wc\ndifftest /usr/bin/wc ./wc.shell/target/debug/wc\n```\n\n## Library usage\n\ndifftest is also a Rust library. Add it to your `Cargo.toml`:\n\n```toml\n[dependencies]\ndifftest = \"0.2\"\n```\n\nThen use it programmatically:\n\n```rust\nuse difftest::{run_pair, InputSource, RunResult};\nuse std::time::Duration;\n\nlet input = InputSource::Args(vec![\"hello\".into()]);\nlet timeout = Duration::from_secs(30);\n\nmatch run_pair(\"./old\", \"./new\", \u0026input, false, timeout) {\n    RunResult::Pass { label } =\u003e println!(\"{label}: identical\"),\n    RunResult::Fail { label, stdout_diff, .. } =\u003e {\n        println!(\"{label}: diverged\");\n        if let Some(diff) = stdout_diff {\n            print!(\"{diff}\");\n        }\n    }\n    RunResult::Error { label, message } =\u003e eprintln!(\"{label}: {message}\"),\n}\n```\n\n## How it works\n\n```\n          ┌─────────────┐\n          │   Inputs     │\n          │ (args/stdin) │\n          └──────┬───────┘\n                 │\n        ┌────────┴────────┐\n        ▼                 ▼\n  ┌──────────┐     ┌──────────┐\n  │ Program A │     │ Program B │\n  │ (oracle)  │     │(candidate)│\n  └─────┬─────┘     └─────┬─────┘\n        │                 │\n        ▼                 ▼\n  ┌──────────┐     ┌──────────┐\n  │  stdout   │     │  stdout   │\n  │  stderr   │ ══► │  stderr   │  compare\n  │  exit code│     │  exit code│\n  └──────────┘     └──────────┘\n        │                 │\n        └────────┬────────┘\n                 ▼\n          PASS or FAIL\n```\n\nNo AI. No magic. Just: run both, compare everything, show the diff.\n\n## CI integration\n\ndifftest exits with code 0 on success, 1 on failure — works in any CI pipeline:\n\n```yaml\n# GitHub Actions\n- name: Verify rewrite\n  run: difftest ./original ./rewrite --inputs \"test1\" \"test2\"\n```\n\n## Prior art\n\nDifferential testing is a well-established technique. difftest packages it into a CLI that just works.\n\n| Tool | Scope | Complexity |\n|------|-------|-----------|\n| **difftest** | Any two CLI programs | `cargo install`, zero config |\n| [Csmith](https://github.com/csmith-project/csmith) | C compiler testing | Generates random C programs |\n| [DIFFER](https://github.com/trailofbits/differ) | Debloated program validation | Python, YAML configs, libfuzzy-dev |\n| [Diferencia](https://github.com/lordofthejars/diferencia) | HTTP microservice comparison | HTTP-only |\n| `diff \u003c(./a) \u003c(./b)` | One-off comparison | No batching, no exit codes, no reporting |\n\n## Design principles\n\n- **Zero config** — no YAML, no TOML, no setup. Two arguments and go.\n- **Language agnostic** — compares programs, not code. Python vs Rust? Fine.\n- **CI friendly** — exit codes, quiet mode, structured output.\n- **Minimal dependencies** — `clap` for arg parsing, `libc` for process timeout. ~500 lines of Rust.\n\n## Development\n\n```bash\n# Run the full quality gauntlet (check, fmt, clippy, test, doc, wasm32)\nbin/test-lane\n\n# Quick mode (check + test only)\nbin/test-lane --quick\n\n# Verify the library compiles to WebAssembly\nbin/test-lane --wasm\n```\n\n## License\n\n[MIT](LICENSE)\n\n---\n\nBuilt by [Naledi](https://github.com/nalediym). See [CHANGELOG](CHANGELOG.md) for release history.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnalediym%2Fdifftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnalediym%2Fdifftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnalediym%2Fdifftest/lists"}