mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 23:15:52 +00:00
JS: Add support for parsing and encoding base58.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
var buster = require("buster");
|
||||
|
||||
var jsbn = require('../js/jsbn.js');
|
||||
var BigInteger = jsbn.BigInteger;
|
||||
var nbi = jsbn.nbi;
|
||||
|
||||
var amount = require("../js/amount.js");
|
||||
var Amount = require("../js/amount.js").Amount;
|
||||
var UInt160 = require("../js/amount.js").UInt160;
|
||||
@@ -7,10 +11,19 @@ var UInt160 = require("../js/amount.js").UInt160;
|
||||
buster.testCase("Amount", {
|
||||
"UInt160" : {
|
||||
"Parse 0" : function () {
|
||||
buster.assert.equals(0, UInt160.from_json("0").value);
|
||||
buster.assert.equals(nbi(), UInt160.from_json("0").value);
|
||||
},
|
||||
"Parse 0 export" : function () {
|
||||
buster.assert.equals(amount.consts.hex_xns, UInt160.from_json("0").to_json());
|
||||
buster.assert.equals(amount.consts.address_xns, UInt160.from_json("0").to_json());
|
||||
},
|
||||
"Parse 1" : function () {
|
||||
buster.assert.equals(new BigInteger([1]), UInt160.from_json("1").value);
|
||||
},
|
||||
"Parse rrrrrrrrrrrrrrrrrrrrrhoLvTp export" : function () {
|
||||
buster.assert.equals(amount.consts.address_xns, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrrhoLvTp").to_json());
|
||||
},
|
||||
"Parse rrrrrrrrrrrrrrrrrrrrBZbvji export" : function () {
|
||||
buster.assert.equals(amount.consts.address_one, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrBZbvji").to_json());
|
||||
},
|
||||
},
|
||||
"Amount parsing" : {
|
||||
|
||||
Reference in New Issue
Block a user