Skip to content

Commit

Permalink
add compilation test
Browse files Browse the repository at this point in the history
  • Loading branch information
Trivo25 committed Nov 23, 2024
1 parent a0f0f34 commit e22f96b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/lib/proof-system/zkprogram.unit-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Field } from '../provable/wrapped.js';
import { ZkProgram } from './zkprogram.js';

const methodCount = 30;

let MyProgram = ZkProgram({
name: 'large-program',
publicOutput: Field,
methods: nMethods(methodCount),
});

function nMethods(i: number) {
let methods: Record<string, any> = {};
for (let j = 0; j < i; j++) {
methods['method' + j] = {
privateInputs: [Field],
async method(a: Field) {
return {
publicOutput: a.mul(1),
};
},
};
}
return methods;
}

try {
await MyProgram.compile();
} catch (error) {
throw Error(
`Could not compile zkProgram with ${methodCount} branches: ${error}`
);
}

0 comments on commit e22f96b

Please sign in to comment.