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

Create automated tests using BATS #16

Merged
merged 7 commits into from
Apr 19, 2017

Conversation

phil-davis
Copy link
Contributor

This uses the Bash Automated Testing System at https://github.com/sstephenson/bats as a framework for testing this command line utility.

As a start, I have made:
a) command_params.bats - basic tests to see that each generic command option ( -h, -v etc) works
b) display_ipv4.bats - at first 3 tests to check the output for the 3 old-fashioned "classes" of IPv4 private space at their most basic, using CIDRs that match the "classes". When I made these, I found a little bug in the RFC reference number (see misc.c - the fix is required so that the tests will pass)
c) validate_address_ipv4.bats - check a lot of variations of things that are, or look a bit like, IPv4 addresses.
d) validate_address_ipv6.bats - check a lot of variations of things that are, or look a bit like, IPv6 addresses.

Since I have managed to find a first bug while writing tests, I will submit this PR for your consideration.

@phil-davis
Copy link
Contributor Author

I started doing this because I am doing a SW Engineering course and wanted to make a demonstration of how test driven development (TDD) is useful in applications that are not OO.
Since I have a background in networks, routing, firewalls... this seemed a nice little utility where I already know and understand what the outputs should be like, and it can easily be tested using this BATS framework.
I am happy to add more tests, if you are happy with the using the BATS framework.

@troglobit
Copy link
Owner

Great work!

You're more than welcome to add more tests 😃 👍

@troglobit troglobit merged commit 9a6ee4f into troglobit:master Apr 19, 2017
@phil-davis phil-davis deleted the bats-tests1 branch April 19, 2017 15:51
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

2 participants