#
# EPIC3 ESL regression tests
# built in functions test
# (C) 1995 Jeremy Nelson, Distribute freely.
#
# NOTE: If you find a test that is missing, please let me know so
# i can add it.  Doubly so if you find a test that exposes a bug!
#

@ misses = 0

alias clear {
	if (misses) {@ [$"[RETURN]"];@ misses = 0}
	//clear
}

alias assert {
	eval @ foo = $*
	if (foo) { echo Test [$[60]{[$*]}] passed }
	         { echo Test [$[60]{[$*]}] FAILED! ;@misses++ }
}

#
# Integer tests
#
set floating_point_math off
assert 3+4==7
assert 3-4==-1
assert 3+4+4==11
#sigh, yes, this is the right value.
assert 3+4-4==3
assert (3+4)-4==3

assert 3*4==12
assert 3/4==0
assert 3%4==3
assert 4%3==1
assert 4/3==1

assert 3##4==34
assert [3]##4==34
assert 3##[4]==34


#
# floating point tests
#
set floating_point_math on
assert 3.0+4.3==7.3
assert 3.0-4.3==-1.3
assert 3.0+4.3+3.4==10.7
#sigh, yes, this is the right value.
assert 3.0+4.3-4.3==3
