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

how to contribute #56

Open
mkinney opened this issue Sep 2, 2018 · 0 comments
Open

how to contribute #56

mkinney opened this issue Sep 2, 2018 · 0 comments

Comments

@mkinney
Copy link

mkinney commented Sep 2, 2018

How can I contribute?

For instance, I would like to add this to the networking page (number of addresses in subnet):

def number_addresses_from_cidr(cidr):
    n = 0
    if cidr > 0 and cidr < 33:
        n = 2**(32 - cidr)
    return n

I don't see any unit tests. It might look something like this:

def test_number_of_addresses_from_cidr():
    assert number_addresses_from_cidr(1) == 2147483648 # 2^31
    assert number_addresses_from_cidr(2) == 1073741824 # 2^30
    assert number_addresses_from_cidr(29) == 8 # 2^3
    assert number_addresses_from_cidr(30) == 4 # 2^2
    assert number_addresses_from_cidr(31) == 2 # 2^1
    assert number_addresses_from_cidr(32) == 1 # 2^0
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