1 #include <gtest/gtest.h> 2 3 #include "Dalvik.h" 4 5 TEST(dvmHumanReadableDescriptor, ArrayReferences) { 6 ASSERT_EQ("java.lang.Class[]", dvmHumanReadableDescriptor("[Ljava/lang/Class;")); 7 ASSERT_EQ("java.lang.Class[][]", dvmHumanReadableDescriptor("[[Ljava/lang/Class;")); 8 } 9 10 TEST(dvmHumanReadableDescriptor, ScalarReferences) { 11 ASSERT_EQ("java.lang.String", dvmHumanReadableDescriptor("Ljava.lang.String;")); 12 ASSERT_EQ("java.lang.String", dvmHumanReadableDescriptor("Ljava/lang/String;")); 13 } 14 15 TEST(dvmHumanReadableDescriptor, PrimitiveArrays) { 16 ASSERT_EQ("boolean[]", dvmHumanReadableDescriptor("[Z")); 17 ASSERT_EQ("boolean[][]", dvmHumanReadableDescriptor("[[Z")); 18 ASSERT_EQ("byte[]", dvmHumanReadableDescriptor("[B")); 19 ASSERT_EQ("byte[][]", dvmHumanReadableDescriptor("[[B")); 20 ASSERT_EQ("char[]", dvmHumanReadableDescriptor("[C")); 21 ASSERT_EQ("char[][]", dvmHumanReadableDescriptor("[[C")); 22 ASSERT_EQ("double[]", dvmHumanReadableDescriptor("[D")); 23 ASSERT_EQ("double[][]", dvmHumanReadableDescriptor("[[D")); 24 ASSERT_EQ("float[]", dvmHumanReadableDescriptor("[F")); 25 ASSERT_EQ("float[][]", dvmHumanReadableDescriptor("[[F")); 26 ASSERT_EQ("int[]", dvmHumanReadableDescriptor("[I")); 27 ASSERT_EQ("int[][]", dvmHumanReadableDescriptor("[[I")); 28 ASSERT_EQ("long[]", dvmHumanReadableDescriptor("[J")); 29 ASSERT_EQ("long[][]", dvmHumanReadableDescriptor("[[J")); 30 ASSERT_EQ("short[]", dvmHumanReadableDescriptor("[S")); 31 ASSERT_EQ("short[][]", dvmHumanReadableDescriptor("[[S")); 32 } 33 34 TEST(dvmHumanReadableDescriptor, PrimitiveScalars) { 35 ASSERT_EQ("boolean", dvmHumanReadableDescriptor("Z")); 36 ASSERT_EQ("byte", dvmHumanReadableDescriptor("B")); 37 ASSERT_EQ("char", dvmHumanReadableDescriptor("C")); 38 ASSERT_EQ("double", dvmHumanReadableDescriptor("D")); 39 ASSERT_EQ("float", dvmHumanReadableDescriptor("F")); 40 ASSERT_EQ("int", dvmHumanReadableDescriptor("I")); 41 ASSERT_EQ("long", dvmHumanReadableDescriptor("J")); 42 ASSERT_EQ("short", dvmHumanReadableDescriptor("S")); 43 } 44