Phobos: test suite

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 16 11:34:33 PDT 2015


On Thursday, 16 July 2015 at 17:32:04 UTC, Walter Bright wrote:
> On 7/16/2015 4:39 AM, Rikki Cattermole wrote:
>> I do not believe this issue has been raised yet.
>> But for std.experimental.image (or at least to my intention) I 
>> will be needing a
>> test suite for e.g. PNG file format loader/exporter.
>>
>> To my knowledge we currently only support unittests for 
>> Phobos. What I need
>> structure wise is similar to dmd's testsuite.
>>
>> I do not know nor want to get into setting this up.
>>
>> For example the PNG file format it should really be tested 
>> using separate
>> programs to compare against load/export/load for the files[0].
>> This is quite crucial to ensure the correctness of the 
>> loader/exporter. It will
>> help prevent and detect many bugs.
>>
>> So, would anybody like to get a head start on it?
>>
>> [0] http://www.schaik.com/pngsuite/
>
> I haven't looked at your code, but for an image file reader, 
> the D way is to separate file handling code from image handling 
> code. This means that the image code can be tested not by 
> handing it a file name, but handing it the data that can be 
> inlined in a D source code file.

Not an issue, takes an input range.

> This makes testing much more straightforward.

My concern is about getting access to the images to test against.
While embedding is valid, the test images I linked to only total 
a couple meg at most. We will need others added. Both large and 
small. I am concerned about file sizes and maintainability.
Especially for e.g. other file formats.

Worse case scenario I'll make sure something like bin2d[0] is 
part of the tools repo. To generate these files.
I just don't like this approach.

[0] https://github.com/rikkimax/Bin2D/blob/master/source/Bin2D.d


More information about the Digitalmars-d mailing list