//
// Copyright (c) 2017-2026, Manticore Software LTD (https://manticoresearch.com)
// Copyright (c) 2001-2016, Andrew Aksyonoff
// Copyright (c) 2008-2016, Sphinx Technologies Inc
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
// received a copy of the GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org
//

#include "gtests_tokenizer.cpp"


// this test is for profiling
TEST_F ( QueryParser, huge_tokenizer )
{
	constexpr const char* szQuery = R"h((aa one span sp aa zon aa zon sp aa zon zoan espanzone span sp aa zon aa zon sp pan sp aa zon zoneaa zon sp aa zon zonn espan sn sp aa zon aa qon zon aa zon sp aa zon zoan espan sn sp aa zon zone span sp aa zon zonn espan sn sp aa zon aa zon zon aa zon sp aa zon zoan espan sn sp aa zon aa zonaa one spn sn zone fff cc ("s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonsp aa zon zoan espanzone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone szoan espan sn zone span sp aa zon zone sp aa zonaa one spn sn zone fff gg ged zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaan sp not zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonspdaa zon zoan espanzone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an pp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone spmn sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan snsp aa zon zone span sp aa zon zoan espanzone span sp aa zon zone sp aa zoa zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone pan sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaa one spn sn zone fff gg ged zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaan sp aa zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp a? zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonsp aa zon zoan espanzone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zonpan sp aa zon zonn espan snsp aa zon zone span sp aa zon zoan espanzone span sp aa zon zone sp aa zoa zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone pan sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaa one spn sn zone fff gg ged zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaan sp aa zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp a? zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonsp aa zon zoan espanzone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone szoan espan sn zone span sp aa zon zone sp aa zonaa one spn sn zone fff gg ged zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaan sp not zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonspdaa zon zoan espanzone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon yone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan snsp aa zon zone span sp aa zon zoan espanzone span sp aa zon zone sp aa zoa zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone pan sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaa one spn sn zone fff gg ged zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaan sp aa zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp a? zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zoone span sp aa nn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonsp aa zon zoan espanzone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zonpan sp aa zon zonn espan snsp aa zon zone span sp aa zon zoan espanzone span sp aa zon zone sp aa zoa zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone pan sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaa one spn sn zone fff gg ged zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span sp aa zon zone sp aa zonaan sp aa zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp a? zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex span sp aa zon zone sp aa zon zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp a? zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zoan espan s3bbb ccc zone ccc8p 5bbb ccc zone zone ncc8p 5bbb ccc 0ccen zone span sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa one span sp aa zon zone espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex cn zone an sp aa aa zon zoggbbb ccn zp aa zon zonspdaa zon zoan espanzone span sp aa zonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn zone sp aa zon zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone sp aa zonn espan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zonon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sppppppppppppppppppppppppppppppppppppppppp sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zp aa zon zonnespan sn zone span sp aa zon zone sp aa zon zone sp zon zone sp aa zon zone span sp aa zon zoan espan sn zone span regex sp aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zoggbbb ccn zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan sn zone span sp aa zon zone an sp aa aa zon zone spau aa zon zone sp aa zon zone span sp pan sp aa zon zone sp aa zon zone span sp aa zon zonn espan snsp aa zon zone span sp aa zon zoan espanzone span sp aa zon zone sp aa zoa zone span sp pan sp aa zon zoneaa zon zone span sp aa zon zonn espan sn zone span sp ffgg fff ffee ggf cc"|dd) zone sp aa zon zon aa zon sp aa zon zoan espan sn sp aa zon aa zonaan sp not zon aa zon sp aa zon zoan espan)!(gg|ged))h";
	CSphIndexSettings tTmpSettings;
	XQQuery_t tQuery;
	sphParseExtendedQuery ( tQuery, szQuery, nullptr, pTokenizer, &tSchema, pDict, tTmpSettings, nullptr );
	CSphDummyIndex tIndex;

	TransformExtendedQueryArgs_t tTranformArgs { true, tQuery.m_bNeedPhraseTransform, &tIndex };
	sphTransformExtendedQuery ( &tQuery.m_pRoot, tTmpSettings, tQuery.m_sParseError, tTranformArgs, tQuery.m_sParseWarning );

	ASSERT_TRUE ( tQuery.m_pRoot!=nullptr );
}
