From: Dale Weiler Date: Thu, 10 Jan 2013 20:50:42 +0000 (+0000) Subject: Better enumeration test X-Git-Tag: before-library~313 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f6197a965c55ddd0ba423b6ad7e1aa72b3c623d3;p=xonotic%2Fgmqcc.git Better enumeration test --- diff --git a/tests/enum.qc b/tests/enum.qc index 39b4196..5218633 100644 --- a/tests/enum.qc +++ b/tests/enum.qc @@ -1,25 +1,47 @@ -void(string, ...) print = #1; -string(float) ftos = #2; +void(string, ...) print = #1;enum { + // this behaviour is confusing, but I like that + // we support it. + __ = (__ - 1), + A = (__ + 1), + + B, + C +}; enum { - FOO, - BAR, - BAZ, - OMG = BAR, - POO, - LAST = OMG + POO + D = C + B, + E = C + C, + F = C + D, }; -enum {A}; -enum {B=A+1}; -enum {C=A}; +enum { + G = (B + F), H = (C + F), + I = (D + F), J = (B + I) +}; +enum { + K = A + B - C + D - E + F * + G - H + I - J + A - B - + J + A, + L, + M, + N +}; +void (string, ...) print = #1; +string (float) ftos = #2; void main() { - print(ftos(FOO), "\n"); - print(ftos(BAR), "\n"); - print(ftos(BAZ), "\n"); - print(ftos(OMG), "\n"); - print(ftos(POO), "\n"); - print(ftos(LAST), "\n"); + print(ftos(A), "\n"); + print(ftos(B), "\n"); print(ftos(C), "\n"); -} + print(ftos(D), "\n"); + print(ftos(E), "\n"); + print(ftos(F), "\n"); + print(ftos(G), "\n"); + print(ftos(H), "\n"); + print(ftos(I), "\n"); + print(ftos(J), "\n"); + print(ftos(K), "\n"); + print(ftos(L), "\n"); + print(ftos(M), "\n"); + print(ftos(N), "\n"); +}; diff --git a/tests/enum.tmpl b/tests/enum.tmpl index 11ef9e8..28cbd57 100644 --- a/tests/enum.tmpl +++ b/tests/enum.tmpl @@ -5,7 +5,14 @@ C: -std=fteqcc M: 0 M: 1 M: 2 -M: 1 -M: 2 M: 3 -M: 0 +M: 4 +M: 5 +M: 6 +M: 7 +M: 8 +M: 9 +M: 10 +M: 11 +M: 12 +M: 13