test added
alrubio alberu04@ucm.es
Wed, 06 Oct 2021 12:49:54 +0200
4 files changed,
37 insertions(+),
3 deletions(-)
A
test/Multiplier2.circom
@@ -0,0 +1,11 @@
+pragma circom 2.0.0; + +template Multiplier2() { + signal input a; + signal input b; + signal output c; + c <== a*b; +} + +component main = Multiplier2(); +
A
test/multiplier2.js
@@ -0,0 +1,24 @@
+const chai = require("chai"); +const path = require("path"); +const wasm_tester = require("./../index").wasm; + +const F1Field = require("ffjavascript").F1Field; +const Scalar = require("ffjavascript").Scalar; +exports.p = Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617"); +const Fr = new F1Field(exports.p); + +const assert = chai.assert; + +describe("Exponentioation test", function () { + this.timeout(100000); + + it("Should generate the Exponentiation table in k=0", async () => { + + const circuit = await wasm_tester(path.join(__dirname, "Multiplier2.circom")); + const w = await circuit.calculateWitness({a: 2, b: 4}); + + await circuit.checkConstraints(w); + + }); + +});
M
wasm/tester.js
→
wasm/tester.js
@@ -51,7 +51,6 @@ if (options.sym) flags += "--sym ";
if (options.r1cs) flags += "--r1cs "; if (options.json) flags += "--json "; if (options.output) flags += "--output " + options.output + " "; - console.log(circom + flags + fileName); await exec("circom " + flags + fileName); }