7
7
8
8
\*******************************************************************/
9
9
10
- #include < map>
11
- #include < string>
12
-
13
10
#include < testing-utils/catch.hpp>
14
11
#include < testing-utils/load_java_class.h>
15
12
#include < testing-utils/require_type.h>
16
-
17
- #include < util/symbol_table.h>
13
+ #include < testing-utils/generic_utils.h>
18
14
19
15
#include < java_bytecode/generate_java_generic_type.h>
20
- #include < testing-utils/require_type.h>
21
- #include < testing-utils/generic_utils.h>
22
16
#include < util/ui_message.h>
23
17
24
- // / Helper function to specalise a generic class from a named component of a
25
- // / named class
26
- // / \param class_name: The name of the class that has a generic component.
27
- // / \param component_name: The name of the generic component
28
- // / \param new_symbol_table: The symbol table to use.
29
- void specialise_generic_from_component (
30
- const irep_idt &class_name,
31
- const irep_idt &component_name,
32
- symbol_tablet &new_symbol_table)
33
- {
34
- const symbolt &harness_symbol = new_symbol_table.lookup_ref (class_name);
35
- const struct_typet::componentt &harness_component =
36
- require_type::require_component (
37
- to_struct_type (harness_symbol.type ), component_name);
38
- generic_utils::specialise_generic (
39
- to_java_generic_type (harness_component.type ()), new_symbol_table);
40
- }
41
-
42
18
SCENARIO (
43
19
" generate_java_generic_type_from_file" ,
44
20
" [core][java_bytecode][generate_java_generic_type]" )
@@ -52,7 +28,7 @@ SCENARIO(
52
28
load_java_class (" generic_two_fields" ,
53
29
" ./java_bytecode/generate_concrete_generic_type" );
54
30
55
- specialise_generic_from_component (
31
+ generic_utils:: specialise_generic_from_component (
56
32
" java::generic_two_fields" , " belem" , new_symbol_table);
57
33
58
34
REQUIRE (new_symbol_table.has_symbol (expected_symbol));
@@ -100,7 +76,7 @@ SCENARIO(
100
76
load_java_class (" generic_two_parameters" ,
101
77
" ./java_bytecode/generate_concrete_generic_type" );
102
78
103
- specialise_generic_from_component (
79
+ generic_utils:: specialise_generic_from_component (
104
80
" java::generic_two_parameters" , " bomb" , new_symbol_table);
105
81
106
82
REQUIRE (new_symbol_table.has_symbol (
@@ -143,9 +119,9 @@ SCENARIO(
143
119
load_java_class (" generic_two_instances" ,
144
120
" ./java_bytecode/generate_concrete_generic_type" );
145
121
146
- specialise_generic_from_component (
122
+ generic_utils:: specialise_generic_from_component (
147
123
" java::generic_two_instances" , " bool_element" , new_symbol_table);
148
- specialise_generic_from_component (
124
+ generic_utils:: specialise_generic_from_component (
149
125
" java::generic_two_instances" , " int_element" , new_symbol_table);
150
126
151
127
REQUIRE (new_symbol_table.has_symbol (first_expected_symbol));
@@ -276,7 +252,7 @@ SCENARIO(
276
252
277
253
WHEN (" We specialise that class from a reference to it" )
278
254
{
279
- specialise_generic_from_component (
255
+ generic_utils:: specialise_generic_from_component (
280
256
harness_class, " genericArrayField" , new_symbol_table);
281
257
THEN (
282
258
" There should be a specialised version of the class in the symbol "
@@ -326,7 +302,7 @@ SCENARIO(
326
302
WHEN (
327
303
" We specialise the class with an array we should have appropriate types" )
328
304
{
329
- specialise_generic_from_component (
305
+ generic_utils:: specialise_generic_from_component (
330
306
harness_class, " genericArrayArrayField" , new_symbol_table);
331
307
THEN (
332
308
" There should be a specialised version of the class in the symbol "
0 commit comments