noir-testing
Test Noir circuits using nargo test. Covers test attributes, assertions, and organization patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Test Noir circuits using nargo test. Covers test attributes, assertions, and organization patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Patterns for Noir circuit development: data types, stdlib, workspace setup. Use when working with Noir circuits in any capacity unless otherwise specified
Guidelines for writing idiomatic, efficient Noir programs. Use when writing or reviewing Noir code.
JavaScript/TypeScript integration with Noir circuits. Covers compilation, witness generation, proving, and verification using noir_js and bb.js.
Workflow for measuring and optimizing the ACIR circuit size of a constrained Noir program. Use when asked to optimize a Noir program's gate count or circuit size.
Review Noir circuits for correctness, constraint efficiency, and proof soundness. Use proactively after writing or modifying Noir circuits.
Web integration for Noir circuits. Covers React integration, Web Worker proving, WASM setup, and UX patterns for browser-based ZK applications.
| name | noir-testing |
| description | Test Noir circuits using nargo test. Covers test attributes, assertions, and organization patterns. |
| allowed-tools | Read, Grep, Glob, Edit, Write, Bash |
Noir has a built-in test framework that runs alongside your circuit code using nargo test. Tests are constrained by default, meaning they generate real constraints and verify circuit behavior under proving conditions.
.nr files as circuit code, or in separate test modulesunconstrained to run tests without constraint generation (faster, but less thorough)nargo# Run all tests in the project
nargo test
# Run a specific test by exact name
nargo test --exact test_addition
# Run tests matching a prefix
nargo test test_transfer
# Show println output during tests
nargo test --show-output
fn add(x: Field, y: Field) -> Field {
x + y
}
#[test]
fn test_add() {
assert_eq(add(2, 3), 5);
}
#[test(should_fail_with = "attempt to divide by zero")]
fn test_divide_by_zero() {
let _ = 1 / 0;
}
#[test]
unconstrained fn test_add_unconstrained() {
// Runs faster without constraint generation
assert_eq(add(2, 3), 5);
}
#[test], should_fail, constrained vs unconstrainedassert, assert_eq, debugging with println