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