wishthis/node_modules/buffer-equal/test/eq.js

38 lines
648 B
JavaScript
Raw Normal View History

2022-11-30 12:56:09 +00:00
'use strict';
2022-01-21 08:28:41 +00:00
var bufferEqual = require('../');
2022-11-30 12:56:09 +00:00
var test = require('tape');
2022-01-21 08:28:41 +00:00
test('equal', function (t) {
2022-11-30 12:56:09 +00:00
var eq = bufferEqual(
new Buffer([253, 254, 255]),
new Buffer([253, 254, 255])
);
t.strictEqual(eq, true);
t.end();
2022-01-21 08:28:41 +00:00
});
test('not equal', function (t) {
2022-11-30 12:56:09 +00:00
var eq = bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
);
t.strictEqual(eq, false);
t.end();
2022-01-21 08:28:41 +00:00
});
test('not equal not buffer', function (t) {
2022-11-30 12:56:09 +00:00
var eq = bufferEqual(
new Buffer('abc'),
'abc'
);
t.strictEqual(eq, undefined);
t.end();
2022-01-21 08:28:41 +00:00
});
test('equal not buffer', function (t) {
2022-11-30 12:56:09 +00:00
var eq = bufferEqual('abc', 'abc');
t.strictEqual(eq, undefined);
t.end();
2022-01-21 08:28:41 +00:00
});