Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Creating a co-operative framework for testing

by ruoso (Curate)
on Oct 26, 2006 at 09:46 UTC ( #580720=note: print w/replies, xml ) Need Help??

in reply to Creating a co-operative framework for testing

I know this wasn't exactly your question, but I think this will be of help...

One of the things that makes perl testing framework really nice is TAP, this means that the test can be anything that just prints "ok" or "not ok" for each test (Test::Harness actually expects that to be a Perl program, but this is easily work-aroundable (does that word exists?)).

So, here is what I use to work with Test-Driven-Development in whatever-language:

#!/bin/sh make clean all check && perl -MTest::Harness -e '@tests=<./test/t*>;$T +est::Harness::Switches=qw();*Test::Harness::Straps::_command_line = s +ub {return $_[1]};runtests(@tests)'

Replies are listed 'Best First'.
Re^2: Creating a co-operative framework for testing
by ruoso (Curate) on Oct 26, 2006 at 09:51 UTC

    BTW, for C code, I also use this _test.h file... which is very helpful to me...

    #ifndef LOADED_TEST_H #define LOADED_TEST_H #include <stdio.h> #include <unistd.h> #define plan(numtests) printf("1..%i\n",(numtests)); #define ok(bool,testname) printf("%s - %s\n",(bool)?"ok":"not ok",test +name); #define pass(testname) printf("ok - %s\n",testname); #define fail(testname) printf("not ok - %s\n",testname); #define skip(testname,reason) printf("ok - %s # Skipped: %s\n",testnam +e,reason); #define is_int(got,expected,testname) printf("%s - %s (expected:%i, go +t:%i)\n",((got)==(expected))?"ok":"not ok",testname,expected,got); #define is_short(got,expected,testname) printf("%s - %s (expected:%hhu +, got:%hhu)\n",((got)==(expected))?"ok":"not ok",testname,expected,go +t); #define is_flt(got,expected,testname) printf("%s - %s (expected:%f, go +t:%f)\n",((got)==(expected))?"ok":"not ok",testname,expected,got); #define is_str(got,expected,testname) printf("%s - %s (expected:%s, go +t:%s)\n",(strcmp((got),(expected))==0)?"ok":"not ok",testname,expecte +d,got); #endif

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://580720]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2021-10-23 21:46 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (88 votes). Check out past polls.