Front end of the Slack clone application.

index.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* global describe, it */
  2. var assert = require('assert')
  3. var xor = require('../')
  4. var xorInplace = require('../inplace')
  5. var fixtures = require('./fixtures')
  6. describe('xor', function () {
  7. fixtures.forEach(function (f) {
  8. it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {
  9. var a = new Buffer(f.a, 'hex')
  10. var b = new Buffer(f.b, 'hex')
  11. var actual = xor(a, b)
  12. assert.equal(actual.toString('hex'), f.expected)
  13. // a/b unchanged
  14. assert.equal(a.toString('hex'), f.a)
  15. assert.equal(b.toString('hex'), f.b)
  16. })
  17. })
  18. })
  19. describe('xor/inplace', function () {
  20. fixtures.forEach(function (f) {
  21. it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {
  22. var a = new Buffer(f.a, 'hex')
  23. var b = new Buffer(f.b, 'hex')
  24. var actual = xorInplace(a, b)
  25. assert.equal(actual.toString('hex'), f.expected)
  26. // a mutated, b unchanged
  27. assert.equal(a.toString('hex'), f.mutated || f.expected)
  28. assert.equal(b.toString('hex'), f.b)
  29. })
  30. })
  31. })