From: Yuriy Koblents-Mishke (yurakm_at_[hidden])
Date: 2007-03-09 18:44:02
On 3/9/07, Emil Dotchevski <emildotchevski_at_[hidden]> wrote:
> I'm considering migrating my unit tests to boost.test, however there is a
> feature I need which I can't find in boost.test. Please correct me if I'm
> Essentially what I need is a system which, given a file name without path,
> returns a fully qualified file name that places the file in the same
> directory where the executable is, and also remembers the file name in an
> internal file name list. When a unit test finishes, the system goes through
> all files requested by the unit test. For each file, it compares it to a
> file with the same name but .svd extension. If a matching .svd file does not
> exist, or if it differs, the system fails the unit test, specifying the name
> of the mismatched file.
> For example, if I request two file names:
> the system would be comparing them to
> and if it finds any differences, or if the .svd files don't exist, will fail
> the test.
> Does this sound as a reasonable functionality to add to boost.test?
Well, it looks as it would be better to split the functionality into
1. Qualification of file name without path.
I do not know if such a utility is already in one of Boost libraries.
If not, it would be nice to have one, and not only for tests.
In my experience, I qualified filenames many times in different
programs that change current directories. Some OS do not have
directory trees, but I did it under MS Windows, Linux, VMS, DOS, and
old Mac OS (9 and earlier).
So, such utility belongs not to Test, but to some more generic library.
2. Testing if expected files were created.
3. Testing that the created file contains right data. It can be done
by comparing them to model files, like you do, or in other ways.
---- Critique: - A bit unusual is that you put files without names in the same directory as the executable program. Typically, they are in the current directory. - Extension "svd" is hard-coded; why? - The naming system is unusual and, I would say, unintuitive. I would either add the extra extensions at the end: frame1.tga.svd frame2.tga.svd or even better would assign the model files the same names, but put them in a separate directory: model_dir/frame1.tga model_dir/frame2.tga Actually, it is what I usually do. Very convenient when comparing with previous versions that works: just move all files to the "model" directory before running the test. I used external utilities for comparison, fc [/b] in Windows (and DOS) and diff or cmp under Linux, but, of course, it can be done by C++ codes.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk