|
@@ -277,13 +277,31 @@ tests = {
|
|
|
( ['111111115Q','pad=2'], 'ff' ),
|
|
|
],
|
|
|
'bytespec': [
|
|
|
- ( ['1G'], str(1024*1024*1024) ),
|
|
|
- ( ['1234G'], str(1234*1024*1024*1024) ),
|
|
|
- ( ['1GB'], str(1000*1000*1000) ),
|
|
|
- ( ['1234GB'], str(1234*1000*1000*1000) ),
|
|
|
- ( ['1.234MB'], str(1234*1000) ),
|
|
|
+ ( ['1G'], str(1024*1024*1024) ),
|
|
|
+ ( ['1GB'], str(1000*1000*1000) ),
|
|
|
+ ( ['1234GB'], str(1234*1000*1000*1000) ),
|
|
|
+ ( ['1234G'], str(1234*1024*1024*1024) ),
|
|
|
+ ( ['1234TB'], str(1234*1000*1000*1000*1000) ),
|
|
|
+ ( ['1234T'], str(1234*1024*1024*1024*1024) ),
|
|
|
+ ( ['1234PB'], str(1234*1000*1000*1000*1000*1000) ),
|
|
|
+ ( ['1234P'], str(1234*1024*1024*1024*1024*1024) ),
|
|
|
+ ( ['1234EB'], str(1234*1000*1000*1000*1000*1000*1000) ),
|
|
|
+ ( ['1234E'], str(1234*1024*1024*1024*1024*1024*1024) ),
|
|
|
+ ( ['1.234MB'], str(1234*1000) ),
|
|
|
( ['1.234567M'], str(int(Decimal('1.234567')*1024*1024)) ),
|
|
|
- ( ['1234'], str(1234) ),
|
|
|
+ ( ['1234'], str(1234) ),
|
|
|
+ ],
|
|
|
+ 'to_bytespec': [
|
|
|
+ ( [str(1024*1024*1024),'G'], '1.00G' ),
|
|
|
+ ( [str(1024*1024*1024),'G','fmt=0.0'], '1G' ),
|
|
|
+ ( [str(1024*1024*1024),'G','fmt=08.5'], '01.00000G' ),
|
|
|
+ ( [str(1234*1000*1000*1000),'GB'], '1234.00GB' ),
|
|
|
+ ( [str(1234*1024*1024*1024),'G'], '1234.00G', ),
|
|
|
+ ( [str(1000*1000*1000*1000*1000),'PB'], '1.00PB' ),
|
|
|
+ ( [str(1024*1024*1024*1024*1024),'P'], '1.00P' ),
|
|
|
+ ( [str(1024*1024*1024*1024*1024*1024),'E'], '1.00E' ),
|
|
|
+ ( [str(int(Decimal('1.234567')*1024*1024)),'M','fmt=0.6'], '1.234567M' ),
|
|
|
+ ( ['1234','c','fmt=0.0','print_sym=false'], '1234' ),
|
|
|
],
|
|
|
'hash160': [ # TODO: check that hextob58chk(hash160) = pubhex2addr
|
|
|
( ['deadbeef'], 'f04df4c4b30d2b7ac6e1ed2445aeb12a9cb4d2ec' ),
|