mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 06:48:16 +00:00
tests: fix endiannes in test_apps.ethereum.layout
This commit is contained in:
parent
1530afe4ad
commit
0a9d42981d
@ -5,24 +5,24 @@ from apps.ethereum.layout import format_amount
|
|||||||
class TestEthereumLayout(unittest.TestCase):
|
class TestEthereumLayout(unittest.TestCase):
|
||||||
|
|
||||||
def test_format(self):
|
def test_format(self):
|
||||||
text = format_amount((1).to_bytes(5, 'little'), None, 1)
|
text = format_amount((1).to_bytes(5, 'big'), None, 1)
|
||||||
self.assertEqual(text, '1 Wei')
|
self.assertEqual(text, '1 Wei')
|
||||||
text = format_amount((1000).to_bytes(5, 'little'), None, 1)
|
text = format_amount((1000).to_bytes(5, 'big'), None, 1)
|
||||||
self.assertEqual(text, '1000 Wei')
|
self.assertEqual(text, '1000 Wei')
|
||||||
|
|
||||||
text = format_amount((1000000000000000001).to_bytes(20, 'little'), None, 1)
|
text = format_amount((1000000000000000001).to_bytes(20, 'big'), None, 1)
|
||||||
self.assertEqual(text, '1 ETH')
|
self.assertEqual(text, '1 ETH')
|
||||||
text = format_amount((10000000000000000001).to_bytes(20, 'little'), None, 1)
|
text = format_amount((10000000000000000001).to_bytes(20, 'big'), None, 1)
|
||||||
self.assertEqual(text, '10 ETH')
|
self.assertEqual(text, '10 ETH')
|
||||||
text = format_amount((10000000000000000001).to_bytes(20, 'little'), None, 61)
|
text = format_amount((10000000000000000001).to_bytes(20, 'big'), None, 61)
|
||||||
self.assertEqual(text, '10 ETC')
|
self.assertEqual(text, '10 ETC')
|
||||||
text = format_amount((1000000000000000001).to_bytes(20, 'little'), None, 31)
|
text = format_amount((1000000000000000001).to_bytes(20, 'big'), None, 31)
|
||||||
self.assertEqual(text, '1 tRSK')
|
self.assertEqual(text, '1 tRSK')
|
||||||
|
|
||||||
# unknown chain
|
# unknown chain
|
||||||
text = format_amount((1).to_bytes(20, 'little'), None, 9999)
|
text = format_amount((1).to_bytes(20, 'big'), None, 9999)
|
||||||
self.assertEqual(text, '1 Wei')
|
self.assertEqual(text, '1 Wei')
|
||||||
text = format_amount((10000000000000000001).to_bytes(20, 'little'), None, 9999)
|
text = format_amount((10000000000000000001).to_bytes(20, 'big'), None, 9999)
|
||||||
self.assertEqual(text, '10 UNKN')
|
self.assertEqual(text, '10 UNKN')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user