Skip to content

Commit e2fb733

Browse files
committed
test: simplify parallel/test-stringbytes-external
Make the algorithm that creates the big input strings a little easier to comprehend. No functional changes, the string lengths are unchanged. PR-URL: #1042 Reviewed-By: Trevor Norris <[email protected]>
1 parent 4aea16f commit e2fb733

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

test/parallel/test-stringbytes-external.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@ assert.equal(b[0], 0x61);
1515
assert.equal(b[1], 0);
1616
assert.equal(ucs2_control, c);
1717

18-
19-
// grow the strings to proper length
20-
while (write_str.length <= EXTERN_APEX) {
21-
write_str += write_str;
22-
ucs2_control += ucs2_control;
23-
}
24-
write_str += write_str.substr(0, EXTERN_APEX - write_str.length);
25-
ucs2_control += ucs2_control.substr(0, EXTERN_APEX * 2 - ucs2_control.length);
26-
18+
// now create big strings
19+
var size = 1 + (1 << 20);
20+
write_str = Array(size).join(write_str);
21+
ucs2_control = Array(size).join(ucs2_control);
2722

2823
// check resultant buffer and output string
2924
var b = new Buffer(write_str, 'ucs2');

0 commit comments

Comments
 (0)