moved equalBuffers to test-helper

This commit is contained in:
brianc 2010-10-08 23:15:47 -05:00
parent 2fc0d1124a
commit d0a98ce129
2 changed files with 15 additions and 15 deletions

View File

@ -11,6 +11,21 @@ assert.same = function(actual, expected) {
} }
}; };
assert.equalBuffers = function(actual, expected) {
if(actual.length != expected.length) {
console.log(actual);
console.log(expected);
assert.equal(actual.length, expected.length);
}
for(var i = 0; i < actual.length; i++) {
if(actual[i] != expected[i]) {
console.log(actual);
console.log(expected);
}
assert.equal(actual[i],expected[i]);
}
};
assert.empty = function(actual) { assert.empty = function(actual) {
assert.length(actual, 0); assert.length(actual, 0);
}; };

View File

@ -1,21 +1,6 @@
require(__dirname + "/test-helper"); require(__dirname + "/test-helper");
assert.equalBuffers = function(actual, expected) {
if(actual.length != expected.length) {
console.log(actual);
console.log(expected);
assert.equal(actual.length, expected.length);
}
for(var i = 0; i < actual.length; i++) {
if(actual[i] != expected[i]) {
console.log(actual);
console.log(expected);
}
assert.equal(actual[i],expected[i]);
}
}
BufferList.prototype.compare = function(expected) { BufferList.prototype.compare = function(expected) {
var buf = this.join(); var buf = this.join();
assert.equalBuffers(buf, expected); assert.equalBuffers(buf, expected);