2020-04-06 11:17:22 +00:00
|
|
|
'use strict'
|
2019-05-04 16:08:30 +00:00
|
|
|
|
2020-04-06 11:17:22 +00:00
|
|
|
// Every test file (you can create as many as you want) should start like this
|
|
|
|
// Please, do NOT touch. They will be automatically removed for browser tests -->
|
|
|
|
const _pkg = require('../lib/index.node')
|
|
|
|
const chai = require('chai')
|
|
|
|
// <--
|
2019-05-04 16:08:30 +00:00
|
|
|
|
|
|
|
const inputs = [
|
2020-04-06 11:17:22 +00:00
|
|
|
{
|
|
|
|
a: BigInt(1),
|
|
|
|
n: BigInt(19),
|
|
|
|
toZn: BigInt(1)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
a: BigInt(-25),
|
|
|
|
n: BigInt(9),
|
|
|
|
toZn: BigInt(2)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
a: BigInt('12359782465012847510249'),
|
|
|
|
n: BigInt(5),
|
|
|
|
toZn: BigInt(4)
|
|
|
|
}
|
|
|
|
]
|
2019-05-04 16:08:30 +00:00
|
|
|
|
|
|
|
describe('toZn', function () {
|
2020-04-06 11:17:22 +00:00
|
|
|
for (const input of inputs) {
|
|
|
|
describe(`toZn(${input.a}, ${input.n})`, function () {
|
|
|
|
it(`should return ${input.toZn}`, function () {
|
|
|
|
const ret = _pkg.toZn(input.a, input.n)
|
|
|
|
chai.expect(ret).to.equal(input.toZn)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|