[FEATURE] support numeric currency codes

ISO 4217 states support for both alphabetic and numeric codes. rippled adheres to the ISO 4217 as stated in the Currency_Format on the wiki (https://ripple.com/wiki/Currency_Format) and there are trustlines out there with numeric currency codes.

The three-digit numeric code is useful when currency codes need to be understood in countries that do not use Latin scripts and for computerised systems. Where possible the 3 digit numeric code is the same as the numeric country code.
This commit is contained in:
Geert Weening
2014-06-02 17:14:22 -07:00
parent cf53ec9da8
commit 61586a4185
4 changed files with 20 additions and 4 deletions

View File

@@ -27,6 +27,16 @@ describe('Currency', function() {
assert(r.is_native());
assert.strictEqual('XRP', r.to_json());
});
it('from_json("111").to_human()', function() {
var r = currency.from_json("111");
assert(r.is_valid());
assert.strictEqual('111', r.to_json());
});
it('from_json("1D2").to_human()', function() {
var r = currency.from_json("1D2");
assert(!r.is_valid());
assert.strictEqual('XRP', r.to_json());
});
});
describe('from_human', function() {