You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
719 B

  1. const chai = require("chai");
  2. const path = require("path");
  3. const wasm_tester = require("circom_tester").wasm;
  4. const buildMimc7 = require("circomlibjs").buildMimc7;
  5. describe("MiMC Circuit test", function () {
  6. let circuit;
  7. let mimc7;
  8. this.timeout(100000);
  9. before( async () => {
  10. mimc7 = await buildMimc7();
  11. circuit = await wasm_tester(path.join(__dirname, "circuits", "mimc_test.circom"));
  12. });
  13. it("Should check constrain", async () => {
  14. const w = await circuit.calculateWitness({x_in: 1, k: 2}, true);
  15. const res2 = mimc7.hash(1,2,91);
  16. await circuit.assertOut(w, {out: mimc7.F.toObject(res2)});
  17. await circuit.checkConstraints(w);
  18. });
  19. });