Commit Graph

69 Commits

Author SHA1 Message Date
Chris Clark
ea24bf0415 Fix lint errors 2015-05-15 16:45:24 -07:00
Chris Clark
398f8d001f Set up babel transpiler 2015-05-14 16:07:47 -07:00
Chris Clark
0c000a7fee Fix lint errors in amount-test.js 2015-04-30 18:31:59 -07:00
Chris Clark
c655c2a20e Remove config singleton (global state) 2015-04-30 18:30:53 -07:00
Chris Clark
bfbfcc2894 Fix lint errors in amount-test.js 2015-03-25 11:28:13 -07:00
Chris Clark
6abfa759aa [FIX] Make Amount.to_human return correct results for very small numbers 2015-03-25 11:19:25 -07:00
Chris Clark
e80cd1ff55 [TASK] Disable parsing native amounts in foating point format 2015-02-17 14:03:23 -08:00
Chris Clark
d0fb291c4e Cleanup amount.js 2015-02-04 13:57:57 -08:00
Chris Clark
c8f18c8c85 [FIX] Handle invalid input in parse_human 2015-02-03 18:06:15 -08:00
Chris Clark
d025b4a0c3 [TASK] Refactor to use bignumber.js 2015-01-27 10:23:33 -08:00
wltsmrz
6cd79e7237 Use TAP reporter 2015-01-14 15:21:48 -08:00
Chris Clark
66c2e27711 [TASK] Refactor tests to support testing compiled javascript 2014-12-19 13:17:02 -08:00
wltsmrz
e371cc2c3c Fix to_human precision rounding 2014-11-26 11:32:15 -08:00
Geert Weening
f05941fbc4 [FIX] cap IOU Amounts to their max and min value
respect rippled's limits
2014-11-05 16:04:02 -08:00
Geert Weening
7708c64576 [FIX] confusion between precision and min_precision
`precision` expresses precision within the provided value and won't expand it if the max expression of the value is smaller
`min_precision` will expand the value if the max expression of the value is smaller
2014-10-23 17:59:53 -07:00
Geert Weening
4be209e286 [FIX] amount precision bugs
- leading 0's for fraction part disappearing
- first decimal lower than 5 wouldn't result in dropping the decimal
2014-10-21 13:22:42 -07:00
Geert Weening
033257b03b [FIX] Amount.to_human() precision slicing instead of rounding 2014-10-16 13:54:42 -07:00
wltsmrz
8ef7481858 Allow mixed letters and numbers in currencies 2014-09-17 13:39:49 -07:00
Edward Hennis
02b5d14d0f [BUG] Fix Amount.to_human_full()
* Amount.is_native is a function, but was referenced as a bool.
* Duplicate to_text_full tests to test to_human_full.
2014-09-12 10:52:46 -04:00
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