Test a function: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: made REXX 2nd version compliant, changed to the use of a '''output''' template. -- ~~~~)
Line 1,015: Line 1,015:
===stress REXX keywords (used as variables)===
===stress REXX keywords (used as variables)===
{This was originally written in some form of FORTRAN.}
{This was originally written in some form of FORTRAN.}
<lang rexx>/* This REXX uses a lot of REXX keywords as variables. */
<lang rexx>
/* This REXX uses a lot of REXX keywords as variables. */


signal=(interpret=value);value=(interpret<parse);do upper=value to value
signal=(interpret=value);value=(interpret<parse);do upper=value to value
Line 1,025: Line 1,024:
say''say;end;do otherwise=value to then;pull=pull center(if.otherwise,,
say''say;end;do otherwise=value to then;pull=pull center(if.otherwise,,
length(return));end;say pull;do otherwise=value to exit;with.otherwise=,
length(return));end;say pull;do otherwise=value to exit;with.otherwise=,
if.otherwise;end;end
if.otherwise;end;end</lang>
'''output'''
</lang>
<pre style="overflow:scroll">
Output:
<pre style="height:40ex;overflow:scroll">
1
1
1 1
1 1
Line 1,045: Line 1,043:
===stress test some REXX BIFs===
===stress test some REXX BIFs===
This stress tests some of the REXX built-in functions (BIFs).
This stress tests some of the REXX built-in functions (BIFs).
<lang rexx>?/*REXX program to show a secret message. */
<lang rexx>
/*secret message*/
z.=' ';z=12-25-2002;y=z;w=-y
z.=' ';z=12-25-2002;y=z;w=-y
z.0=translate(right(time('c'),substr(z,4,z==y)))
z.0=translate(right(time('c'),substr(z,4,z==y)))
Line 1,064: Line 1,061:
say
say
say z.32
say z.32
say
say</lang>
'''output'''
</lang>
<pre style="overflow:scroll">
Output:
<pre style="height:10ex;overflow:scroll">


MERRY CHRISTMAS
MERRY CHRISTMAS


</pre>
</pre>
Because the REXX language is interpreted, many REXX stress tests are "simple" programs like those listed above, albetit highly obfuscated.
Because the REXX language is interpreted, many REXX stress tests are "simple" programs like those listed above, albetit highly obfuscated.


=={{header|Ruby}}==
=={{header|Ruby}}==