4
* A simple test for java demangling. Run it through:
7
* @remark Copyright 2007 OProfile authors
8
* @remark Read the file COPYING
10
* @author Philippe Elie
13
#include "demangle_java_symbol.h"
26
void check_result(string const & input, string const & output,
27
string const & result)
29
if (result != output) {
30
cerr << "for:\n\"" << input << "\"\n"
31
<< "expect:\n\"" << output << "\"\n"
32
<< "found:\n\"" << result << "\"\n";
42
input_output mangle_tests[] = {
43
{ "Ltest$test_1;f2(I)V", "void test$test_1.f2(int)" },
44
{ "Ltest;f4()V", "void test.f4()" },
45
{ "Ltest;f2(II)V", "void test.f2(int, int)" },
46
{ "Ltest$HelloThread;run()V~1", "void test$HelloThread.run()~1" },
47
{ "Lsun/security/provider/SHA;implCompress([BI)V", "void sun.security.provider.SHA.implCompress(byte[], int)" },
48
{ "Ljava/lang/String;equals(Ljava/lang/Object;)Z", "boolean java.lang.String.equals(java.lang.Object)" },
49
{ "Lorg/eclipse/swt/graphics/ImageData;blit(I[BIIIIIIIIIII[BIII[BIIIIIIIIIIZZ)V", "void org.eclipse.swt.graphics.ImageData.blit(int, byte[], int, int, int, int, int, int, int, int, int, int, int, byte[], int, int, int, byte[], int, int, int, int, int, int, int, int, int, int, boolean, boolean)" },
53
} // anonymous namespace
57
input_output const * cur;
58
for (cur = mangle_tests; cur->mangled; ++cur) {
59
string result = demangle_java_symbol(cur->mangled);
60
check_result(cur->mangled, cur->expect, result);