Add testcase() macros to the automatic index logic to insure that boundary

cases are tested.

FossilOrigin-Name: 7286547847721b8f5f64bc2e7dc236652b1ae985
This commit is contained in:
drh 2010-04-08 14:15:56 +00:00
parent 9d6caca80d
commit 52ff8ea605
3 changed files with 22 additions and 8 deletions

View File

@ -1,5 +1,8 @@
C Make\ssure\sF_OK,\sR_OK,\sand\sW_OK\sare\sdefined\sin\stest_demovfs.c.\s\sDefine\sthem\smanually\nif\sthey\sare\snot.\s\sThis\sis\snecessary\sto\sget\sthe\smodule\sto\scompile\son\ssome\ssystems.
D 2010-04-08T11:35:19
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Add\stestcase()\smacros\sto\sthe\sautomatic\sindex\slogic\sto\sinsure\sthat\sboundary\ncases\sare\stested.
D 2010-04-08T14:15:56
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -222,7 +225,7 @@ F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 28c270dc93828e36392ddf85b9fd9400303c589c
F src/where.c 3a4a32910f4b283648ca60e099597d784640419d
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@ -796,7 +799,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P bf7b8d863665870a38f0b2335cc71de856a515b4
R d5c1c467a2fe159dee9601f419d531a4
P 7c8afc3272fa91e2b5685b009eb674dbc1b5920d
R ce7264333c7e3b80e3480a436a772632
U drh
Z 3c255bfefa1bd6638573105dd556d073
Z 93a751d218d1476c4e95c450f3e4b2fe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD4DBQFLveUfoxKgR168RlERAlK0AJizHi/WZt4pZH5D99H7Lruh8t+CAJ4npcDg
ufDfCArvIerz7SKlqMzbFg==
=6X+r
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
7c8afc3272fa91e2b5685b009eb674dbc1b5920d
7286547847721b8f5f64bc2e7dc236652b1ae985

View File

@ -1774,6 +1774,8 @@ static void constructAutomaticIndex(
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( (idxCols & cMask)==0 ){
nColumn++;
idxCols |= cMask;
@ -1793,6 +1795,8 @@ static void constructAutomaticIndex(
*/
extraCols = pSrc->colUsed & (~idxCols | (((Bitmask)1)<<(BMS-1)));
mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol;
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & (1<<i) ) nColumn++;
}
@ -3700,7 +3704,7 @@ static int nQPlan = 0; /* Next free slow in _query_plan[] */
** Free a WhereInfo structure
*/
static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
if( pWInfo ){
if( ALWAYS(pWInfo) ){
int i;
for(i=0; i<pWInfo->nLevel; i++){
sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;