2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/****************************************************************************
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Copyright  ( C )  2017  The  Qt  Company  Ltd .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Contact :  https : //www.qt.io/licensing/
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  This  file  is  part  of  Qt  Creator .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Commercial  License  Usage  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Licensees  holding  valid  commercial  Qt  licenses  may  use  this  file  in  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  accordance  with  the  commercial  license  agreement  provided  with  the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Software  or ,  alternatively ,  in  accordance  with  the  terms  contained  in  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  a  written  agreement  between  you  and  The  Qt  Company .  For  licensing  terms  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  and  conditions  see  https : //www.qt.io/terms-conditions. For further
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  information  use  the  contact  form  at  https : //www.qt.io/contact-us.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  GNU  General  Public  License  Usage  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Alternatively ,  this  file  may  be  used  under  the  terms  of  the  GNU  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  General  Public  License  version  3  as  published  by  the  Free  Software  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Foundation  with  exceptions  as  appearing  in  the  file  LICENSE . GPL3 - EXCEPT  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  included  in  the  packaging  of  this  file .  Please  review  the  following  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  information  to  ensure  the  GNU  General  Public  License  requirements  will  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  be  met :  https : //www.gnu.org/licenses/gpl-3.0.html.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "googletest.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-21 11:43:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "mockfilepathcaching.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-02-20 12:43:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "mocksqlitedatabase.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <symbolstorage.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <sqlitedatabase.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <utils/optional.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								namespace  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Utils : : PathString ;  
						 
					
						
							
								
									
										
										
										
											2018-02-14 18:49:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  ClangBackEnd : : FilePathId ;  
						 
					
						
							
								
									
										
										
										
											2017-09-21 11:43:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  ClangBackEnd : : FilePathCachingInterface ;  
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								using  ClangBackEnd : : SymbolEntries ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  ClangBackEnd : : SymbolEntry ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  ClangBackEnd : : SourceLocationEntries ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  ClangBackEnd : : SourceLocationEntry ;  
						 
					
						
							
								
									
										
										
										
											2018-02-14 18:49:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  ClangBackEnd : : SymbolIndex ;  
						 
					
						
							
								
									
										
										
										
											2018-04-09 13:30:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  ClangBackEnd : : SourceLocationKind ;  
						 
					
						
							
								
									
										
										
										
											2018-03-22 17:46:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  ClangBackEnd : : SymbolKind ;  
						 
					
						
							
								
									
										
										
										
											2017-09-18 10:21:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  Sqlite : : Database ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Sqlite : : Table ;  
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-11 18:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  Storage  =  ClangBackEnd : : SymbolStorage < MockSqliteDatabase > ;  
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  SymbolStorage  :  public  testing : : Test  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								protected :  
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    NiceMock < MockSqliteDatabase >  mockDatabase ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-11 18:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Storage  storage { mockDatabase } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & insertSymbolsToNewSymbolsStatement  =  storage . m_insertSymbolsToNewSymbolsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & insertLocationsToNewLocationsStatement  =  storage . m_insertLocationsToNewLocationsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteReadStatement  & selectNewSourceIdsStatement  =  storage . m_selectNewSourceIdsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & addNewSymbolsToSymbolsStatement  =  storage . m_addNewSymbolsToSymbolsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & syncNewSymbolsFromSymbolsStatement  =  storage . m_syncNewSymbolsFromSymbolsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & syncSymbolsIntoNewLocationsStatement  =  storage . m_syncSymbolsIntoNewLocationsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & deleteAllLocationsFromUpdatedFilesStatement  =  storage . m_deleteAllLocationsFromUpdatedFilesStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & insertNewLocationsInLocationsStatement  =  storage . m_insertNewLocationsInLocationsStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & deleteNewSymbolsTableStatement  =  storage . m_deleteNewSymbolsTableStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & deleteNewLocationsTableStatement  =  storage . m_deleteNewLocationsTableStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & insertProjectPartStatement  =  storage . m_insertProjectPartStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & updateProjectPartStatement  =  storage . m_updateProjectPartStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteReadStatement  & getProjectPartIdStatement  =  storage . m_getProjectPartIdStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & deleteAllProjectPartsSourcesWithProjectPartIdStatement  =  storage . m_deleteAllProjectPartsSourcesWithProjectPartIdStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteWriteStatement  & insertProjectPartSourcesStatement  =  storage . m_insertProjectPartSourcesStatement ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteReadStatement  & getProjectPartArtefactsBySourceId  =  storage . m_getProjectPartArtefactsBySourceId ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteReadStatement  & getProjectPartArtefactsByProjectPartName  =  storage . m_getProjectPartArtefactsByProjectPartName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    MockSqliteReadStatement  & getPrecompiledHeader  =  storage . m_getPrecompiledHeader ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-20 12:43:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-22 17:46:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    SymbolEntries  symbolEntries { { 1 ,  { " functionUSR " ,  " function " ,  SymbolKind : : Function } } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                { 2 ,  { " function2USR " ,  " function2 " ,  SymbolKind : : Function } } } ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-06 19:02:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    SourceLocationEntries  sourceLocations { { 1 ,  3 ,  { 42 ,  23 } ,  SourceLocationKind : : Declaration } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                          { 2 ,  4 ,  { 7 ,  11 } ,  SourceLocationKind : : Definition } } ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ClangBackEnd : : ProjectPartArtefact  artefact { " [ \" -DFOO \" ] " ,  " { \" FOO \" : \" 1 \" } " ,  " [ \" /includes \" ] " ,  74 } ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  CreateAndFillTemporaryLocationsTable )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  sequence ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-09 13:30:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertLocationsToNewLocationsStatement ,  write ( TypedEq < SymbolIndex > ( 1 ) ,  TypedEq < int > ( 42 ) ,  TypedEq < int > ( 23 ) ,  TypedEq < int > ( 3 ) ,  TypedEq < int > ( int ( SourceLocationKind : : Declaration ) ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertLocationsToNewLocationsStatement ,  write ( TypedEq < SymbolIndex > ( 2 ) ,  TypedEq < int > ( 7 ) ,  TypedEq < int > ( 11 ) ,  TypedEq < int > ( 4 ) ,  TypedEq < int > ( int ( SourceLocationKind : : Definition ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . fillTemporaryLocationsTable ( sourceLocations ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  AddNewSymbolsToSymbols )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( addNewSymbolsToSymbolsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . addNewSymbolsToSymbols ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  SyncNewSymbolsFromSymbols )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( syncNewSymbolsFromSymbolsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . syncNewSymbolsFromSymbols ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  SyncSymbolsIntoNewLocations )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( syncSymbolsIntoNewLocationsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . syncSymbolsIntoNewLocations ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  DeleteAllLocationsFromUpdatedFiles )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteAllLocationsFromUpdatedFilesStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . deleteAllLocationsFromUpdatedFiles ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  InsertNewLocationsInLocations )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertNewLocationsInLocationsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . insertNewLocationsInLocations ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  DropNewSymbolsTable )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteNewSymbolsTableStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . deleteNewSymbolsTable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  DropNewLocationsTable )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteNewLocationsTableStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . deleteNewLocationsTable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  AddSymbolsAndSourceLocationsCallsWrite )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  sequence ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-05 10:58:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertSymbolsToNewSymbolsStatement ,  write ( An < uint > ( ) ,  An < Utils : : SmallStringView > ( ) ,  An < Utils : : SmallStringView > ( ) ,  An < uint > ( ) ) ) . Times ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-09 13:30:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertLocationsToNewLocationsStatement ,  write ( TypedEq < SymbolIndex > ( 1 ) ,  TypedEq < int > ( 42 ) ,  TypedEq < int > ( 23 ) ,  TypedEq < int > ( 3 ) ,  TypedEq < int > ( int ( SourceLocationKind : : Declaration ) ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertLocationsToNewLocationsStatement ,  write ( TypedEq < SymbolIndex > ( 2 ) ,  TypedEq < int > ( 7 ) ,  TypedEq < int > ( 11 ) ,  TypedEq < int > ( 4 ) ,  TypedEq < int > ( int ( SourceLocationKind : : Definition ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( addNewSymbolsToSymbolsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( syncNewSymbolsFromSymbolsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( syncSymbolsIntoNewLocationsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteAllLocationsFromUpdatedFilesStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertNewLocationsInLocationsStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteNewSymbolsTableStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteNewLocationsTableStatement ,  execute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . addSymbolsAndSourceLocations ( symbolEntries ,  sourceLocations ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  ConvertStringsToJson )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Utils : : SmallStringVector  strings { " foo " ,  " bar " ,  " foo " } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    auto  jsonText  =  storage . toJson ( strings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ASSERT_THAT ( jsonText ,  Eq ( " [ \" foo \" , \" bar \" , \" foo \" ] " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  InsertProjectPart )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  sequence ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ON_CALL ( mockDatabase ,  lastInsertedRowId ( ) ) . WillByDefault ( Return ( 1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  setLastInsertedRowId ( - 1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-29 12:07:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertProjectPartStatement , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                write ( TypedEq < Utils : : SmallStringView > ( " project " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " [ \" foo \" ] " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " { \" FOO \" : \" 1 \" } " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " [ \" /includes \" ] " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-28 12:08:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  lastInsertedRowId ( ) ) . Times ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    storage . insertOrUpdateProjectPart ( " project " ,   { " foo " } ,  { { " FOO " ,  " 1 " } } ,  { " /includes " } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  UpdateProjectPart )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  sequence ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ON_CALL ( mockDatabase ,  lastInsertedRowId ( ) ) . WillByDefault ( Return ( - 1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  setLastInsertedRowId ( - 1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-29 12:07:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertProjectPartStatement , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                write ( TypedEq < Utils : : SmallStringView > ( " project " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " [ \" foo \" ] " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " { \" FOO \" : \" 1 \" } " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " [ \" /includes \" ] " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  lastInsertedRowId ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-29 12:07:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( updateProjectPartStatement , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                write ( TypedEq < Utils : : SmallStringView > ( " [ \" foo \" ] " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 19:03:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " { \" FOO \" : \" 1 \" } " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-20 12:43:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " [ \" /includes \" ] " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      TypedEq < Utils : : SmallStringView > ( " project " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-28 12:08:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  lastInsertedRowId ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    storage . insertOrUpdateProjectPart ( " project " ,   { " foo " } ,  { { " FOO " ,  " 1 " } } ,  { " /includes " } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  UpdateProjectPartSources )  
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    InSequence  sequence ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-24 19:06:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( deleteAllProjectPartsSourcesWithProjectPartIdStatement ,  write ( TypedEq < int > ( 42 ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertProjectPartSourcesStatement ,  write ( TypedEq < int > ( 42 ) ,  TypedEq < int > ( 1 ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( insertProjectPartSourcesStatement ,  write ( TypedEq < int > ( 42 ) ,  TypedEq < int > ( 2 ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-06 19:02:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    storage . updateProjectPartSources ( 42 ,  { 1 ,  2 } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-01-22 14:21:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 19:03:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  FetchProjectPartArtefactBySourceIdCallsValueInStatement )  
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( getProjectPartArtefactsBySourceId ,  valueReturnProjectPartArtefact ( 1 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . WillRepeatedly ( Return ( artefact ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-06 19:02:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    storage . fetchProjectPartArtefact ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 19:03:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  FetchProjectPartArtefactBySourceIdReturnArtefact )  
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( getProjectPartArtefactsBySourceId ,  valueReturnProjectPartArtefact ( 1 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . WillRepeatedly ( Return ( artefact ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-06 19:02:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    auto  result  =  storage . fetchProjectPartArtefact ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-06 11:16:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ASSERT_THAT ( result ,  Eq ( artefact ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-02-07 16:18:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  FetchProjectPartArtefactByProjectNameCallsValueInStatement )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( getProjectPartArtefactsBySourceId ,  valueReturnProjectPartArtefact ( 1 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-07 16:18:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . WillRepeatedly ( Return ( artefact ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-06 19:02:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    storage . fetchProjectPartArtefact ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-07 16:18:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  FetchProjectPartArtefactByProjectNameReturnArtefact )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-02-08 12:48:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    EXPECT_CALL ( getProjectPartArtefactsBySourceId ,  valueReturnProjectPartArtefact ( 1 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-07 16:18:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . WillRepeatedly ( Return ( artefact ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-06 19:02:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    auto  result  =  storage . fetchProjectPartArtefact ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-07 16:18:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ASSERT_THAT ( result ,  Eq ( artefact ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-02-08 17:49:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-20 12:43:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  FetchPrecompiledHeaderCallsValueInStatement )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( getPrecompiledHeader ,  valueReturnProjectPartPch ( Eq ( 25 ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . fetchPrecompiledHeader ( 25 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  FetchPrecompiledHeader )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ClangBackEnd : : ProjectPartPch  pch { " " ,  " /path/to/pch " ,  131 } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( getPrecompiledHeader ,  valueReturnProjectPartPch ( Eq ( 25 ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . WillRepeatedly ( Return ( pch ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    auto  precompiledHeader  =  storage . fetchPrecompiledHeader ( 25 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ASSERT_THAT ( precompiledHeader . value ( ) ,  Eq ( pch ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-11 18:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  AddNewSymbolsTable )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  s ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE TEMPORARY TABLE newSymbols(temporarySymbolId INTEGER PRIMARY KEY, symbolId INTEGER, usr TEXT, symbolName TEXT, symbolKind INTEGER) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE INDEX IF NOT EXISTS index_newSymbols_usr_symbolName ON newSymbols(usr, symbolName) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE INDEX IF NOT EXISTS index_newSymbols_symbolId ON newSymbols(symbolId) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . createNewSymbolsTable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-02-08 17:49:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-11 18:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  AddNewLocationsTable )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  s ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE TEMPORARY TABLE newLocations(temporarySymbolId INTEGER, symbolId INTEGER, sourceId INTEGER, line INTEGER, column INTEGER, locationKind INTEGER) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE UNIQUE INDEX IF NOT EXISTS index_newLocations_sourceId_line_column ON newLocations(sourceId, line, column) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    storage . createNewLocationsTable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TEST_F ( SymbolStorage ,  AddTablesInConstructor )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    InSequence  s ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  immediateBegin ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE TEMPORARY TABLE newSymbols(temporarySymbolId INTEGER PRIMARY KEY, symbolId INTEGER, usr TEXT, symbolName TEXT, symbolKind INTEGER) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE INDEX IF NOT EXISTS index_newSymbols_usr_symbolName ON newSymbols(usr, symbolName) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE INDEX IF NOT EXISTS index_newSymbols_symbolId ON newSymbols(symbolId) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE TEMPORARY TABLE newLocations(temporarySymbolId INTEGER, symbolId INTEGER, sourceId INTEGER, line INTEGER, column INTEGER, locationKind INTEGER) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  execute ( Eq ( " CREATE UNIQUE INDEX IF NOT EXISTS index_newLocations_sourceId_line_column ON newLocations(sourceId, line, column) " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    EXPECT_CALL ( mockDatabase ,  commit ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Storage  storage { mockDatabase } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-02-08 17:49:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 12:00:27 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}