Changeset 37192 in project


Ignore:
Timestamp:
02/02/19 15:53:03 (3 months ago)
Author:
juergen
Message:

checks 1.1 docu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/checks

    r37165 r37192  
    1212procedures, because I didn't want an extra parameter with the argument's
    1313or result's name.
     14Procedure versions of those macros are given as well.
    1415In reimplementing those routines, I changed the syntax a bit, so be
    15 careful, if you used the eqally named routines from simple-expressions.
     16careful, if you used the equally named routines from simple-expressions.
    1617
    1718=== Interface
     19
     20The precondition and postcondition checks are denoted with some
     21consecutive symbols < and > respectively. There are macro and procedure
     22versions, the latter denoted with a trailing % and needing an additional
     23parameter, the name of the value to be checked. All those routines work
     24the same, they differ only in the error message, they produce in case
     25some predicate returns #f. The routines named with three symbols < or >
     26differ from those with two only by an additional parameter naming the
     27location of the checks.
    1828
    1929==== assert*
     
    5969otherwise an error message with the offending predicate is printed.
    6070
     71==== <<<%
     72
     73<procedure>(<<<% loc name arg arg? ...)</procedure>
     74
     75precondition test:
     76returns arg unchanged only if all predicates arg? return #t on it,
     77otherwise an error message with the offending predicate and the
     78location loc as well as arg's name is printed.
     79
     80==== <<%
     81
     82<procedure>(<<% name arg arg? ...)</procedure>
     83
     84precondition test:
     85returns arg unchanged only if all predicates arg? return #t on it,
     86otherwise an error message with the offending predicate as well as
     87arg's name is printed.
     88
     89==== >>>%
     90
     91<procedure>(>>>% loc name result result? ...)</procedure>
     92
     93postcondition test:
     94returns result unchanged only if all predicates result? return #t on it,
     95otherwise an error message with the offending predicate and the
     96location loc as well as result's name is printed.
     97
     98==== >>%
     99
     100<procedure>(>>% name result result? ...)</procedure>
     101
     102postcondition test:
     103passes result unchanged only if all predicates result? return #t on it
     104otherwise an error message with the offending predicate as well as
     105result's name is printed.
     106
    61107==== true?
    62108
     
    84130; -> error
    85131
     132(<<< 'loc x positive? even?)
     133; -> error message with predicate even?, location 'loc and name 'x
     134
     135(<<<% 'loc 'x x positive? even?)
     136; -> error message with predicate even?, location 'loc and name 'x
    86137
    87138== Last update
    88139
    89 Jan 30, 2019
     140Feb 02, 2019
    90141
    91142== Author
     
    126177== Version History
    127178
     179; 1.1 : procedure versions added
    128180; 1.0 : extracted and modified from simple-exceptions
    129181
Note: See TracChangeset for help on using the changeset viewer.