-
Notifications
You must be signed in to change notification settings - Fork 1
/
ASSERT
35 lines (25 loc) · 822 Bytes
/
ASSERT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
\ $ld: assert.f 1.1 1994/07/12 15:45:00 andrew Exp $
cr .( Loading the Assert wordset...)
0 value assert?
: ASSERT( ( -<words>- )
assert? 0=
if postpone (
then ; immediate
: ?assert ( flag nfa -- )
swap
if drop
else cr ." Assertion failed in " nfa-count type
cr ." Enter to continue, ESC to abort"
key 0x1B = if abort then cr
then ;
: ) ( -- )
?comp
last @ postpone literal
postpone ?assert ; immediate
\s
true to assert?
: atest ( -- )
10 0
do i .
assert( i 5 < )
loop ;