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

Test cases for utils.toTwosComplement #1076

Merged
merged 3 commits into from Sep 26, 2017
Merged

Conversation

danieljbruce
Copy link
Contributor

These are some test cases I created for the function toTwosComplement from web3.utils that didn't have any testing for this function. Next I plan on tackling something more closely related to a current codebase issue for which this is a precursor.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 90.557% when pulling e7721ff on danieljbruce:develop into 917d152 on ethereum:develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 90.557% when pulling e7721ff on danieljbruce:develop into 917d152 on ethereum:develop.

@frozeman frozeman merged commit 944904d into web3:develop Sep 26, 2017
@frozeman
Copy link
Contributor

Thanks for that, i will add those as well for the 1.0 branch

@frozeman
Copy link
Contributor

I 1.0 it will work as follows:

    web3.utils.toTwosComplement('-1');
    > "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

    web3.utils.toTwosComplement(-1);
    > "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

    web3.utils.toTwosComplement('0x1');
    > "0x0000000000000000000000000000000000000000000000000000000000000001"

    web3.utils.toTwosComplement(-15);
    > "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1"

    web3.utils.toTwosComplement('-0x1');
    > "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

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

Successfully merging this pull request may close these issues.

None yet

3 participants