|
| 1 | +/*******************************************************************\ |
| 2 | +
|
| 3 | + Module: Unit tests for parsing generic classes |
| 4 | +
|
| 5 | + Author: DiffBlue Limited. All rights reserved. |
| 6 | +
|
| 7 | +\*******************************************************************/ |
| 8 | + |
| 9 | +#include <testing-utils/catch.hpp> |
| 10 | +#include <testing-utils/require_symbol.h> |
| 11 | +#include <testing-utils/require_type.h> |
| 12 | + |
| 13 | +#include <util/cmdline.h> |
| 14 | +#include <util/config.h> |
| 15 | +#include <util/language.h> |
| 16 | +#include <util/prefix.h> |
| 17 | +#include <util/std_types.h> |
| 18 | + |
| 19 | +#include <java_bytecode/java_bytecode_language.h> |
| 20 | + |
| 21 | +#include <iostream> |
| 22 | +#include <testing-utils/load_java_class.h> |
| 23 | + |
| 24 | +SCENARIO( |
| 25 | + "java_bytecode_parse_generic_inner_class", |
| 26 | + "[core][java_bytecode][java_bytecode_parse_generics]") |
| 27 | +{ |
| 28 | + const symbol_tablet &new_symbol_table = load_java_class( |
| 29 | + "GenericClass", "./java_bytecode/java_bytecode_parse_generics"); |
| 30 | + |
| 31 | + std::string class_prefix = "java::GenericClass"; |
| 32 | + THEN("There should be a symbol for GenericClass") |
| 33 | + { |
| 34 | + REQUIRE(new_symbol_table.has_symbol(class_prefix)); |
| 35 | + const symbolt &class_symbol = new_symbol_table.lookup_ref(class_prefix); |
| 36 | + |
| 37 | + const class_typet &class_type = |
| 38 | + require_symbol::require_complete_class(class_symbol); |
| 39 | + |
| 40 | + THEN("The field component should be a pointer to GenericClass$InnerClass") |
| 41 | + { |
| 42 | + const struct_typet::componentt &field_component = |
| 43 | + require_type::require_component(class_type, "field"); |
| 44 | + |
| 45 | + require_type::require_pointer( |
| 46 | + field_component.type(), symbol_typet("java::GenericClass$InnerClass")); |
| 47 | + } |
| 48 | + } |
| 49 | +} |
0 commit comments