in reply to Testing Inline::C Modules

I'm also rather unclear about how to test the C functions. I only have 18 tests for the module, but it needs heavy redesign internally (such as not using globals in C) and while testing through the Perl interface will catch bugs, it won't tell me where the bugs are. I suppose I could use assert(), but I have no idea how to remove #include <assert.h> when the module gets installed (or even if I should remove it).

You might want to consider using a separate testing frameworks for the C code - you can find some on xprogramming.com. I find it easier to test libraries using the same language they're written in.

It's also very easy to write some quick C code to chuck out test results in the format that Test::Harness expects. You can then have a normal *.t script fire it off and get your C tests integrated into your Perl test suite.

Replies are listed 'Best First'.
Re: Re: Testing Inline::C Modules
by Ovid (Cardinal) on Feb 11, 2004 at 22:38 UTC

    It's also very easy to write some quick C code to chuck out test results in the format that Test::Harness expects. You can then have a normal *.t script fire it off and get your C tests integrated into your Perl test suite.

    I wonder if that's more difficult than it sounds. I seem to recall that there's a lot of special case code in the Test:: modules to deal with VMS quirks (and a quick grep confirms this). I suppose I could just forget about VMS, but I don't like that thought. Have you any experience with this?

    Cheers,
    Ovid

    New address of my CGI Course.

      No experience of doing it on VMS boxes, but I can't really see how it would cause problems. All you're doing is printing "ok" and "no ok" to STDOUT after all.

      I've used C and even (gasp) PHP in this sort of way in the past without problems on various Unix boxes.