Skip to content

Commit

Permalink
Fix broken unittests of appveyor
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m3vilurr committed Jan 5, 2016
1 parent d5415f3 commit a1e8f66
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/struct.js
Expand Up @@ -380,22 +380,26 @@ describe('Struct', function () {
})

describe('usePack()', function () {
var size = {
unpack: { ia32: 8, x64: 16 },
pack: { ia32: 5, x64: 9}
}

it('can make no padding struct', function () {
var S = Struct({ a: 'int', p: ref.refType('void') }, true)
assert.equal(12, S.size);
var S = Struct({ a: 'char', p: ref.refType('void') }, true)
assert.equal(size.pack[process.arch], S.size)
})

it('should work to usePack(bool) and switch padding mode', function () {
var S = Struct({ a: 'int' , p: ref.refType('void') })
var S = Struct({ a: 'char' , p: ref.refType('void') })
// now has padding between d and p
assert.equal(16, S.size)
assert.equal(size.unpack[process.arch], S.size)
// to no padding mode
S.usePack(true)
assert.equal(12, S.size)
assert.equal(size.pack[process.arch], S.size)
// to padding mode
S.usePack(false)
assert.equal(16, S.size)
assert.equal(size.unpack[process.arch], S.size)
})

})
Expand Down

0 comments on commit a1e8f66

Please sign in to comment.