Commit Graph

50 Commits

Author SHA1 Message Date
Geert Weening
5db493df1c [TEST] add test cases for calculating interest 2014-07-31 17:28:53 -07:00
Geert Weening
b4497bcb08 [FIX] amount human parsing for hex with amount
There were cases where the currency and integer were incorrectly matched. By separating out the regex for hex formatted Amount makes it easier to deal with these cases and fixes the issue.
2014-07-09 11:59:37 -07:00
Geert Weening
e0bcf19340 [FIX] value parsing for amount/currency order pairs
e.g. `100000 USD` and `USD 100000` should have the same result
2014-06-24 10:48:12 -07:00
Geert Weening
9527d6ed22 [TEST] add test for demurred currency Amount parsing 2014-06-23 14:04:52 -07:00
Geert Weening
49d50c02d4 [FIX] decimal precision amount parsing
- add non-grouping operator to regex
- add tests to cover the problematic cases
2014-06-05 14:14:50 -07:00
Geert Weening
61586a4185 [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.
2014-06-02 17:14:22 -07:00
Geert Weening
2a832777a7 [TEST] add more from_number tests 2014-05-30 15:10:07 -07:00
Geert Weening
1ce2a517aa [TEST] update amount test for interest bearing currencies 2014-05-30 15:10:07 -07:00
Stefan Thomas
716fd0b938 [CHORE] Improved Amount#parse_quality w/ demurrage support, drops->XRP, etc.
Amount#parse_quality is made currency-aware. This allows it to adjust for XRP as
the base currency, as well as for interest-bearing or demurring base currencies.
2014-03-22 02:38:03 -07:00
Stefan Thomas
893fc4c168 [CHORE] Add Amount#invert mathematical utility function. 2014-03-22 00:47:41 -07:00
Stefan Thomas
c808cb0a1c [CHORE] Add ability to apply demurrage at the time of product/ratio calculation. 2014-03-21 18:43:22 -07:00
Stefan Thomas
05f3a97042 UInt160 can be an account or a plain hash.
The UInt160 class used to be hardcoded to be an Account. This commit changes it
so it can be used as an account or a plain hash. It will try to automatically
self-classify based on how it is initialized.

In the future we may want to have some dedicated classes rather than a
single configurable UInt160.
2013-11-12 15:51:50 -08:00
Stefan Thomas
6194d9bcd9 Left a console statement. Oops. 2013-09-21 05:50:28 -07:00
Stefan Thomas
64df821b38 JSBN and coverage tests cleanup.
Fixes compiler warning about SJCL.
Fixes coverage source highlighting issue.
Move JSBN outside of src/js/jsbn/.
2013-09-21 05:41:19 -07:00
wltsmrz
8dd1b62d78 Improve test coverage 2013-09-12 14:15:44 -07:00
wltsmrz
bba2e10e94 Test coverage 2013-09-11 14:22:47 -07:00
wltsmrz
6f9c103d78 Update tests for future test coverage 2013-09-10 15:48:57 -07:00
wltsmrz
bf95285d90 Use assert.deepEqual, fix serializedtypes 2013-09-08 18:07:55 -07:00
wltsmrz
25401bd08d Update ripple-lib tests to use mocha 2013-09-08 17:33:08 -07:00
wltsmrz
45a3ac3f66 Fallback to config-example for tests 2013-06-11 08:27:31 +09:00
Arthur Britto
b0c8d67d27 Fixed adding negative to zero. Fixes #6. 2013-05-30 23:59:58 -07:00
Stefan Thomas
22a954deed Changed directory structure to be more like server's. src/js/*.js -> src/js/ripple/ 2013-05-06 21:32:25 +02:00
Arthur Britto
d37f0b9082 Fix currency from integer. 2013-04-26 15:38:04 -07:00
Arthur Britto
1ed5d6b3e5 JS: Fixes and improvements for Amount.
- Add from_quality()
- Add parse_quality()
- Improve add.
- Better peformance for copyTo().
- Fix parse_issuer(), set_issuer(), & set_currency() not to modify sub
  object.
- Correctly set currency and issuer of XRP in parse_json().
- Make not_equals_why more explicit.
2013-04-26 09:01:44 +02:00
Arthur Britto
f5047521ce JS: Rename ADDRESS_ to ACCOUNT_ to be consistent with C++. 2013-04-26 09:00:22 +02:00
Stefan Thomas
4eb29890c0 JS: More tests for equals. 2013-04-26 09:00:21 +02:00
Stefan Thomas
0a13875c53 JS: More tests for Amount#equals and Amount#not_equals_why. 2013-04-26 09:00:21 +02:00
Stefan Thomas
d394b074db JS: Failing test. Amount#equals does not compare exponent. 2013-04-26 09:00:21 +02:00
Stefan Thomas
49af9f20d9 JS: Added ripple.config.load convenience function. 2013-04-26 08:59:49 +02:00
Stefan Thomas
6f34cfa369 Refactor JavaScript library.
- Separate classes in separate modules (files)
- Constants should be associated with a class
- Replace exports.config scheme with a config singleton
- Refactor base58 functions as a static class
2013-04-26 08:59:48 +02:00
Arthur Britto
e5c6acde7d JS: Restrict UInt160 parse_json to wire format. 2013-04-26 08:59:47 +02:00
Stefan Thomas
aff2b5583e Fix infinite loop when using a zero amount in a multiplication. 2013-04-26 08:59:47 +02:00
Stefan Thomas
ef23babf8b Add tests for Amount#multiply. 2013-04-26 08:59:47 +02:00
Stefan Thomas
eefaea7a74 Added some test cases for Amount.add(). 2013-04-26 08:59:46 +02:00
Stefan Thomas
d8076d5f9b Add support for mixed operands to divide(). 2013-04-26 08:59:46 +02:00
Arthur Britto
184c059354 JS & UT: add et to vim setting. 2013-04-26 08:59:45 +02:00
Arthur Britto
e40d8b7b6f JS: Fix and another unit-test. 2013-04-26 08:59:44 +02:00
Arthur Britto
135fe39db4 Add UInt160.is_valid(), Amount.is_valid(), Currency.is_valid(), & Currency.is_valid_full(). 2013-04-26 08:59:44 +02:00
Arthur Britto
19ec41e7bd JS and UT: XNS -> XRP 2013-04-26 08:59:00 +02:00
Arthur Britto
9b01b0a60a Rework config.js to not be add to web pack. 2013-04-26 08:59:00 +02:00
Stefan Thomas
bd781bcf3f Moved cpp code to src/cpp and js code to src/js. 2013-04-26 08:59:00 +02:00
Arthur Britto
209b70db77 JS: Hide some variables. 2013-04-26 08:59:00 +02:00
Arthur Britto
4917a01c69 UT: Add another Amount test. 2013-04-26 08:58:59 +02:00
Arthur Britto
45c54b6484 JS: Fix UInt160 comparison. 2013-04-26 08:58:59 +02:00
Arthur Britto
c0eec780de JS: Add support for parsing and encoding base58. 2013-04-26 08:58:59 +02:00
Arthur Britto
02805651cf JS: More fixes and tests for Amount.negate(). 2013-04-26 08:58:58 +02:00
Arthur Britto
1aac962116 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.
2013-04-26 08:58:58 +02:00
Arthur Britto
15f3c5d311 UT: Adjust to new address encoding. 2013-04-26 08:58:58 +02:00
Arthur Britto
38ee4bf3c4 JS: fixes and tests from amounts. 2013-04-26 08:58:57 +02:00
Arthur Britto
566833f702 UT: Initial check in unit tests for amount.js. 2013-04-26 08:58:57 +02:00