DECLARE int $i
DECLARE int $j
DECLARE string $s
DECLARE double $d

GOTO goon
! regression/common/sayfail 'GOTO'
QUIT
:goon
! regression/common/sayok 'GOTO'

IF 0 ! regression/common/sayfail 'IF 0'
ELSE ! regression/common/sayok 'IF 0'
IF 1 ! regression/common/sayok 'IF 1'
ELSE ! regression/common/sayfail 'IF 1'

CECHO ${$i=1}${$j=0}
{ while ${$i<5}
	CECHO ${$j+=$i+1}
} while ${$i++} 1
IF ${$j==14} ! regression/common/sayok 'while'
ELSE	     ! regression/common/sayfail 'while'

CECHO ${$i=1,$j=0}
{ dowhile 1
	CECHO ${$j+=i+1}
} dowhile ${$i++} ${$i<1}
IF ${$j==1} ! regression/common/sayok 'do while'
ELSE	    ! regression/common/sayfail 'do while'

CECHO ${$i=1}${$j=0}
{ while2 ${$i<5}
	CECHO ${$j+=$i+1}
	BREAK
} while2 ${$i++} 1
IF ${$j==2} ! regression/common/sayok 'BREAK'
ELSE	    ! regression/common/sayfail 'BREAK'

CECHO ${$i=1}${$j=0}
{ while3 ${$i<5}
	CONTINUE
	CECHO ${$j+=$i+1}
} while3 ${$i++} 1
IF ${$j==0&&$i==5} ! regression/common/sayok 'CONTINUE'
ELSE		   ! regression/common/sayfail 'CONTINUE'

VARFROMPROCESS s echo honk
IF ${$s=="honk"} ! regression/common/sayok 'VARFROMPROCESS'
ELSE		 ! regression/common/sayfail 'VARFROMPROCESS'

CECHO ${$d=$root.func.system.time.gettime()}
USLEEP 1000000
CECHO ${$d=$root.func.system.time.gettime()-$d}
IF ${$d>0.9&&$d<1.3}	! regression/common/sayok 'USLEEP'
ELSE			! regression/common/sayfail 'USLEEP'

UNDECLARE $i
IF ${$i==(void)0}	! regression/common/sayok 'UNDCLARE'
ELSE			! regression/common/sayfail 'UNDCLARE'

QUIT
# if we get here, quit didn't work.
! regression/common/sayfail 'QUIT'
