@@ -36,11 +36,11 @@ SCENARIO("journalling_symbol_table_writer",
3636 const symbol_tablet &read_symbol_table=symbol_table;
3737
3838 irep_idt symbol_name=" Test" ;
39- symbolt symbol;
40- symbol.name =symbol_name;
4139
4240 WHEN (" A symbol is inserted into the symbol table" )
4341 {
42+ symbolt symbol;
43+ symbol.name = symbol_name;
4444 auto result=symbol_table.insert (symbol);
4545 THEN (" The insert should succeed" )
4646 {
@@ -69,8 +69,6 @@ SCENARIO("journalling_symbol_table_writer",
6969 }
7070 WHEN (" Adding the same symbol again" )
7171 {
72- symbolt symbol;
73- symbol.name =symbol_name;
7472 auto result=symbol_table.insert (symbol);
7573 THEN (" The insert should fail" )
7674 {
@@ -80,6 +78,8 @@ SCENARIO("journalling_symbol_table_writer",
8078 }
8179 WHEN (" Moving a symbol into the symbol table" )
8280 {
81+ symbolt symbol;
82+ symbol.name = symbol_name;
8383 symbolt *symbol_in_table;
8484 auto result=symbol_table.move (symbol, symbol_in_table);
8585 THEN (" The move should succeed" )
@@ -105,8 +105,6 @@ SCENARIO("journalling_symbol_table_writer",
105105 }
106106 WHEN (" Moving the same symbol again" )
107107 {
108- symbolt symbol;
109- symbol.name =symbol_name;
110108 symbolt *symbol_in_table2;
111109 auto result=symbol_table.move (symbol, symbol_in_table2);
112110 THEN (" The move should fail" )
@@ -121,6 +119,8 @@ SCENARIO("journalling_symbol_table_writer",
121119 }
122120 WHEN (" Adding a symbol to the symbol table" )
123121 {
122+ symbolt symbol;
123+ symbol.name = symbol_name;
124124 auto result=symbol_table.add (symbol);
125125 THEN (" The add should succeed" )
126126 {
@@ -145,8 +145,6 @@ SCENARIO("journalling_symbol_table_writer",
145145 }
146146 WHEN (" Adding the same symbol again" )
147147 {
148- symbolt symbol;
149- symbol.name =symbol_name;
150148 auto result=symbol_table.add (symbol);
151149 THEN (" The insert should fail" )
152150 {
@@ -156,6 +154,8 @@ SCENARIO("journalling_symbol_table_writer",
156154 }
157155 WHEN (" Updating an existing symbol" )
158156 {
157+ symbolt symbol;
158+ symbol.name = symbol_name;
159159 base_symbol_table.add (symbol);
160160 symbolt *writeable=symbol_table.get_writeable (symbol_name);
161161
@@ -184,20 +184,22 @@ SCENARIO("journalling_symbol_table_writer",
184184 }
185185 WHEN (" Removing a non-existent symbol" )
186186 {
187- irep_idt symbol_name= " DoesNotExist" ;
188- bool ret= symbol_table.remove (symbol_name );
187+ irep_idt no_such_symbol_name = " DoesNotExist" ;
188+ bool ret = symbol_table.remove (no_such_symbol_name );
189189 THEN (" The remove operation should fail" )
190190 {
191191 REQUIRE (ret);
192192 }
193193 THEN (" The symbol we failed to remove should appear in neither journal" )
194194 {
195- REQUIRE (symbol_table.get_updated ().count (symbol_name)== 0 );
196- REQUIRE (symbol_table.get_removed ().count (symbol_name)== 0 );
195+ REQUIRE (symbol_table.get_updated ().count (no_such_symbol_name) == 0 );
196+ REQUIRE (symbol_table.get_removed ().count (no_such_symbol_name) == 0 );
197197 }
198198 }
199199 WHEN (" Removing an existing symbol added via the journalling writer" )
200200 {
201+ symbolt symbol;
202+ symbol.name = symbol_name;
201203 symbol_table.add (symbol);
202204 bool ret=symbol_table.remove (symbol_name);
203205 THEN (" The remove operation should succeed" )
@@ -212,6 +214,8 @@ SCENARIO("journalling_symbol_table_writer",
212214 }
213215 WHEN (" Removing an existing symbol added outside the journalling writer" )
214216 {
217+ symbolt symbol;
218+ symbol.name = symbol_name;
215219 base_symbol_table.add (symbol);
216220 bool ret=symbol_table.remove (symbol_name);
217221 THEN (" The remove operation should succeed" )
@@ -227,6 +231,8 @@ SCENARIO("journalling_symbol_table_writer",
227231 }
228232 WHEN (" Removing an existing symbol using an iterator (added via writer)" )
229233 {
234+ symbolt symbol;
235+ symbol.name = symbol_name;
230236 symbol_table.add (symbol);
231237 auto erase_iterator=read_symbol_table.symbols .find (symbol_name);
232238 symbol_table.erase (erase_iterator);
@@ -238,6 +244,8 @@ SCENARIO("journalling_symbol_table_writer",
238244 }
239245 WHEN (" Removing an existing symbol using an iterator (added via base)" )
240246 {
247+ symbolt symbol;
248+ symbol.name = symbol_name;
241249 base_symbol_table.add (symbol);
242250 auto erase_iterator=read_symbol_table.symbols .find (symbol_name);
243251 symbol_table.erase (erase_iterator);
@@ -249,6 +257,8 @@ SCENARIO("journalling_symbol_table_writer",
249257 }
250258 WHEN (" Re-adding a symbol previously removed" )
251259 {
260+ symbolt symbol;
261+ symbol.name = symbol_name;
252262 auto result=symbol_table.add (symbol);
253263 symbol_table.remove (symbol.name );
254264 auto result2=symbol_table.add (symbol);
0 commit comments