[fpc-pascal] FPCUnit article/tutorial online.

Alan Mead cubrewer at yahoo.com
Tue Oct 11 21:25:51 CEST 2005


Michael Van Canneyt <michael at freepascal.org> wrote:

> Hello,
> 
> The Editor of Toolbox Magazine has allowed me to put an article
> about FPCUnit online.
> [...]

I found the article and the discussion on this list very helpful. 
Thanks for writing it and making it available.

These are probably stupid questions, but all the examples I've read
about use silly tests like 1+1=2 or checking that a list is empty.
I'm having trouble seeing how I would write tests for my code.

I have an ugly little hack that reads some logged data and counts
certain things.  The code is fragile so I'd love to add unit
testing...  But the code is mostly procedures for reading and parsing
the log data.  Would the unit tests create fake input and compare it
to known output?  (How do I fake reading data from disk?)  For that
matter, how do I test the data-reading procedures?  (Write fake data
and then see if the routine reads it correctly?)

Or, I've been messing around with SQLite... to add unit tests for
this code, would I need to create fake databases?

And what about the GUI code?  How can that be tested?  

Thanks again for the article and stimulating discussion.

-Alan



More information about the fpc-pascal mailing list