A collection of etudes for folks new to Prolog (and sometimes experienced ones) to learn the
language in a practical fashion.
Assuming you've got all the necessary tools installed (see below), all you'd need to is
$ make test
...
% All 22 tests passed in 0.055 seconds (0.053 cpu)
To run the tests all you need to do is a recent SWI-Prolog and the latest bmakelib.
For example, on an openSUSE Tumbleweed machine:
# zypper refresh && zypper install swipl make
# rpm --install --nosignature https://github.com/bahmanm/bmakelib/releases/download/v0.7.0/bmakelib-0.7.0-1.1.noarch.rpm
I have used CircleCI as the CI service for this project.
You can view the configuration at .circleci/config.yml.
The highlights are:
- Line 8: uses the bmakelib Docker image from the bdockerimg project.
- Line 25: Install SWI-Prolog
- Line 31: Run the tests with the
test.produce-coverage-report=yes
option. This causes the Prolog report coverage files to be generated - more on this below.
I have opted to use Codecov as the code coverage service. The integration with Github is quite easy and takes only a few steps.
If you look at .circleci/config.yml file again:
- Line 48 and 56: install the Codecov CLI tool
- Line 66: uses codecov-cli to upload the coverage reports to Codecov.
However the problem is that none of the existing code coverage services, including Codecov, support the reports generated by Prolog.
To work around this, I wrote a small Perl program called coverage-report-converter to parse the Prolog report and convert it to the format which is used by Go.