mirror of
https://github.com/arnaucube/circomlib.git
synced 2026-02-07 03:06:44 +01:00
Pedersen2 and BitPoints MulFix and MulAny
This commit is contained in:
33
test/point2bits.js
Normal file
33
test/point2bits.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const chai = require("chai");
|
||||
const path = require("path");
|
||||
const snarkjs = require("snarkjs");
|
||||
const compiler = require("circom");
|
||||
|
||||
const assert = chai.assert;
|
||||
|
||||
const bigInt = snarkjs.bigInt;
|
||||
|
||||
const babyJub = require("../src/babyjub.js");
|
||||
|
||||
|
||||
describe("Point 2 bits test", function() {
|
||||
let circuit;
|
||||
this.timeout(100000);
|
||||
before( async() => {
|
||||
const cirDef = await compiler(path.join(__dirname, "circuits", "pointbits_loopback.circom"));
|
||||
|
||||
circuit = new snarkjs.Circuit(cirDef);
|
||||
|
||||
console.log("NConstrains Point2Bits loopback: " + circuit.nConstraints);
|
||||
});
|
||||
it("Should do the both convertions for 8Base", async () => {
|
||||
const w = circuit.calculateWitness({ in: babyJub.Base8});
|
||||
|
||||
assert(circuit.checkWitness(w));
|
||||
});
|
||||
it("Should do the both convertions for Zero point", async () => {
|
||||
const w = circuit.calculateWitness({ in: [0, 1]});
|
||||
|
||||
assert(circuit.checkWitness(w));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user