@@ -12,6 +12,7 @@ Author: Diffblue Ltd.
12
12
#include < algorithm>
13
13
14
14
#include < java_bytecode/java_types.h>
15
+ #include < java_bytecode/java_utils.h>
15
16
#include < util/expr_iterator.h>
16
17
17
18
// / Check the full tree of expr for any symbol_exprts that have an identifier id
@@ -37,6 +38,12 @@ SCENARIO(
37
38
{
38
39
REQUIRE (symbol_table.has_symbol (" java::Parent1.x" ));
39
40
}
41
+ THEN (" Static field 'Parent1.x' should be declared by class Parent1" )
42
+ {
43
+ REQUIRE (
44
+ id2string (*declaring_class (
45
+ symbol_table.lookup_ref (" java::Parent1.x" ))) == " java::Parent1" );
46
+ }
40
47
THEN (" No static field 'Test1.x' should be created" )
41
48
{
42
49
REQUIRE (!symbol_table.has_symbol (" java::Test1.x" ));
@@ -62,6 +69,14 @@ SCENARIO(
62
69
{
63
70
REQUIRE (symbol_table.has_symbol (" java::StaticInterface2.x" ));
64
71
}
72
+ THEN (
73
+ " Static field 'java::StaticInterface2.x' should be declared by "
74
+ " StaticInterface2" )
75
+ {
76
+ REQUIRE (
77
+ id2string (*declaring_class (symbol_table.lookup_ref (
78
+ " java::StaticInterface2.x" ))) == " java::StaticInterface2" );
79
+ }
65
80
THEN (" No static field 'Test2.x' should be created" )
66
81
{
67
82
REQUIRE (!symbol_table.has_symbol (" java::Test2.x" ));
@@ -93,6 +108,14 @@ SCENARIO(
93
108
{
94
109
REQUIRE (symbol_table.has_symbol (" java::OpaqueParent3.x" ));
95
110
}
111
+ THEN (
112
+ " Static field 'OpaqueParent3.x' should be declared by class "
113
+ " OpaqueParent3" )
114
+ {
115
+ REQUIRE (
116
+ id2string (*declaring_class (symbol_table.lookup_ref (
117
+ " java::OpaqueParent3.x" ))) == " java::OpaqueParent3" );
118
+ }
96
119
THEN (" No static field 'Test3.x' should be created" )
97
120
{
98
121
REQUIRE (!symbol_table.has_symbol (" java::Test3.x" ));
@@ -124,6 +147,14 @@ SCENARIO(
124
147
{
125
148
REQUIRE (symbol_table.has_symbol (" java::OpaqueInterface4.x" ));
126
149
}
150
+ THEN (
151
+ " Static field 'OpaqueInterface4.x' should be declared by class "
152
+ " OpaqueInterface4" )
153
+ {
154
+ REQUIRE (
155
+ id2string (*declaring_class (symbol_table.lookup_ref (
156
+ " java::OpaqueInterface4.x" ))) == " java::OpaqueInterface4" );
157
+ }
127
158
THEN (" No static field 'Test4.x' should be created" )
128
159
{
129
160
REQUIRE (!symbol_table.has_symbol (" java::Test4.x" ));
@@ -191,6 +222,12 @@ SCENARIO(
191
222
{
192
223
REQUIRE (symbol_table.has_symbol (" java::Parent6.x" ));
193
224
}
225
+ THEN (" Static field 'Parent6.x' should be declared by class Parent6" )
226
+ {
227
+ REQUIRE (
228
+ id2string (*declaring_class (
229
+ symbol_table.lookup_ref (" java::Parent6.x" ))) == " java::Parent6" );
230
+ }
194
231
THEN (" No static field 'Test6.x' should be created" )
195
232
{
196
233
REQUIRE (!symbol_table.has_symbol (" java::Test6.x" ));
@@ -217,10 +254,26 @@ SCENARIO(
217
254
{
218
255
REQUIRE (symbol_table.has_symbol (" java::otherpackage.Parent7.x" ));
219
256
}
257
+ THEN (
258
+ " Static field 'otherpackage.Parent7.x' should be declared by class "
259
+ " otherpackage.Parent7" )
260
+ {
261
+ REQUIRE (
262
+ id2string (*declaring_class (symbol_table.lookup_ref (
263
+ " java::otherpackage.Parent7.x" ))) == " java::otherpackage.Parent7" );
264
+ }
220
265
THEN (" A static field StaticInterface7.x should exist" )
221
266
{
222
267
REQUIRE (symbol_table.has_symbol (" java::StaticInterface7.x" ));
223
268
}
269
+ THEN (
270
+ " Static field 'StaticInterface7.x' should be declared by class "
271
+ " StaticInterface7" )
272
+ {
273
+ REQUIRE (
274
+ id2string (*declaring_class (symbol_table.lookup_ref (
275
+ " java::StaticInterface7.x" ))) == " java::StaticInterface7" );
276
+ }
224
277
THEN (" No static field 'Test7.x' should be created" )
225
278
{
226
279
REQUIRE (!symbol_table.has_symbol (" java::Test7.x" ));
@@ -253,6 +306,12 @@ SCENARIO(
253
306
{
254
307
REQUIRE (symbol_table.has_symbol (" java::Parent8.x" ));
255
308
}
309
+ THEN (" Static field 'Parent8.x' should be declared by class Parent8" )
310
+ {
311
+ REQUIRE (
312
+ id2string (*declaring_class (
313
+ symbol_table.lookup_ref (" java::Parent8.x" ))) == " java::Parent8" );
314
+ }
256
315
THEN (" No static field 'Test8.x' should be created" )
257
316
{
258
317
REQUIRE (!symbol_table.has_symbol (" java::Test8.x" ));
@@ -279,10 +338,22 @@ SCENARIO(
279
338
{
280
339
REQUIRE (symbol_table.has_symbol (" java::Parent9.x" ));
281
340
}
341
+ THEN (" Static field 'Parent9.x' should be declared by class Parent9" )
342
+ {
343
+ REQUIRE (
344
+ id2string (*declaring_class (
345
+ symbol_table.lookup_ref (" java::Parent9.x" ))) == " java::Parent9" );
346
+ }
282
347
THEN (" A static field StaticInterface9.x should exist" )
283
348
{
284
349
REQUIRE (symbol_table.has_symbol (" java::StaticInterface9.x" ));
285
350
}
351
+ THEN (" Static field 'Parent8.x' should be declared by StaticInterface9" )
352
+ {
353
+ REQUIRE (
354
+ id2string (*declaring_class (symbol_table.lookup_ref (
355
+ " java::StaticInterface9.x" ))) == " java::StaticInterface9" );
356
+ }
286
357
THEN (" No static field 'Test9.x' should be created" )
287
358
{
288
359
REQUIRE (!symbol_table.has_symbol (" java::Test9.x" ));
0 commit comments