1 module ut.translation.type.primitives; 2 3 4 import ut.translation.type; 5 6 7 @("void") 8 @safe pure unittest { 9 enum translation = translate(Type(Void())); 10 mixin(translation ~ "[] x;"); 11 static assert(is(typeof(x) == void[]), typeof(x).stringof); 12 } 13 14 @("nullptr_t") 15 @safe pure unittest { 16 enum translation = translate(Type(NullPointerT())); 17 mixin(translation ~ " x;"); 18 static assert(is(typeof(x) == void*), typeof(x).stringof); 19 } 20 21 @("bool") 22 @safe pure unittest { 23 enum translation = translate(Type(Bool())); 24 mixin(translation ~ " x;"); 25 static assert(is(typeof(x) == bool), typeof(x).stringof); 26 } 27 28 @("unsigned char") 29 @safe pure unittest { 30 enum translation = translate(Type(UnsignedChar())); 31 mixin(translation ~ " x;"); 32 static assert(is(typeof(x) == ubyte), typeof(x).stringof); 33 } 34 35 @("signed char") 36 @safe pure unittest { 37 enum translation = translate(Type(SignedChar())); 38 mixin(translation ~ " x;"); 39 static assert(is(typeof(x) == byte), typeof(x).stringof); 40 } 41 42 @("char") 43 @safe pure unittest { 44 enum translation = translate(Type(Char())); 45 mixin(translation ~ " x;"); 46 static assert(is(typeof(x) == char), typeof(x).stringof); 47 } 48 49 @("char16_t") 50 @safe pure unittest { 51 enum translation = translate(Type(Char16())); 52 mixin(translation ~ " x;"); 53 static assert(is(typeof(x) == wchar), typeof(x).stringof); 54 } 55 56 @("char32_t") 57 @safe pure unittest { 58 enum translation = translate(Type(Char32())); 59 mixin(translation ~ " x;"); 60 static assert(is(typeof(x) == dchar), typeof(x).stringof); 61 } 62 63 @("wchar_t") 64 @safe pure unittest { 65 enum translation = translate(Type(Wchar())); 66 mixin(translation ~ " x;"); 67 version(Windows) 68 static assert(is(typeof(x) == wchar), typeof(x).stringof); 69 else 70 static assert(is(typeof(x) == dchar), typeof(x).stringof); 71 } 72 73 @("short") 74 @safe pure unittest { 75 enum translation = translate(Type(Short())); 76 mixin(translation ~ " x;"); 77 static assert(is(typeof(x) == short), typeof(x).stringof); 78 } 79 80 @("ushort") 81 @safe pure unittest { 82 enum translation = translate(Type(UnsignedShort())); 83 mixin(translation ~ " x;"); 84 static assert(is(typeof(x) == ushort), typeof(x).stringof); 85 } 86 87 @("int") 88 @safe pure unittest { 89 enum translation = translate(Type(Int())); 90 mixin(translation ~ " x;"); 91 static assert(is(typeof(x) == int), typeof(x).stringof); 92 } 93 94 @("uint") 95 @safe pure unittest { 96 enum translation = translate(Type(UnsignedInt())); 97 mixin(translation ~ " x;"); 98 static assert(is(typeof(x) == uint), typeof(x).stringof); 99 } 100 101 @("long") 102 @safe pure unittest { 103 enum translation = translate(Type(Long())); 104 mixin(translation ~ " x;"); 105 static assert(is(typeof(x) == long), typeof(x).stringof); 106 } 107 108 @("ulong") 109 @safe pure unittest { 110 enum translation = translate(Type(UnsignedLong())); 111 mixin(translation ~ " x;"); 112 static assert(is(typeof(x) == ulong), typeof(x).stringof); 113 } 114 115 @("longlong") 116 @safe pure unittest { 117 enum translation = translate(Type(LongLong())); 118 mixin(translation ~ " x;"); 119 static assert(is(typeof(x) == long), typeof(x).stringof); 120 } 121 122 @("ulonglong") 123 @safe pure unittest { 124 enum translation = translate(Type(UnsignedLongLong())); 125 mixin(translation ~ " x;"); 126 static assert(is(typeof(x) == ulong), typeof(x).stringof); 127 } 128 129 @("float") 130 @safe pure unittest { 131 enum translation = translate(Type(Float())); 132 mixin(translation ~ " x;"); 133 static assert(is(typeof(x) == float), typeof(x).stringof); 134 } 135 136 @("double") 137 @safe pure unittest { 138 enum translation = translate(Type(Double())); 139 mixin(translation ~ " x;"); 140 static assert(is(typeof(x) == double), typeof(x).stringof); 141 } 142 143 @("long double") 144 @safe pure unittest { 145 enum translation = translate(Type(LongDouble())); 146 mixin(translation ~ " x;"); 147 static assert(is(typeof(x) == real), typeof(x).stringof); 148 }