Skip to content

Commit f868709

Browse files
authored
Fuzz kyber dao with semi random inputs. Automatic results comparsion.
This code will run as part of each regression. for doing deeper fuzz tests - testing larger set of inputs, should increase loop number and run.
1 parent 19c9a8a commit f868709

File tree

6 files changed

+1043
-10
lines changed

6 files changed

+1043
-10
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{
1515
"files": "*.js",
1616
"options": {
17-
"printWidth": 99,
17+
"printWidth": 119,
1818
"tabWidth": 2,
1919
"useTabs": false,
2020
"singleQuote": true,

test/helper.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function assertApproximate(val1, val2, errorStr) {
197197

198198
module.exports.assertEqualArray = assertEqualArray;
199199
function assertEqualArray(arr1, arr2, errorStr) {
200-
assert(arr1.equals(arr2), errorStr);
200+
assert(arr1.equals(arr2), `${errorStr} actual=${arr1} expected=${arr2}`);
201201
};
202202

203203
// Warn if overriding existing method
@@ -217,13 +217,15 @@ Array.prototype.equals = function (array) {
217217
for (var i = 0, l=this.length; i < l; i++) {
218218
// Check if we have nested arrays
219219
if (this[i] instanceof Array && array[i] instanceof Array) {
220-
// recurse into the nested arrays
221-
if (!this[i].equals(array[i]))
222-
return false;
223-
}
224-
else if (this[i] != array[i]) {
225-
// Warning - two different object instances will never be equal: {x:20} != {x:20}
226-
return false;
220+
// recurse into the nested arrays
221+
if (!this[i].equals(array[i]))
222+
return false;
223+
} else if (web3.utils.isBN(this[i]) && web3.utils.isBN(array[i])) {
224+
if (!this[i].eq(array[i]))
225+
return false;
226+
} else if (this[i] != array[i]) {
227+
// Warning - two different object instances will never be equal: {x:20} != {x:20}
228+
return false;
227229
}
228230
}
229231
return true;

0 commit comments

Comments
 (0)