mirror of
https://github.com/arnaucube/circom_tester.git
synced 2026-02-08 03:46:46 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e615bc3280 | ||
|
|
3942e16d84 |
4
index.js
4
index.js
@@ -1,2 +1,2 @@
|
||||
exports.wasm = import("./wasm/tester");
|
||||
exports.c = import("./c/tester");
|
||||
exports.wasm = require("./wasm/tester");
|
||||
//exports.c = require("./c/tester");
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "circom_tester",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "circom_tester",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"chai": "^4.3.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "circom_tester",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"description": "Tools for testing circom circuits.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
11
test/Multiplier2.circom
Normal file
11
test/Multiplier2.circom
Normal file
@@ -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();
|
||||
|
||||
24
test/multiplier2.js
Normal file
24
test/multiplier2.js
Normal file
@@ -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);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -51,7 +51,6 @@ async function compile (fileName, options) {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user