Skip to content

Commit 31e2af0

Browse files
author
thk123
committed
Adding check for inheritance
1 parent c921de0 commit 31e2af0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

unit/java_bytecode/java_bytecode_convert_method/convert_invoke_dynamic.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <testing-utils/run_test_with_compilers.h>
1616
#include <testing-utils/require_symbol.h>
1717
#include <util/expr_iterator.h>
18+
#include <goto-programs/class_hierarchy.h>
1819

1920
struct lambda_assignment_test_datat
2021
{
@@ -86,6 +87,24 @@ void validate_lamdba_assignement(
8687
require_type::require_complete_class(lambda_implementor_type_symbol.type);
8788

8889
REQUIRE(tmp_lambda_class_type.has_base(test_data.lambda_interface));
90+
REQUIRE(tmp_lambda_class_type.has_base("java::java.lang.Object"));
91+
92+
class_hierarchyt class_hierarchy;
93+
class_hierarchy(symbol_table);
94+
95+
const auto &parents = class_hierarchy.get_parents_trans(tmp_class_identifier);
96+
REQUIRE_THAT(
97+
parents,
98+
Catch::Matchers::Vector::ContainsElementMatcher<irep_idt>{
99+
test_data.lambda_interface});
100+
101+
const auto &interface_children =
102+
class_hierarchy.get_children_trans(test_data.lambda_interface);
103+
104+
REQUIRE_THAT(
105+
interface_children,
106+
Catch::Matchers::Vector::ContainsElementMatcher<irep_idt>{
107+
tmp_class_identifier});
89108

90109
THEN("The function in the class should call the lambda method")
91110
{

0 commit comments

Comments
 (0)