|
| 1 | +/*******************************************************************\ |
| 2 | +
|
| 3 | + Module: Unit tests for parsing generic classes |
| 4 | +
|
| 5 | + Author: DiffBlue Limited. All rights reserved. |
| 6 | +
|
| 7 | +\*******************************************************************/ |
| 8 | + |
| 9 | +#include <catch.hpp> |
| 10 | + |
| 11 | +#include <util/config.h> |
| 12 | +#include <util/cmdline.h> |
| 13 | +#include <util/language.h> |
| 14 | +#include <util/prefix.h> |
| 15 | + |
| 16 | +#include <java_bytecode/java_bytecode_language.h> |
| 17 | + |
| 18 | +#include <iostream> |
| 19 | +#include <src/java_bytecode/load_java_class.h> |
| 20 | + |
| 21 | +SCENARIO( |
| 22 | + "java_bytecode_parse_generic_function", |
| 23 | + "[core][java_bytecode][java_bytecode_parse_generics]") |
| 24 | +{ |
| 25 | + const symbol_tablet &new_symbol_table= |
| 26 | + load_java_class( |
| 27 | + "GenericFunctions", |
| 28 | + "./java_bytecode/java_bytecode_parse_generics"); |
| 29 | + |
| 30 | + std::string class_prefix="java::GenericFunctions"; |
| 31 | + THEN("There should be a symbol for processSimpleGeneric") |
| 32 | + { |
| 33 | + const std::string func_name=".processSimpleGeneric"; |
| 34 | + const std::string func_descriptor=":(LSimpleGeneric;)V"; |
| 35 | + const std::string process_func_name=class_prefix+func_name+func_descriptor; |
| 36 | + |
| 37 | + REQUIRE(new_symbol_table.has_symbol(process_func_name)); |
| 38 | + } |
| 39 | + |
| 40 | + THEN("There should be a symbol for processUpperBoundInterfaceGeneric") |
| 41 | + { |
| 42 | + const std::string func_name=".processUpperBoundInterfaceGeneric"; |
| 43 | + const std::string func_descriptor=":(LSimpleGeneric;)V"; |
| 44 | + const std::string process_func_name=class_prefix+func_name+func_descriptor; |
| 45 | + |
| 46 | + REQUIRE(new_symbol_table.has_symbol(process_func_name)); |
| 47 | + } |
| 48 | + |
| 49 | + THEN("There should be a symbol for processUpperBoundClassGeneric") |
| 50 | + { |
| 51 | + const std::string func_name=".processUpperBoundClassGeneric"; |
| 52 | + const std::string func_descriptor=":(LSimpleGeneric;)V"; |
| 53 | + const std::string process_func_name=class_prefix+func_name+func_descriptor; |
| 54 | + |
| 55 | + REQUIRE(new_symbol_table.has_symbol(process_func_name)); |
| 56 | + } |
| 57 | + |
| 58 | + THEN("There should be a symbol for processDoubleUpperBoundClassGeneric") |
| 59 | + { |
| 60 | + const std::string func_name=".processDoubleUpperBoundClassGeneric"; |
| 61 | + const std::string func_descriptor=":(LSimpleGeneric;)V"; |
| 62 | + const std::string process_func_name=class_prefix+func_name+func_descriptor; |
| 63 | + |
| 64 | + REQUIRE(new_symbol_table.has_symbol(process_func_name)); |
| 65 | + } |
| 66 | + |
| 67 | + THEN("There should be a symbol for processDoubleUpperBoundInterfaceGeneric") |
| 68 | + { |
| 69 | + const std::string func_name=".processDoubleUpperBoundInterfaceGeneric"; |
| 70 | + const std::string func_descriptor=":(LSimpleGeneric;)V"; |
| 71 | + const std::string process_func_name=class_prefix+func_name+func_descriptor; |
| 72 | + |
| 73 | + REQUIRE(new_symbol_table.has_symbol(process_func_name)); |
| 74 | + } |
| 75 | +} |
0 commit comments