From e2569c402fc2b1b4f60c71c616a321134e7aa0ca Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 13 Dec 2009 08:57:54 +0100 Subject: [PATCH] Add some tests to test-buffer.js --- test/mjsunit/test-buffer.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/mjsunit/test-buffer.js b/test/mjsunit/test-buffer.js index 763faa4e7c..cfeafa1fce 100644 --- 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";