diff --git a/tests/manual/matchall-bench.js b/tests/manual/matchall-bench.js new file mode 100644 index 0000000..4990287 --- /dev/null +++ b/tests/manual/matchall-bench.js @@ -0,0 +1,16 @@ +'use strict'; + +const RE2 = require('../../re2'); + +const N = 1_000_000; + +const s = 'a'.repeat(N), + re = new RE2('a', 'g'), + matches = s.matchAll(re); + +let n = 0; +for (const _ of matches) ++n; + +if (n !== s.length) console.log('Wrong result.'); + +console.log('Done.');