Created
October 11, 2010 17:55
-
-
Save ThisIsMissEm/620945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var common = require("../common"); | |
var assert = common.assert; | |
var b = require("buffer"); | |
var SlowBuffer = b.SlowBuffer; | |
var c = new Buffer(50); | |
for(var i=0;i<c.length; ++i){ | |
c[i] = 0x00; | |
assert.equal(c[i], 0x00); | |
} | |
c.write("\xFF", 25, "binary") | |
var s = new SlowBuffer(50); | |
for(var i=0;i<s.length; ++i){ | |
s[i] = 0x00; | |
assert.equal(s[i], 0x00); | |
} | |
s.write("\xFF", 25, "binary") | |
assert.equal(c.indexOf(0xff), 25); | |
assert.equal(c.indexOf(0xff, 25), 0); | |
assert.equal(c.indexOf(0xff, 25, 25), 0); | |
assert.equal(c.indexOf(0xff, 26), -1); | |
assert.throws(c.indexOf(0xff, 26, 25)); | |
assert.equal(s.indexOf(0xff), 25) | |
assert.equal(s.indexOf(0xff, 25), 0) | |
assert.equal(s.indexOf(0xff, 25, 25), 0) | |
assert.equal(s.indexOf(0xff, 26), -1) | |
assert.throws(s.indexOf(0xff, 26, 25)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment