1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-22 20:22:44 +03:00

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

@@ -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;