Skip to content

Commit 44a5dcb

Browse files
author
thk123
committed
Adding check for inheritance
1 parent 28bfc37 commit 44a5dcb

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
@@ -14,6 +14,7 @@
1414
#include <testing-utils/run_test_with_compilers.h>
1515
#include <testing-utils/require_symbol.h>
1616
#include <util/expr_iterator.h>
17+
#include <goto-programs/class_hierarchy.h>
1718

1819
struct lambda_assignment_test_datat
1920
{
@@ -85,6 +86,24 @@ void validate_lamdba_assignement(
8586
require_type::require_complete_class(lambda_implementor_type_symbol.type);
8687

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

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

0 commit comments

Comments
 (0)