circom_tester/test/multiplier2.js
test/multiplier2.jsRaw
1const chai = require("chai");
2const path = require("path");
3const wasm_tester = require("./../index").wasm;
4const c_tester = require("./../index").c;
5
6const F1Field = require("ffjavascript").F1Field;
7const Scalar = require("ffjavascript").Scalar;
8exports.p = Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617");
9const Fr = new F1Field(exports.p);
10
11const assert = chai.assert;
12
13describe("Simple test", function () {
14 this.timeout(100000);
15
16 it("Checking the compilation of a simple circuit generating wasm", async () => {
17
18 const circuit = await wasm_tester(path.join(__dirname, "Multiplier2.circom"));
19 const w = await circuit.calculateWitness({a: 2, b: 4});
20 await circuit.checkConstraints(w);
21 });
22
23 it("Checking the compilation of a simple circuit generating C", async () => {
24
25 const circuit = await c_tester(path.join(__dirname, "Multiplier2.circom"));
26 const w = await circuit.calculateWitness({a: 2, b: 4});
27 await circuit.checkConstraints(w);
28
29 });
30
31});