-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiplier.test.ts
38 lines (32 loc) · 1.11 KB
/
multiplier.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// A reference to using circomkit
// circomkit: https://github.com/erhant/circomkit
// more examples: https://github.com/erhant/circomkit-examples
// import { assert } from "chai";
import { Circomkit, WitnessTester } from "circomkit";
import "mocha";
// 1. circomkit may be setup once at a root file, e.g. index.test.ts
export const circomkit = new Circomkit({
verbose: false,
});
// 2. test.
// Use WitnessTester to declare circuit inputs and outputs.
// Use a `before` block to set up the circuit once, and use `it` blocks to test different cases.
describe("test Multiplier", () => {
let circuit: WitnessTester<["a", "b"], ["c"]>;
before(async () => {
circuit = await circomkit.WitnessTester(`Multiplier`, {
file: "multiplier",
template: "Multiplier",
// params: [],
});
console.log("#constraints:", await circuit.getConstraintCount());
});
it("multiplier 1", async () => {
const a = 2;
const b = 3;
const c = 6;
await circuit.expectPass({ a, b }, { c });
});
});
// 3. run test with `npx mocha test [-g testname]`
// or if you have just installed, `just test[g testname]`