circomlib/test/mimccircuit.js

26 lines
619 B
JavaScript
Raw Normal View History

2018-12-06 19:32:49 +03:00
const chai = require("chai");
const path = require("path");
2019-12-14 22:32:45 +03:00
const tester = require("circom").tester;
2018-12-06 19:32:49 +03:00
const mimcjs = require("../src/mimc7.js");
describe("MiMC Circuit test", function () {
let circuit;
this.timeout(100000);
before( async () => {
2019-12-14 22:32:45 +03:00
circuit = await tester(path.join(__dirname, "circuits", "mimc_test.circom"));
2018-12-06 19:32:49 +03:00
});
it("Should check constrain", async () => {
2019-12-14 22:32:45 +03:00
const w = await circuit.calculateWitness({x_in: 1, k: 2});
2018-12-06 19:32:49 +03:00
const res2 = mimcjs.hash(1,2,91);
2019-12-14 22:32:45 +03:00
await circuit.assertOut(w, {out: res2});
2018-12-06 19:32:49 +03:00
2019-12-16 23:35:52 +03:00
await circuit.checkConstraints(w);
2018-12-06 19:32:49 +03:00
});
});