mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
# Conflicts: # jsowell-ui/.env.development # jsowell-ui/.env.staging # jsowell-ui/bin/build-sit.bat # jsowell-ui/bin/build.bat # jsowell-ui/src/api/adapayMember/adapayMember.js # jsowell-ui/src/api/pile/merchant.js # jsowell-ui/src/router/index.js # jsowell-ui/src/views/financial/financeDetail.vue # jsowell-ui/src/views/financial/merchant.vue # jsowell-ui/src/views/homeIndex/homeIndex.vue # jsowell-ui/src/views/login.vue # jsowell-ui/src/views/pile/basic/detail.vue # jsowell-ui/src/views/pile/station/components/SiteInfo.vue # jsowell-ui/src/views/pile/station/detail.vue # jsowell-ui/src/views/pile/station/orderReport.vue
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
/* 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)
|
|
})
|
|
})
|
|
})
|