Deep equality checks for arrays, objects, etc. containing big numbers#7
Deep equality checks for arrays, objects, etc. containing big numbers#7pf92 wants to merge 1 commit intoOpenZeppelin:masterfrom
Conversation
|
Hello @pf92, sorry for taking so long to review this! I was out of office, and the notification for this PR must've slipped under my radar. I did a cursory review and everything seems okay, but what would be really neat would be to address this in a way so that #5 would be fixed. Having The code shouldn't be too different from what you've already written, do you think you could explore taking that approach instead? Thanks! |
|
After thinking about this some, perhaps a full-fledged The issue with this is that we don't just test for A simpler implementation with a custom flag (e.g. |
This pull request enables deep equality checks for arrays, objects, etc. that contain big numbers.
E.g., now the following check works:
const array1 = [new BN(1), '2', new BN(-10)];
const array2 = [new BN(1), '2', '-10'];
expect(array1).to.have.a.bignumber.and.to.deep.equal(array2);
If bignumber and deep are present in the chain, the assertion will check whether actual deeply equals expected.