# Writing unit tests for noir protocol circuits

**URL:** <https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649>\
**Category:** Aztec\
**Tags:** noir\
**Created:** [December 16, 2023, 12:57pm UTC](https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649 "2023-12-16T12:57:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thankyou](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.aztec.network/thankyou/32/925_2.png) [@thankyou](https://forum.aztec.network/u/thankyou)\
**Post date:** [December 16, 2023, 12:57pm UTC](https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649/1 "2023-12-16T12:57:44Z")

</div>

Hi,

As a side project, I’m auditing and writing unit tests for the Aztec Noir protocol circuits. I have a few questions for any of the devs"

1. Does your team accept PRs that introduce unit tests?
2. Is there any preferred best practices that I can align myself with when writing tests?

Thanks!

---

<div class="post-metadata">

**Author:** ![joshc](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.aztec.network/joshc/32/20_2.png) [@joshc](https://forum.aztec.network/u/joshc)\
**Post date:** [December 18, 2023, 2:39pm UTC](https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649/2 "2023-12-18T14:39:07Z")

</div>

Hey @thankyou, thanks for reaching out and for your interest in contributing! Our protocol circuits are still changing, so I think it’s a bit preemptive to accept external PRs for protocol circuit unit tests.

I don’t think we have best practices for these tests documented yet, but you can see how we’ve written some [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr#L145).

---

<div class="post-metadata">

**Author:** ![thankyou](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.aztec.network/thankyou/32/925_2.png) [@thankyou](https://forum.aztec.network/u/thankyou)\
**Post date:** [December 18, 2023, 7:00pm UTC](https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649/3 "2023-12-18T19:00:42Z")

</div>

Thanks @joshc.

Quick follow up question. Is there any stable Noir code that could use some tests? If not, that’s fine. I’ll just continue on in my little corner doing my audit :).

---

<div class="post-metadata">

**Author:** ![joshc](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.aztec.network/joshc/32/20_2.png) [@joshc](https://forum.aztec.network/u/joshc)\
**Post date:** [December 19, 2023, 2:19am UTC](https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649/4 "2023-12-19T02:19:29Z")

</div>

Looking through the open issues in the Noir repo, some of these look like good ones that you could pick up.

- [Add a test to check that dependency management works properly #184](https://github.com/noir-lang/noir/issues/184)
- [Discuss if](https://github.com/noir-lang/noir/issues/457)`crates/nargo/src/cli/mod.rs` [tests are right placed #457](https://github.com/noir-lang/noir/issues/457)
- [Create more tests with exernal crates #734](https://github.com/noir-lang/noir/issues/734)
- [Add integration test for contract artifact output #1159](https://github.com/noir-lang/noir/issues/1159)
- [Check if our inputs are malleable modulo the prime of the Field #2008](https://github.com/noir-lang/noir/issues/2008)
- [Testing: Compile twice and hash bytecode to check for non-determinism #2036](https://github.com/noir-lang/noir/issues/2036)
- [Run CLI vs WASM equivalence tests on a range of programs #2187](https://github.com/noir-lang/noir/issues/2187)
- [Simplify the release acceptance tests #2262](https://github.com/noir-lang/noir/issues/2262)
- [Release acceptance testing suite doesn’t report errors on windows. #2270](https://github.com/noir-lang/noir/issues/2270)
- [Add fuzzy tests to noir #2888](https://github.com/noir-lang/noir/issues/2888)
- `println` [call in nargo tests should start on a new line #2913](https://github.com/noir-lang/noir/issues/2913)
- [Standardise location of test noir programs #3484](https://github.com/noir-lang/noir/issues/3484)
- [Re-enable ignored tests #3802](https://github.com/noir-lang/noir/issues/3802)

---

<div class="post-metadata">

**Author:** ![thankyou](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.aztec.network/thankyou/32/925_2.png) [@thankyou](https://forum.aztec.network/u/thankyou)\
**Post date:** [December 20, 2023, 12:40pm UTC](https://forum.aztec.network/t/writing-unit-tests-for-noir-protocol-circuits/2649/5 "2023-12-20T12:40:02Z")

</div>

Thanks for the help @joshc!
