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