Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ethan (3163)

ethan
  reversethis-{ed. ... rap.nov.olissat}

Being a 25-year old chap living in the western-most town of Germany. Stuying communication and information science and being a huge fan of XS-related things.

Journal of ethan (3163)

Monday May 24, 2004
12:21 AM

How to test this thing?

[ #18910 ]

I just finished wrapping libstatgrab into Unix::Statgrab. It would now be time to add the tests (yes, I don't write them in beforehand). But how am I to write tests for a library that is designed to return different results for each platform and each machine even?

Maybe I just have the tests call each function/method and make sure that they at least do not segfault. I think pulling out values from Config.pm and testing some of them against what the libary figures out is a bit too hairy.

On the upside though, this C library is deliberately portable among several unices so I wont have to worry about compilation issues, I hope.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hello Ethan,

    To program a function that returns something, you need to know what it returns, so that you know you reached your goal. You have to ask yourself if it is possible to capture the conditions that tell you 'you are done. this works like it should'.

    For some functions it might be that you have to test it with a value that you experienced with a special OS/CPU combination. For other functions you might want to write and I/O test for the data processing. This is called Glas-Box testing. And last bu
    • For some functions it might be that you have to test it with a value that you experienced with a special OS/CPU combination.

      This sounds extremely fragile to me. At some point, a new release of the operating system is being made and suddenly the values I experienced may have changed.

      I eventually did find a solution, although not a very convincing one admittedly. I call every function in the module (that's easy because none of the functions take any argument). If the return value is an object, I call each