Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions c/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,29 @@ class CTester {
return lines.join("\n");
}

// get output out of the witness
async getOutput(witness) {
const self = this;
if (!self.symbols) await self.loadSymbols();

let result = [];
for (let i = 0; true; i++) {
const tmp = self.symbols[`main.out[${i}]`];
if (tmp === undefined) {
break;
}
result.push(witness[tmp.varIdx].toString());
}

if(result.length == 0) {
assert(false, "No output found");
} else if(result.length == 1) {
return result[0];
} else {
return result;
}
}

async checkConstraints(witness) {
const self = this;
if (!self.constraints) await self.loadConstraints();
Expand Down