Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigNumber support #124

Open
miohtama opened this issue Mar 5, 2020 · 0 comments
Open

BigNumber support #124

miohtama opened this issue Mar 5, 2020 · 0 comments

Comments

@miohtama
Copy link

miohtama commented Mar 5, 2020

What would be tests needed to support BigNumber comparison in power-assert? BigNumber is userful in cryptography, finance and blockchain.

Currently comparing BigNumbers works if you stringify them first

assert(supply.toString() == TOKEN_1ST_TOTAL_SUPPLY.toString());

But this comparison of BigNumber objects fails

assert(supply == TOKEN_1ST_TOTAL_SUPPLY);

Output:


      AssertionError [ERR_ASSERTION]:   # Token.spec.ts:11
  
  assert(supply == TOKEN_1ST_TOTAL_SUPPLY)
         |      |  |                      
         |      |  BN{negative:0,words:#Array#,length:4,red:null}
         |      false                     
         BN{negative:0,words:#Array#,length:4,red:null}
  
  [BN] TOKEN_1ST_TOTAL_SUPPLY
  => BN{negative:0,words:#Array#,length:4,red:null}
  [BN] supply
  => BN{negative:0,words:#Array#,length:4,red:null}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant