test code tweaks

This commit is contained in:
Andy2 2011-11-05 06:14:46 -07:00
parent 3707e7aaca
commit 4b5a06fe20
2 changed files with 7 additions and 2 deletions

View file

@ -92,6 +92,7 @@ DEFINES += -DDISABLE_TILE_SEL
DEFINES += -DSET_GAMESEED DEFINES += -DSET_GAMESEED
DEFINES += -DTEXT_MODEL DEFINES += -DTEXT_MODEL
DEFINES += -DXWFEATURE_WALKDICT DEFINES += -DXWFEATURE_WALKDICT
DEFINES += -DXWFEATURE_WALKDICT_FILTER
ifdef CURSES_CELL_HT ifdef CURSES_CELL_HT
DEFINES += -DCURSES_CELL_HT=$(CURSES_CELL_HT) DEFINES += -DCURSES_CELL_HT=$(CURSES_CELL_HT)

View file

@ -917,7 +917,10 @@ testGetNthWord( const DictionaryCtxt* dict, char** words,
dict_initIter( &iter, dict, min, max ); dict_initIter( &iter, dict, min, max );
XP_U32 half = dict_countWords( &iter ) / 2; XP_U32 half = dict_countWords( &iter ) / 2;
XP_U32 interval = half / 50; XP_U32 interval = half / 100;
if ( interval == 0 ) {
++interval;
}
for ( ii = 0, jj = half; ii < half; ii += interval, jj += interval ) { for ( ii = 0, jj = half; ii < half; ii += interval, jj += interval ) {
if ( dict_getNthWord( &iter, ii, depth, data ) ) { if ( dict_getNthWord( &iter, ii, depth, data ) ) {
@ -965,7 +968,7 @@ walk_dict_test( const LaunchParams* params, const DictionaryCtxt* dict,
for ( jj = 0, gotOne = dict_firstWord( &iter ); for ( jj = 0, gotOne = dict_firstWord( &iter );
gotOne; gotOne;
++jj, gotOne = dict_getNextWord( &iter ) ) { gotOne = dict_getNextWord( &iter ) ) {
XP_ASSERT( dict_getPosition( &iter ) == jj ); XP_ASSERT( dict_getPosition( &iter ) == jj );
XP_UCHAR buf[64]; XP_UCHAR buf[64];
dict_wordToString( &iter, buf, VSIZE(buf) ); dict_wordToString( &iter, buf, VSIZE(buf) );
@ -975,6 +978,7 @@ walk_dict_test( const LaunchParams* params, const DictionaryCtxt* dict,
if ( !!words ) { if ( !!words ) {
words[jj] = g_strdup( buf ); words[jj] = g_strdup( buf );
} }
++jj;
} }
XP_ASSERT( count == jj ); XP_ASSERT( count == jj );