eq.js 714 B

1234567891011121314151617181920212223242526272829303132333435
  1. var bufferEqual = require('../');
  2. var test = require('tap').test;
  3. test('equal', function (t) {
  4. var eq = bufferEqual(
  5. new Buffer([253,254,255]),
  6. new Buffer([253,254,255])
  7. );
  8. t.strictEqual(eq, true);
  9. t.end();
  10. });
  11. test('not equal', function (t) {
  12. var eq = bufferEqual(
  13. new Buffer('abc'),
  14. new Buffer('abcd')
  15. );
  16. t.strictEqual(eq, false);
  17. t.end();
  18. });
  19. test('not equal not buffer', function (t) {
  20. var eq = bufferEqual(
  21. new Buffer('abc'),
  22. 'abc'
  23. );
  24. t.strictEqual(eq, undefined);
  25. t.end();
  26. });
  27. test('equal not buffer', function (t) {
  28. var eq = bufferEqual('abc', 'abc');
  29. t.strictEqual(eq, undefined);
  30. t.end();
  31. });