COVERAGE=opt/bin/coverage
DOCTEST=(
    pvl/dhcp/config.py
    pvl/dns/serial.py
    pvl/dns/labels.py
    pvl/dns/reverse.py
    pvl/dns/generate.py
    pvl/hosts/host.py
)

UNITTEST=(
    pvl.dhcp.tests
    pvl.dns.tests
    pvl.hosts.tests
)

coverage() {
    echo "$ $FUNCNAME $@" >&2

    $COVERAGE "$@"
}

coverage erase

for import in ${UNITTEST[@]}; do
    coverage run -a -m unittest $import
done

for py in ${DOCTEST[@]}; do
    coverage run -a -m doctest $py
done

coverage html \
    --include=pvl/dhcp/*.py,pvl/dns/*.py,pvl/hosts/*.py
