Skip to content

Commit

Permalink
Merge pull request bytecodealliance#220 from mooori/jsdoc
Browse files Browse the repository at this point in the history
docs: add some docs to `run-tests-zkasm.js`
  • Loading branch information
mooori committed Feb 14, 2024
2 parents f65f194 + 274ef8d commit a592aed
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 a592aed

Please sign in to comment.