]> git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/enum.qc
fix __builtin_nan and add some missing builtins
[xonotic/gmqcc.git] / tests / enum.qc
1 enum {
2     // this behaviour is confusing, but I like that
3     // we support it.
4     __ = (__ - 1),
5     A  = (__ + 1),
6
7     B,
8     C
9 };
10
11 enum {
12     D = C + B,
13     E = C + C,
14     F = C + D,
15 };
16
17 enum {
18     G = (B + F), H = (C + F),
19     I = (D + F), J = (B + I)
20 };
21 enum {
22     K = A + B - C + D - E + F *
23         G - H + I - J + A - B -
24         J + A,
25     L,
26     M,
27     N
28 };
29
30 enum : flag {
31     F1, /* = 1 << 1 */
32     F2, /* = 1 << 2 */
33     F3  /* = 1 << 3 */
34 };
35
36 /* reversed enumeration */
37 enum : reverse {
38     R1, // 3
39     R2, // 2
40     R3, // 1
41     R4  // 0
42 };
43
44 void main() {
45     print(ftos(A), "\n");
46     print(ftos(B), "\n");
47     print(ftos(C), "\n");
48     print(ftos(D), "\n");
49     print(ftos(E), "\n");
50     print(ftos(F), "\n");
51     print(ftos(G), "\n");
52     print(ftos(H), "\n");
53     print(ftos(I), "\n");
54     print(ftos(J), "\n");
55     print(ftos(K), "\n");
56     print(ftos(L), "\n");
57     print(ftos(M), "\n");
58     print(ftos(N), "\n");
59
60     print(ftos(F1), "\n");
61     print(ftos(F2), "\n");
62     print(ftos(F3), "\n");
63
64     print(ftos(R1), "\n");
65     print(ftos(R2), "\n");
66     print(ftos(R3), "\n");
67     print(ftos(R4), "\n");
68 };