freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Frediano Ziglio" <freddy77 AT gmail.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: [freetds] ODBC unittests restyling
- Date: Fri, 7 Nov 2008 17:06:15 +0100
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.
Also
- 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
Todo:
- 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 !
freddy77
- [freetds] ODBC unittests restyling, Frediano Ziglio, 11/07/2008
Archive powered by MHonArc 2.6.24.