Re: plunit surprises (mostly good ones)
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 07/24/2013 09:47 AM, Ross Boylan wrote: > First, 6.4.1 is now in Debian's git repository (and experimental, I think) thanks to Євгеній Мещеряков aka eugen. I was able to > build from source on wheezy and it seems to be working. He filed two locale related issues. That only bothers you in countries where the decimal point is not "." > Second, while it was building I noticed that it built plunit. Code with it just works, though even after loading it help(test), for > example, doesn't give any info. No because this is not a predicate, and anyway, current help/1 only covers the core system. That is likely to change at some point. Now, use the manual at www.swi-prolog.org. Typing "test" in the search gives quite relevant auto-completion results. > Third, it seems the test code reads all the facts before any of the tests, which I found suprising. This may be easier to convey > with an excerpt: > % lots of stuff omitted > % recover directory of mountpoint > test(mount, [all(x(S, W) = [x(path(['osfirst1']), when(date(2010, 1, 13), seq(30)))])]) :- > block_for(S, path(['osfirst1', 'home', 'ross']), when(date(2011, 5, 1), seq(10)), W). > > succeeded when it was alone. But when I added the following lines after it: > partition(xda2, xda, when(date(2010, 2, 1), seq(10)), size(500, m)). > mount(xda2, path(['osfirst1', 'home']), when(date(2010, 2, 1), seq(20))). > > the test failed, because block_for found the correct answer given those later facts. > > I thought prolog just worked its way through the file; if anyone could help me understand that would be great. No. It compiles the entire file before executing anything. So, some exceptions aside, it does not matter in what order you write things in your file. Some declarations need to precede clauses or usage. > Also, I think I'm confused about packages vs modules. First, how do I find what packages I have available? > Second, I thought the autoload mechanism only applied to modules. Packages are typically collections of related library files. If the package is installed, you have these libraries, else not. They exist to allow for a more modular development process of the Prolog system. Some of the packages are also used by other Prolog implementations. Debian has its own swi-prolog packages, where each package combines one or more SWI-Prolog packages. They do that mainly to reduce dependencies. For example, the SWI-Prolog package xpce is in a separate Debian package to allow installing core SWI-Prolog without depending on X11. Similar for JPL, odbc, etc. Cheers --- Jan > > For fuller background see https://bitbucket.org/RossBoylan/disks/commits/1c3f174c0dfe9f543c9bbd91128b76dc6558addc which > has the configuration the failed (I may do later commits). > _______________________________________________ > SWI-Prolog mailing list > [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog