sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

0035-dc.sh (544B)


      1 #!/bin/sh
      2 
      3 tmp=$$.tmp
      4 
      5 trap 'rm -f $tmp' EXIT
      6 trap 'exit $?' HUP INT TERM
      7 
      8 # Test negative number sqrt - should produce error message and push 0
      9 # Test negative numbers: integers, fractions, odd and even fraction digits
     10 $EXEC ../dc <<EOF >$tmp 2>&1
     11 [test 1:]pc _1vp
     12 [test 2:]pc _4vp
     13 [test 3:]pc _.5vp
     14 [test 4:]pc _.25vp
     15 EOF
     16 
     17 diff -u - $tmp <<'EOF'
     18 ../dc: square root of negative number
     19 ../dc: square root of negative number
     20 ../dc: square root of negative number
     21 ../dc: square root of negative number
     22 test 1:
     23 0
     24 test 2:
     25 0
     26 test 3:
     27 0
     28 test 4:
     29 0
     30 EOF