projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
630bb7a
)
Add some tests to test-buffer.js
author
Ryan Dahl
<ry@tinyclouds.org>
Sun, 13 Dec 2009 07:57:54 +0000
(08:57 +0100)
committer
Ryan Dahl
<ry@tinyclouds.org>
Tue, 29 Dec 2009 20:12:28 +0000
(21:12 +0100)
test/mjsunit/test-buffer.js
patch
|
blob
|
history
diff --git
a/test/mjsunit/test-buffer.js
b/test/mjsunit/test-buffer.js
index
763faa4
..
cfeafa1
100644
(file)
--- a/
test/mjsunit/test-buffer.js
+++ b/
test/mjsunit/test-buffer.js
@@
-4,15
+4,18
@@
assert = require("assert");
var b = new process.Buffer(1024);
-sys.puts("b[0] == " + b[0]);
-assert.ok(b[0] >= 0);
-
-sys.puts("b[1] == " + b[1]);
-assert.ok(b[1] >= 0);
-
sys.puts("b.length == " + b.length);
assert.equal(1024, b.length);
+for (var i = 0; i < 1024; i++) {
+ assert.ok(b[i] >= 0);
+ b[i] = i % 256;
+}
+
+for (var i = 0; i < 1024; i++) {
+ assert.equal(i % 256, b[i]);
+}
+
for (var j = 0; j < 10000; j++) {
var asciiString = "hello world";