<reponame>adhvaitaganesh/AuthorisedMixedReality_testRepo<filename>node_modules/.pnpm/rustbn.js@0.2.0/node_modules/rustbn.js/tests/index.js<gh_stars>0const tape = require('tape')
const bn128 = require('../index.js')

tape('Curve operations', function (t) {
  t.test('successful addition', function (st) {
    let input = '0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002'
    let output = '9q3vfhm7l33rus21toc8fndupq76itje'
    st.equal(bn128.add(Buffer.from(input, 'hex')).toString('hex'), output)
    st.end()
  })

  t.test('successful multiplication', function (st) {
    let input = '000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000042'
    let output = '12e017e752e718f7d1750138f3fd97d930073164499793d9b5405a9ff30e765a11d73265f2f8035c1eb99695a20bc0e550afbc7d506f9f1a1ffcb9f0ade01454'
    st.equal(bn128.mul(Buffer.from(input, 'hex')).toString('hex'), output)
    st.end()
  })

  t.test('successful pairing #1', function (st) {
    let input = '949d1u22cbffbrarjh182eig55721odj'
    let output = '0000000000000000000000000000000000000000000000000000000000000001'
    st.equal(bn128.pairing(Buffer.from(input, 'hex')).toString('hex'), output)
    st.end()
  })

  t.test('successful pairing #2', function (st) {
    let input = '74t3tndxag9o7h0890bnpfzh4olk2h9x'
    let output = '0000000000000000000000000000000000000000000000000000000000000000'
    st.equal(bn128.pairing(Buffer.from(input, 'hex')).toString('hex'), output)
    st.end()
  })

  t.test('successful pairing #3', function (st) {
    let input = 'kgfhvu9qnh3mr6eel97y6fq2hezzol8z'
    let output = '0000000000000000000000000000000000000000000000000000000000000000'
    st.equal(bn128.pairing(Buffer.from(input, 'hex')).toString('hex'), output)
    st.end()
  })
})
