1 module ut.old.type; 2 3 import dpp.from; 4 import dpp.test; 5 import dpp.translation.type; 6 import clang: Type; 7 8 9 string translate(in from!"clang".Type type) @safe { 10 import dpp.translation.type: translate_ = translate; 11 import dpp.runtime.context: Context; 12 Context context; 13 return translate_(type, context); 14 } 15 16 @("void") 17 @safe unittest { 18 Type(Type.Kind.Void).translate.shouldEqual("void"); 19 } 20 21 @("bool") 22 @safe unittest { 23 Type(Type.Kind.Bool).translate.shouldEqual("bool"); 24 } 25 26 @("char_u") 27 @safe unittest { 28 Type(Type.Kind.Char_U).translate.shouldEqual("ubyte"); 29 } 30 31 @("UChar") 32 @safe unittest { 33 Type(Type.Kind.UChar).translate.shouldEqual("ubyte"); 34 } 35 36 @("Char16") 37 @safe unittest { 38 Type(Type.Kind.Char16).translate.shouldEqual("wchar"); 39 } 40 41 @("Char32") 42 @safe unittest { 43 Type(Type.Kind.Char32).translate.shouldEqual("dchar"); 44 } 45 46 @("unsigned short") 47 @safe unittest { 48 Type(Type.Kind.UShort).translate.shouldEqual("ushort"); 49 } 50 51 @("unsigned int") 52 @safe unittest { 53 Type(Type.Kind.UInt).translate.shouldEqual("uint"); 54 } 55 56 @("unsigned long") 57 @safe unittest { 58 Type(Type.Kind.ULong).translate.shouldEqual("c_ulong"); 59 } 60 61 @("unsigned long long") 62 @safe unittest { 63 Type(Type.Kind.ULongLong).translate.shouldEqual("ulong"); 64 } 65 66 @("uint128") 67 @safe unittest { 68 Type(Type.Kind.UInt128).translate.shouldEqual("UInt128"); 69 } 70 71 @("char_s") 72 @safe unittest { 73 Type(Type.Kind.Char_S).translate.shouldEqual("char"); 74 } 75 76 @("SChar") 77 @safe unittest { 78 Type(Type.Kind.SChar).translate.shouldEqual("byte"); 79 } 80 81 @("WChar") 82 @safe unittest { 83 Type(Type.Kind.WChar).translate.shouldEqual("wchar"); 84 } 85 86 @("short") 87 @safe unittest { 88 Type(Type.Kind.Short).translate.shouldEqual("short"); 89 } 90 91 @("int") 92 @safe unittest { 93 Type(Type.Kind.Int).translate.shouldEqual("int"); 94 } 95 96 @("long") 97 @safe unittest { 98 Type(Type.Kind.Long).translate.shouldEqual("c_long"); 99 } 100 101 @("long long") 102 @safe unittest { 103 Type(Type.Kind.LongLong).translate.shouldEqual("long"); 104 } 105 106 @("int128") 107 @safe unittest { 108 Type(Type.Kind.Int128).translate.shouldEqual("Int128"); 109 } 110 111 @("float") 112 @safe unittest { 113 Type(Type.Kind.Float).translate.shouldEqual("float"); 114 } 115 116 @("double") 117 @safe unittest { 118 Type(Type.Kind.Double).translate.shouldEqual("double"); 119 } 120 121 @("long double") 122 @safe unittest { 123 Type(Type.Kind.LongDouble).translate.shouldEqual("real"); 124 } 125 126 @("nullptr") 127 @safe unittest { 128 Type(Type.Kind.NullPtr).translate.shouldEqual("void*"); 129 } 130 131 @("float128") 132 @safe unittest { 133 Type(Type.Kind.Float128).translate.shouldEqual("real"); 134 } 135 136 @("half") 137 @safe unittest { 138 Type(Type.Kind.Half).translate.shouldEqual("float"); 139 }