in reply to Re: Creating a co-operative framework for testing
in thread Creating a co-operative framework for testing
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
|
---|