Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Assertions/REXX/assertions-1.rexx
Normal file
24
Task/Assertions/REXX/assertions-1.rexx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* REXX ***************************************************************
|
||||
* There's no assert feature in Rexx. That's how I'd implement it
|
||||
* 10.08.2012 Walter Pachl
|
||||
**********************************************************************/
|
||||
x.=42
|
||||
x.2=11
|
||||
Do i=1 By 1
|
||||
Call assert x.i,42
|
||||
End
|
||||
Exit
|
||||
assert:
|
||||
Parse Arg assert_have,assert_should_have
|
||||
If assert_have\==assert_should_have Then Do
|
||||
Say 'Assertion fails in line' sigl
|
||||
Say 'expected:' assert_should_have
|
||||
Say ' found:' assert_have
|
||||
Say sourceline(sigl)
|
||||
Say 'Look around'
|
||||
Trace ?R
|
||||
Nop
|
||||
Signal Syntax
|
||||
End
|
||||
Return
|
||||
Syntax: Say 'program terminated'
|
||||
15
Task/Assertions/REXX/assertions-2.rexx
Normal file
15
Task/Assertions/REXX/assertions-2.rexx
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/*REXX program implements a simple ASSERT function; the expression can be compound. */
|
||||
a = 1 /*assign a value to the A variable.*/
|
||||
b = -2 /* " " " " " B " */
|
||||
gee = 7.00 /* " " " " " GEE " */
|
||||
zee = 26 /* " " " " " ZEE " */
|
||||
|
||||
call assert (a = 1)
|
||||
call assert (b > 0)
|
||||
call assert (gee = 7)
|
||||
call assert (zee = a & zee>b)
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
assert: if arg(1)=1 then return; parse value sourceline(sigl) with x; say
|
||||
say '===== ASSERT failure in REXX line' sigl", the statement is:"; say '=====' x
|
||||
say; return
|
||||
Loading…
Add table
Add a link
Reference in a new issue