diff options
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn')
13 files changed, 378 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60000-functions.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60000-functions.pawn new file mode 100644 index 00000000..853c70ad --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60000-functions.pawn @@ -0,0 +1,32 @@ + +// prototypes +forward bar(); +native baz(); +foo(); + +enum rect { left, top, right, bottom } +native intersect[rect](src1[rect], src2[rect]); + +native getparam(a[], b[], size) = host_getparam; + +// function w/o brace +main() +{ + printf("hello\n"); +} +foo() +{ + bar(); +} + +stock ts_is_waiting(id) +{ + return(ts_get_message(id) == TSMSG_WAITING); +} + +// regular old functions +baz() +{ + do_something(); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60001-comment.p b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60001-comment.p new file mode 100644 index 00000000..f63deb62 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60001-comment.p @@ -0,0 +1,46 @@ +/* parse C comments interactively, using events and a state machine */ +main() +{ + state plain; +} +@keypressed(key) <plain> +{ + state (key == '/') slash; + if (key != '/') { + echo key; + } +} +@keypressed(key) <slash> +{ + state (key != '/') plain; + state (key == '*') comment; + echo '/'; /* print '/' held back from previous state */ + if (key != '/') { + echo key; + } +} +@keypressed(key) <comment> +{ + echo key; + state (key == '*') star; +} +@keypressed(key) <star> +{ + echo key; + state (key != '*') comment; + state (key == '/') plain; +} +echo(key) <plain, slash> +{ + printchar key, yellow; +} +echo(key) <comment, star> +{ + printchar key, green; +} +printchar(ch, colour) +{ + setattr .foreground = colour; + printf "%c", ch; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60002-traffic.p b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60002-traffic.p new file mode 100644 index 00000000..a902e497 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60002-traffic.p @@ -0,0 +1,52 @@ +/* traffic light synchronizer, using states in an event-driven model */ +#include <time> +main() +{ + state green_wait; +} +@keypressed(key) <green_wait> +{ + state yellow_wait; +} +@keypressed(key) <red_walk, red_wait> +{ + state red_walk; +} +@keypressed(key) <> +{ +} /* fallback */ +@timer() <yellow_wait> +{ + state red_walk; +} +@timer() <red_walk> +{ + state red_wait; +} +@timer() <red_wait> +{ + state green_wait; +} +@timer() <> +{ +} /* fallback */ +entry() <green_wait> +{ + print "Green / Don't walk\n"; +} +entry() <yellow_wait> +{ + print "Yellow / Don't walk\n"; + settimer 2000; +} +entry() <red_walk> +{ + print "Red / Walk\n"; + settimer 5000; +} +entry() <red_wait> +{ + print "Red / Don't walk\n"; + settimer 2000; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60003-tags.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60003-tags.pawn new file mode 100644 index 00000000..b21f7679 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60003-tags.pawn @@ -0,0 +1,69 @@ + +enum token +{ + t_type, + Rational:t_value, + t_word[20], +} + + +new bool:flag = true; /* "flag" can only hold "true" or "false" */ +const error:success = 0; +const error:fatal= 1; +const error:nonfatal = 2; +error:errno = fatal; + +native printf(const format[], { Float, _ }: ...); + +new Float:chance_to_avoid = (p_resists[id][RESISTIDX_FIRE] >= RESIST_MAX_VALUE) ? + 1.00 : (float( p_resists[id][RESISTIDX_FIRE] ) / float( RESIST_MAX_VALUE )); + +xplevel_lev[j] = XP_PER_LEVEL_BASE_LT + ( (j - 10) * XP_PER_LEVEL_LT) + + floatround( float( j / 20 ) * XP_PER_LEVEL_LT ); + + +main() +{ + new Float:xpos; + new Float:ypos; + + new apple:elstar; /* variable "elstar" with tag "apple" */ + new orange:valencia; /* variable "valencia" with tag "orange" */ + new x; /* untagged variable "x" */ + elstar = valencia; /* tag mismatch */ + elstar = x; /* tag mismatch */ + x = valencia; /* ok */ + + new Float:chance_to_avoid = (p_resists[id][RESISTIDX_FIRE] >= RESIST_MAX_VALUE) ? + 1.00 : (float( p_resists[id][RESISTIDX_FIRE] ) / float( RESIST_MAX_VALUE )); + + xplevel_lev[j] = XP_PER_LEVEL_BASE_LT + ( (j - 10) * XP_PER_LEVEL_LT) + + floatround( float( j / 20 ) * XP_PER_LEVEL_LT ); + + if (apple:valencia < elstar) { + valencia = orange:elstar; + } + +some_label: // target for a goto + #pragma rational Float + + new Float:limit = -5.0; + new Float:value = -1.0; + if (value < limit) { + printf("Value %f below limit %f\n", _:value, _:limit); + } else { + printf("Value above limit\n"); + } + goto some_label; +} + +foo() +{ + if (ape) { + dofunc(1); + } else if (monkey) { + dofunc(2); + } else { + dofunc(3); + } +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60004-enum.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60004-enum.pawn new file mode 100644 index 00000000..7dd318f3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60004-enum.pawn @@ -0,0 +1,91 @@ + +enum rect { left, top, right, bottom } + +enum boot(<<= 1) { a=1, b, c, d } + +enum booty(<<= 1) +{ + a=1, b, c, d +} + +forward addvector(a[], const b[], size); + +enum message { + text[40 char], + priority +} + +enum token +{ + t_type, + Rational:t_value, + t_word[20], +} + +new bool:flag = true; + +increment(&value, incr=1) +{ + value += incr; +} + +new msg[message] = { !"My Text", 1 }; +main() +{ + new my_rect[rect]; + + my_rect[left] = 10; + my_rect[right] = 100; + my_rect[top] = 10; + my_rect[bottom] = 100; + + for (new i = 0; rect:i < rect; i++) { + my_rect[rect:i] *= 2; + } + + new vect[3] = { 1, 2, 3 }; + addvector(vect, { 5, 5, 5 }, 3); + + new Float:xpos; + new Float:ypos; + + new a = 5; + increment(a); + increment(a, _); + increment(a, 1); +} + +sum(a, b) +{ + return a + b; +} + +power(x, y) +{ + /* returns x raised to the power of y */ + assert y >= 0; + new r = 1; + for (new i = 0; i < y; i++) { + r *= x; + } + return r; +} + +addvector(a[], const b[], size) +{ + for (new i = 0; i < size; i++) { + a[i] += b[i]; + } +} + +stock remove_filepath(szFilePath[], szFile[], pMax) +{ + new len = strlen(szFilePath); + + while ((--len >= 0) && (szFilePath[len] != '/') && + (szFilePath[len] != '\'')) { } + + copy(szFile, pMax, szFilePath[len + 1]); + + return; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60005-unbraced.p b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60005-unbraced.p new file mode 100644 index 00000000..1a22a3af --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60005-unbraced.p @@ -0,0 +1,15 @@ + +public eBombPickUp(id) +{ + if (BombPickUp) { + announceEvent(id, "PICKED_BOMB"); + } +} + +stock Float:operator-(Float:oper) +{ + return oper ^ Float:((-1) ^ ((-1) / 2)); /* IEEE values are sign/magnitude */ +} + +native Float:floatadd( Float:dividend, Float:divisor ); +native Result:dbi_query( Sql:_sql, _query[], { Float, _ }: ... ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60010-str-escape.p b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60010-str-escape.p new file mode 100644 index 00000000..3aa54453 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60010-str-escape.p @@ -0,0 +1,6 @@ +main() +{ + printf "This is a testof the ^" alternate escape char, value 0x5e"; + printf "If ^" it doesn't work, there ^"should be some errors"; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60020-switch-vsemi.sma b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60020-switch-vsemi.sma new file mode 100644 index 00000000..a0c720f7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60020-switch-vsemi.sma @@ -0,0 +1,16 @@ +public plugin_init()
+{
+ new i=5;
+
+ switch(i) {
+ case 3: return false;
+ case 5:
+ {
+ i = 6;
+ return true;
+ }
+ default: {
+ return true;
+ }
+ }
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60030-crusty_ex-1.sma b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60030-crusty_ex-1.sma new file mode 100644 index 00000000..23e042dd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60030-crusty_ex-1.sma @@ -0,0 +1,28 @@ +public hudtext16(textblock[], colr, colg, colb, posx, posy, screen, time, id) +{ + new y; + if (contain(textblock, "^n") == -1) // if there is no linebreak in the text, we can just show it as it is + { + set_hudmessage(colr, colg, colb, float(posx) / 1000.0, float(posy) / 1000.0, 0, 6.0, float(time), 0.2, 0.2, screen); + show_hudmessage(id, textblock); + } + else // more than one line + { + new out[128], rowcounter = 0, tmp[512], textremain = true; y = screen; + + new i = contain(textblock, "^n"); + + do + { + } + while (textremain > 0); + + copy(out, i, textblock); // we need to get the first line of text before the loop + + do + { + } + while (textremain); + } + return screen - y; // we will return how many screens of text we printed +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60040-preproc.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60040-preproc.pawn new file mode 100644 index 00000000..6df8101f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60040-preproc.pawn @@ -0,0 +1,7 @@ +#define SetTeleType(%1,%2) set_pev(%1, pev_iuser1, %2) +#define SetTeleMate(%1,%2) set_pev(%1, pev_iuser2, %2*7) + +#define x(%0,%1) \ + y(%1, %0) + +#emit CONST.pri 1911 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60050-gh419.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60050-gh419.pawn new file mode 100644 index 00000000..9db7b08f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60050-gh419.pawn @@ -0,0 +1,8 @@ +#if AMXX_VERSION_NUM < 183 +public client_disconnect( player_id ) +#else +public client_disconnected( player_id ) +#endif +{ + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60100-Issue_2586.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60100-Issue_2586.pawn new file mode 100644 index 00000000..e3eed47c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60100-Issue_2586.pawn @@ -0,0 +1,5 @@ +static stock const data[][] = +{ + {0b00000011001111000010011100000000, 0b00000011001111000010011100000000}, + {0b00000011001111000010011100000000, 0b00000011001111000010011100000000} +};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60101-Issue_2665.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60101-Issue_2665.pawn new file mode 100644 index 00000000..90fcbd07 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/expected/pawn/60101-Issue_2665.pawn @@ -0,0 +1,3 @@ +static Entrypoint() +{ +}
\ No newline at end of file |