MCPcopy Create free account
hub / github.com/nodejs/node / fuzz

Function fuzz

deps/v8/test/mjsunit/unicodelctest.js:91–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89
90
91function fuzz() {
92 fuzz_index = 0;
93 seed = 49734321;
94 for (var i = 0; i < 1000; i++) {
95 var len = rand() & 0x1f;
96 var ranges = new Array(len);
97 var last = rand();
98 for (var j = 0; j < len; j++) {
99 ranges.push(last);
100 last = rc(last);
101 }
102 ranges.sort(function (a, b) { return a - b });
103 var cc = "";
104 for (var j = 0; j < len; j++) {
105 var ch = String.fromCharCode(ranges[j]);
106 if (ch == '\\' || ch == ']') ch = '\\' + ch;
107 cc += ch;
108 if (j < len - 1 && rand() & 1) cc += '-';
109 }
110 var negated = (last & 2) != 0;
111 var prefix = negated ? "[^" : "[";
112 var re = new RegExp(prefix + cc + "]");
113 for (var j = 0; j < len; j++) {
114 retest(re, (ranges[j] - 1), negated);
115 retest(re, (ranges[j]), negated);
116 retest(re, (ranges[j] + 1), negated);
117 }
118 }
119}
120
121
122function retest(re, code, negated) {

Callers 1

unicodelctest.jsFile · 0.70

Calls 5

sortMethod · 0.80
randFunction · 0.70
rcFunction · 0.70
retestFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected