[vtk-developers] Comparing ascii files with kwsys::FilesDiffer

Brad King brad.king at kitware.com
Fri Feb 8 15:31:37 EST 2013


On 02/08/2013 03:26 PM, Bill Lorensen wrote:
> The test compares two ASCII files. The difference is because (some,
> but not all) windows systems handle newline differently than linux and
> mac os.

The SystemTools::FilesDiffer method was originally added for CMake's
configure_file command to decide whether to replace a file with a new
version or to not replace it because the configured result is the same.
In this use case both files are produced the same way so newlines match.
That's why we haven't covered this before.

> In the link you can see that the contents of the two files "look" the
> same, but the lengths of the two files is different and
> vtksys::FilesDiffer reports they are different. That's because some
> windows systems use a CR/LF character for newline while the linux
> systems use LF.
> 
> How to solve this? I could add a FileDiff program to the test that
> uses getline to compare the two files.

We don't use FilesDiffer to compare test images to baselines because
there can be pixel-fuzz differences and such.  Text file comparison
may have various tolerances other than just newlines and we will not
be able to cover them all in FilesDiffer.  Therefore I think VTK
should have its own comparison tool for text files just like it does
for images.

-Brad



More information about the vtk-developers mailing list