Skip to content

Commit

Permalink
docs: add some docs to run-tests-zkasm.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mooori committed Feb 14, 2024
1 parent f65f194 commit 274ef8d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/zkasm/run-tests-zkasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ function value_to_json(key, value) {
return value;
}

/**
* Executes zkASM stored in files. Expects the following positional command line arguments:
*
* @param {string} path - The file or a directory to search for zkASM files.
* @param {string} [outFile] - If provided, results are written to this file. Otherwise they are
* printed to stdout.
*/
async function main() {
// Compile pil
const cmPols = await compilePil();
Expand Down Expand Up @@ -76,7 +83,12 @@ async function compilePil() {
return newCommitPolsArray(pil);
}

// Get all zkasm test files
/**
* Returns the path of all zkasm test files in `pathZkasm`.
*
* @param {string} pathZkasm
* @returns {string[]}
*/
function getTestFiles(pathZkasm) {
if (!fs.existsSync(pathZkasm)) {
return [];
Expand All @@ -94,7 +106,10 @@ function getTestFiles(pathZkasm) {
return filesNames.map((fileName) => path.join(pathZkasm, fileName));
}

// returns true if test succeed and false if test failed
/**
* @returns {Object} Which indicates if the test run succeeded or failed. Contains additional data
* related to the test run.
*/
async function runTest(pathTest, cmPols) {
// Compile rom
const configZkasm = {
Expand Down

0 comments on commit 274ef8d

Please sign in to comment.