1
0
Files
irix-657m-src/eoe/cmd/ksh/tests/arith.sh
2022-09-29 17:59:04 +03:00

49 lines
848 B
Bash
Executable File

#
# Copyright (c) 1984,1985,1986,1987,1988,1989,1990 AT&T
# All Rights Reserved
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T.
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
function err_exit
{
print -u2 -n "\t"
print -u2 -r $Command: "$@"
let Errors+=1
}
Command=$0
integer Errors=0
integer x=1 y=2 z=3
if (( 2+2 != 4 ))
then err_exit 2+2!=4
fi
if ((x+y!=z))
then err_exit x+y!=z
fi
if (($x+$y!=$z))
then err_exit $x+$y!=$z
fi
if (((x|y)!=z))
then err_exit "(x|y)!=z"
fi
if ((y >= z))
then err_exit "y>=z"
fi
if ((y+3 != z+2))
then err_exit "y+3!=z+2"
fi
if ((y<<2 != 1<<3))
then err_exit "y<<2!=1<<3"
fi
if ((133%10 != 3))
then err_exit "133%10!=3"
if (( 2.5 != 2.5 ))
then err_exit 2.5!=2.5
fi
fi
exit $((Errors))