Skip to content

Commit e3019f2

Browse files
author
svorenova
committed
Extending test for derived generics
1 parent f5ec45a commit e3019f2

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed
Binary file not shown.

unit/java_bytecode/java_bytecode_parse_generics/DerivedGeneric.java

Lines changed: 0 additions & 4 deletions
This file was deleted.
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class DerivedGenericInst extends Generic<Interface_Implementation>
2+
{
3+
4+
}
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class DerivedGenericUninst<T> extends Generic<T>
2+
{
3+
4+
}

unit/java_bytecode/java_bytecode_parse_generics/parse_derived_generic_class.cpp

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,47 @@
88

99
#include <testing-utils/catch.hpp>
1010
#include <testing-utils/load_java_class.h>
11-
12-
#include <util/config.h>
13-
#include <util/language.h>
14-
#include <java_bytecode/java_bytecode_language.h>
15-
#include <iostream>
11+
#include <testing-utils/require_type.h>
1612

1713
SCENARIO(
18-
"parse_derived_generic_class",
14+
"parse_derived_generic_class_inst",
1915
"[core][java_bytecode][java_bytecode_parse_generics]")
2016
{
2117
const symbol_tablet &new_symbol_table = load_java_class(
22-
"DerivedGeneric", "./java_bytecode/java_bytecode_parse_generics");
18+
"DerivedGenericInst", "./java_bytecode/java_bytecode_parse_generics");
2319

24-
THEN("There should be a symbol for the DerivedGeneric class")
20+
THEN("There should be a symbol for the DerivedGenericInst class")
2521
{
26-
std::string class_prefix = "java::DerivedGeneric";
22+
std::string class_prefix = "java::DerivedGenericInst";
2723
REQUIRE(new_symbol_table.has_symbol(class_prefix));
2824

2925
const symbolt &derived_symbol = new_symbol_table.lookup_ref(class_prefix);
30-
derived_symbol.show(std::cout);
3126
const class_typet &derived_class_type =
32-
require_symbol::require_complete_class(derived_symbol);
27+
require_type::require_java_non_generic_class(derived_symbol.type);
28+
29+
// TODO: Currently we do not support extracting information
30+
// about the base classes generic information - issue TG-1287
31+
}
32+
}
33+
34+
SCENARIO(
35+
"parse_derived_generic_class_uninst",
36+
"[core][java_bytecode][java_bytecode_parse_generics]")
37+
{
38+
const symbol_tablet &new_symbol_table = load_java_class(
39+
"DerivedGenericUninst", "./java_bytecode/java_bytecode_parse_generics");
40+
41+
THEN("There should be a symbol for the DerivedGenericUninst class")
42+
{
43+
std::string class_prefix = "java::DerivedGenericUninst";
44+
REQUIRE(new_symbol_table.has_symbol(class_prefix));
45+
46+
const symbolt &derived_symbol = new_symbol_table.lookup_ref(class_prefix);
47+
const java_generics_class_typet &derived_class_type =
48+
require_type::require_java_generic_class(
49+
derived_symbol.type, {class_prefix + "::T"});
3350

34-
// TODO(tkiley): Currently we do not support extracting information
51+
// TODO: Currently we do not support extracting information
3552
// about the base classes generic information - issue TG-1287
3653
}
3754
}

0 commit comments

Comments
 (0)