Sha256: 1cf764d76eb44d8c41e29eaa90d5a9fb3562bf71f46bbc2849bdfe50c1a07b70

Contents?: true

Size: 1.02 KB

Versions: 43

Compression:

Stored size: 1.02 KB

Contents

/* global describe, it */

var assert = require('assert')
var xor = require('../')
var xorInplace = require('../inplace')
var fixtures = require('./fixtures')

describe('xor', function () {
  fixtures.forEach(function (f) {
    it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {
      var a = new Buffer(f.a, 'hex')
      var b = new Buffer(f.b, 'hex')
      var actual = xor(a, b)

      assert.equal(actual.toString('hex'), f.expected)

      // a/b unchanged
      assert.equal(a.toString('hex'), f.a)
      assert.equal(b.toString('hex'), f.b)
    })
  })
})

describe('xor/inplace', function () {
  fixtures.forEach(function (f) {
    it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {
      var a = new Buffer(f.a, 'hex')
      var b = new Buffer(f.b, 'hex')
      var actual = xorInplace(a, b)

      assert.equal(actual.toString('hex'), f.expected)

      // a mutated, b unchanged
      assert.equal(a.toString('hex'), f.mutated || f.expected)
      assert.equal(b.toString('hex'), f.b)
    })
  })
})

Version data entries

43 entries across 42 versions & 15 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.18.0 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.18.2 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.16.1 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.15.2 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.18.4 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.18.1 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.14.0 test/dummy/node_modules/buffer-xor/test/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/buffer-xor/test/index.js
tang-0.2.1 spec/tang_app/node_modules/buffer-xor/test/index.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/buffer-xor/test/index.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/buffer-xor/test/index.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/buffer-xor/test/index.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/buffer-xor/test/index.js
tang-0.2.0 spec/tang_app/node_modules/buffer-xor/test/index.js
tang-0.1.0 spec/tang_app/node_modules/buffer-xor/test/index.js
tang-0.0.9 spec/tang_app/node_modules/buffer-xor/test/index.js
enju_library-0.3.8 spec/dummy/node_modules/buffer-xor/test/index.js
ilog-0.4.1 node_modules/buffer-xor/test/index.js