[freetds] ODBC unittests restyling
freddy77 at gmail.com
Fri Nov 7 11:06:15 EST 2008
Well... Somebody should have noted the big changes in ODBC unittests.
Mainly there were a lot of places were ODBC functions were tested for
results so I decided to write macros to test for results. Now mostly SQL
function have a corresponding CHK function (ie SQLFetch -> CHKFetch) with
additional string arguments with expected results. For other functions you
can use CHKR macro (with some limitations). These macros mostly does not
expected first handle which is implicitly passed. Note that I don't use
global variables but I pass argument in macro this to support variable
redefinition in function and to support thread tests. Also a RetCode
variable is used to collect error.
- errors are always reported from correct handle
- removed CheckReturn function, a mix of odbc and normal errors
- removed CHK macro, testing for only SQL_SUCCESS was not sufficient
- place these notes in a comment in common.h
- remove CHKR macros ??
- remove ODBC_REPORT_ERROR ??
- support redefining __LINE__ in CHK* macros (possible ??) and reuse macros
Just to see the advantage of all this work look at code size. I removed
about 700 lines of code adding additional testing and feature !
Some tests are so small that they don't contains if/while/for or they are
even contained in main function !
More information about the FreeTDS