OpenZeppelin / chai-bn

Chai assertions for comparing arbitrary-precision integers using the bn.js library
MIT License
15 stars 21 forks source link

Testing arrays of big numbers #5

Open frangio opened 5 years ago

frangio commented 5 years ago

Chai's members can be used to test that an array contains certain values, as determined by strict equality or optionally deep equality.

Neither of those is appropriate to test arrays of big numbers (although deep equality works, it isn't ideal). We could maybe make the bignumber property modify members to compare values using bignumber equality?

On the other hand, this same issue shows up with many other Chai assertions, like oneOf...

nventuro commented 5 years ago

Hmm, this makes a lot of sense. It's also related to https://github.com/OpenZeppelin/openzeppelin-test-helpers/issues/1

Regarding oneOf and friends, just overriding members and making it clear in the documentation that it is the only overridden method seems fine to me.

EvolveArt commented 3 years ago

I feel like this issue hasn't been fixed yet.

Is there any workaround ?

frangio commented 2 years ago

The workaround is to do the appropriate array operation manually instead of using Chai's helpers.

bet8888 commented 2 years ago

It would be better if there was this feature. Hope to add this feature.