mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 07:25:51 +00:00
UT: Lots of improvements and fixes.
- Parse negative amounts. - Make Amount.negate() return a new value. - Add Amount.equals(). - Rename Remote.trace() to set_trace(). - Fix request_ripple_balnce. - Add more tests to send-test.js. - Add more tests to amount-test.js. - Add helper functions create_accounts and credit_limits to testutils.js.
This commit is contained in:
@@ -10,12 +10,29 @@ buster.testCase("Amount", {
|
||||
"Parse 0 export" : function () {
|
||||
buster.assert.equals(amount.consts.hex_xns, amount.UInt160.from_json("0").to_json());
|
||||
},
|
||||
"Parse native 123" : function () {
|
||||
buster.assert.equals("123/XNS", amount.Amount.from_json("123").to_text_full());
|
||||
},
|
||||
"Amount" : {
|
||||
"Parse native 0" : function () {
|
||||
buster.assert.equals("0/XNS", amount.Amount.from_json("0").to_text_full());
|
||||
},
|
||||
"Parse native 0.0" : function () {
|
||||
buster.assert.equals("0/XNS", amount.Amount.from_json("0.0").to_text_full());
|
||||
},
|
||||
"Parse native -0" : function () {
|
||||
buster.assert.equals("0/XNS", amount.Amount.from_json("-0").to_text_full());
|
||||
},
|
||||
"Parse native -0.0" : function () {
|
||||
buster.assert.equals("0/XNS", amount.Amount.from_json("-0.0").to_text_full());
|
||||
},
|
||||
"Parse native 1000" : function () {
|
||||
buster.assert.equals("1000/XNS", amount.Amount.from_json("1000").to_text_full());
|
||||
},
|
||||
"Parse native 12.3" : function () {
|
||||
buster.assert.equals("12300000/XNS", amount.Amount.from_json("12.3").to_text_full());
|
||||
},
|
||||
"Parse native -12.3" : function () {
|
||||
buster.assert.equals("-12300000/XNS", amount.Amount.from_json("-12.3").to_text_full());
|
||||
},
|
||||
"Parse 123./USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" : function () {
|
||||
buster.assert.equals("123/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", amount.Amount.from_json("123./USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh").to_text_full());
|
||||
},
|
||||
@@ -28,6 +45,12 @@ buster.testCase("Amount", {
|
||||
"Parse 1.2300/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" : function () {
|
||||
buster.assert.equals("1.23/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", amount.Amount.from_json("1.2300/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh").to_text_full());
|
||||
},
|
||||
"Parse -0/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" : function () {
|
||||
buster.assert.equals("0/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", amount.Amount.from_json("-0/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh").to_text_full());
|
||||
},
|
||||
"Parse -0.0/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" : function () {
|
||||
buster.assert.equals("0/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", amount.Amount.from_json("-0.0/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh").to_text_full());
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user