mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-08-23 00:20:52 +00:00
Refactored UInt and Derived Classes (#83)
Refactored UInt and Derived classes to be constructed from Buffers, and swapped out BN.js in favor of BigInt to reduce dependencies.
This commit is contained in:
@@ -128,12 +128,12 @@ function transactionParsingTests () {
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.Flags)
|
||||
expect(value.val).toEqual(0)
|
||||
expect(value.valueOf()).toEqual(0)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
expect(field).toEqual(Field.Sequence)
|
||||
expect(value.val).toEqual(103929)
|
||||
expect(value.valueOf()).toEqual(103929)
|
||||
}
|
||||
{
|
||||
const [field, value] = readField()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable func-style */
|
||||
|
||||
const { BN } = require('bn.js')
|
||||
const { binary } = require('../dist/coretypes')
|
||||
const { encode } = require('../dist')
|
||||
const { makeParser, BytesList, BinarySerializer } = binary
|
||||
@@ -110,7 +109,7 @@ check(UInt64, 0xFEFFFFFF, [0, 0, 0, 0, 254, 255, 255, 255])
|
||||
check(UInt64, -1, 'throws')
|
||||
check(UInt64, 0, [0, 0, 0, 0, 0, 0, 0, 0])
|
||||
check(UInt64, 1, [0, 0, 0, 0, 0, 0, 0, 1])
|
||||
check(UInt64, new BN(1), [0, 0, 0, 0, 0, 0, 0, 1])
|
||||
check(UInt64, BigInt(1), [0, 0, 0, 0, 0, 0, 0, 1])
|
||||
|
||||
// function parseLedger4320278() {
|
||||
// test('can parse object', done => {
|
||||
|
||||
@@ -2,7 +2,7 @@ const { coreTypes } = require('../dist/types')
|
||||
const { UInt8, UInt64 } = coreTypes
|
||||
|
||||
test('compareToTests', () => {
|
||||
expect(UInt8.from(124).compareTo(UInt64.from(124))).toBe(-0)
|
||||
expect(UInt8.from(124).compareTo(UInt64.from(124))).toBe(0)
|
||||
})
|
||||
|
||||
test('compareToTest', () => {
|
||||
|
||||
Reference in New Issue
Block a user