X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=tests%2F_verify_field_syntax.qc;fp=tests%2F_verify_field_syntax.qc;h=93ea14eeeba4504942c5df3856f986c383d8dbd6;hp=0000000000000000000000000000000000000000;hb=2ce3fb0be5efe675d6910ba7a4a8165d0272f731;hpb=94c2936bfad224529cf326d539a5cdac0a286183 diff --git a/tests/_verify_field_syntax.qc b/tests/_verify_field_syntax.qc new file mode 100644 index 0000000..93ea14e --- /dev/null +++ b/tests/_verify_field_syntax.qc @@ -0,0 +1,54 @@ +void (string str, ...) print = #1; +string (float val) ftos = #2; +entity () spawn = #3; +void (entity ent) kill = #4; +string (vector vec) vtos = #5; +void (string str) error = #6; +float (vector vec) vlen = #7; +string (entity ent) etos = #8; +float (string str) stof = #9; +string (...) strcat = #10; +float (string str1, string str2) strcmp = #11; +vector (vector vec) normalize = #12; +float (float val) sqrt = #13; +float (float val) floor = #14; +float (float val1, float val2) pow = #15; +vector (string str) stov = #16; + +void p() { + print("\n"); +} + +void pn(float n) { + print(ftos(n), "\n"); +} + +// ====================================== + +.float x, y; + +const .float mine, his = mine; + +void pe(entity e) { + print(ftos(e.x), ftos(e.y), ftos(e.mine), ftos(e.his), "\n"); +} + +void main() { + entity e = spawn(); + + pe(e); + .float x_bak = x; + e.x = 1; + e.y = 2; + e.mine = 3; + pn(e.x_bak); + pe(e); + x = y; + .float pf = mine; + pn(e.pf); + pe(e); + e.his = 4; + x = x_bak; + pn(e.pf); + pe(e); +}