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.

30 lines
941 B

  1. const path = require("path");
  2. const wasm_tester = require("circom_tester").wasm;
  3. const buildBabyJub = require("circomlibjs").buildBabyjub;
  4. const babyJub = require("circomlibjs").babyjub;
  5. describe("Point 2 bits test", function() {
  6. let babyJub;
  7. let F;
  8. let circuit;
  9. this.timeout(100000);
  10. before( async() => {
  11. babyJub = await buildBabyJub();
  12. F = babyJub.F;
  13. circuit = await wasm_tester(path.join(__dirname, "circuits", "pointbits_loopback.circom"));
  14. });
  15. it("Should do the both convertions for 8Base", async () => {
  16. const w = await circuit.calculateWitness({ in: [F.toObject(babyJub.Base8[0]), F.toObject(babyJub.Base8[1])]}, true);
  17. await circuit.checkConstraints(w);
  18. });
  19. it("Should do the both convertions for Zero point", async () => {
  20. const w = await circuit.calculateWitness({ in: [0, 1]}, true);
  21. await circuit.checkConstraints(w);
  22. });
  23. });