mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-05 03:35:51 +00:00
* Retrieve and process summary or full ledgers. * Search using arbitrary criteria (any Python function). * Search using arbitrary formats (any Python function). * Caches ledgers as .gz files to avoid repeated server requests. * Handles ledger numbers, ranges, and special names like validated or closed.
21 lines
679 B
Python
21 lines
679 B
Python
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
from ripple.util.Decimal import Decimal
|
|
|
|
from unittest import TestCase
|
|
|
|
class test_Decimal(TestCase):
|
|
def test_construct(self):
|
|
self.assertEquals(str(Decimal('')), '0')
|
|
self.assertEquals(str(Decimal('0')), '0')
|
|
self.assertEquals(str(Decimal('0.2')), '0.2')
|
|
self.assertEquals(str(Decimal('-0.2')), '-0.2')
|
|
self.assertEquals(str(Decimal('3.1416')), '3.1416')
|
|
|
|
def test_accumulate(self):
|
|
d = Decimal()
|
|
d.accumulate('0.5')
|
|
d.accumulate('3.1416')
|
|
d.accumulate('-23.34234')
|
|
self.assertEquals(str(d), '-19.70074')
|