compute block added

This commit is contained in:
Jordi Baylina
2019-08-29 16:26:19 +02:00
parent 597deb1eaa
commit f05c4e1338
7 changed files with 229 additions and 168 deletions

View File

@@ -49,4 +49,14 @@ describe("Sum test", () => {
// await compiler(path.join(__dirname, "circuits", "assignsignal.circom"));
// }, /Cannot assign to a signal .*/);
// });
it("Should compile a code with compute", async () => {
const cirDef = await compiler(path.join(__dirname, "circuits", "compute.circom"));
const circuit = new snarkjs.Circuit(cirDef);
const witness = circuit.calculateWitness({ "x": 6});
assert(witness[0].equals(bigInt(1)));
assert(witness[1].equals(bigInt(37)));
assert(witness[2].equals(bigInt(6)));
});
});