#include "test.h"
#include "../util/English.h"

//checks that adding more than the min_merge value goes ok...
//checks for a mem leak that used to occur
void testIWmergeSegments1(CuTest *tc){
	RAMDirectory ram;
	SimpleAnalyzer a;
	IndexWriter ndx(&ram,&a,true);
	ndx.setUseCompoundFile(false);
	ndx.setMergeFactor(2);
	ndx.setMinMergeDocs(1);
	for ( int i=0;i<1000;i++ ){
		TCHAR fld[1000];
        English::IntToEnglish(i,fld,1000);

		Document doc;
		doc.add ( *Field::Text(_T("field"),fld) );
		ndx.addDocument(&doc);
	}
	ndx.close();
}
CuSuite *testindexwriter(void)
{
	CuSuite *suite = CuSuiteNew(_T("CLucene IndexWriter Test"));
	SUITE_ADD_TEST(suite, testIWmergeSegments1);

    return suite; 
}
// EOF
