<?xml version="1.0" encoding="UTF-8"?>
<post>
  <body>Only a short update to the "chain":http://jeff.dallien.net/posts/a-chain-of-my-own-and-making-progress tonight because its getting late.

Before starting on the Prolog code for the prologblog.com site, I wanted to see if anyone in the Prolog community had documented how to do Test Driven Development (TDD) or Behavior Driven Development (BDD) in Prolog. I couldn't even find some discussion on the subject let alone a how-to or tool set. For now, I will be on my own and figuring it out as I go.

The testing framework included with SWI-Prolog is called "PlUnit":http://www.swi-prolog.org/pldoc/package/plunit.html. The Ubuntu SWI packages caused me to waste some more time today, as they don't seem to include PlUnit, despite it being a package normally distributed with SWI. To use it, I had to get the current version directly from the SWI git respository. I kept the Ubuntu package-installed version of SWI and was able to manually install PlUnit next to it. Here are the steps for doing that.

h4. Clone the SWI-Prolog git repository

&lt;pre style="font-size: medium"&gt;
git clone git://prolog.cs.vu.nl/home/pl/git/pl.git
&lt;/pre&gt;

h4. Configure and install PlUnit

&lt;pre style="font-size: medium"&gt;
cd pl/packages/plunit
autoconf
./configure
sudo make install
&lt;/pre&gt;

Note that there is no actual 'make' step. There is nothing to build, the files just need to be copied into the correct location.

h4. Check installation

To check that it was installed properly, one can run the files from the PlUnit examples directory.

&lt;pre style="font-size: medium"&gt;
cd pl/packages/plunit/examples/ # in the cloned git repo
swipl -g "[simple],run_tests,halt."
 % simple compiled into ex_simple 0.01 sec, 108,664 bytes
 % PL-Unit: lists ........ done
 % All 8 tests passed
&lt;/pre&gt;
</body>
  <created-at type="datetime">2009-03-14T03:40:00-04:00</created-at>
  <id type="integer">37</id>
  <published type="boolean">true</published>
  <title>Installing PlUnit on Ubuntu</title>
  <updated-at type="datetime">2009-03-14T05:46:09-04:00</updated-at>
  <url-title>installing-plunit-on-ubuntu</url-title>
</post>
