mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
292 lines
7.6 KiB
Plaintext
292 lines
7.6 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
#!/BIN/SH
|
||
#
|
||
# This script tests the Numeric comparison options of the
|
||
# IF directive in shell.
|
||
#
|
||
#
|
||
ECHO "\f\n\n If Numeric Tests"
|
||
ECHO "\n\nThis Performs Several Numeric Comparison Tests"
|
||
ECHO
|
||
ECHO "Begin IF Numeric Tests"
|
||
ECHO
|
||
IF [ -N $Log ]
|
||
ECHO "Begin IF Numeric Tests" >> ${Log}
|
||
ELSE
|
||
SET T = 0
|
||
SET F = 0
|
||
SET P = 0
|
||
FI
|
||
# First test that 2 of the same constants numbers are equal each other.
|
||
SET T = $T + 1
|
||
IF [ 99 -EQ 99 ]
|
||
Echo " Test 1 99 -EQ 99 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 1 99 -EQ 99 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 1 99 -EQ 99 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 1 99 -EQ 99 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Second Test that 2 unique numbers fail -EQ test.
|
||
SET T = $T + 1
|
||
IF [ 99 -EQ 79 ]
|
||
Echo " Test 2 99 -EQ 79 : True : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 2 99 -EQ 79 : True : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 2 99 -EQ 79 : False : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 2 99 -EQ 79 : False : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
FI
|
||
# Third Test Same Number -NE option
|
||
SET T = $T + 1
|
||
IF [ 99 -NE 99 ]
|
||
Echo " Test 3 99 -NE 99 : True : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 3 99 -NE 99 : True : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 3 99 -NE 99 : False : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 3 99 -NE 99 : False : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
FI
|
||
# Forth test different numbers -NE option
|
||
SET T = $T + 1
|
||
IF [ 99 -NE 79 ]
|
||
Echo " Test 4 99 -NE 79 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 4 99 -NE 79 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 4 99 -NE 79 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 4 99 -NE 79 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Fifth Test 99 < 79
|
||
SET T = $T + 1
|
||
IF [ 99 -LT 79 ]
|
||
Echo " Test 5 99 -LT 79 : True : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 5 99 -LT 79 : True : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 5 99 -LT 79 : False : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 5 99 -LT 79 : False : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
FI
|
||
# Sixth Test 79 < 99
|
||
SET T = $T + 1
|
||
IF [ 79 -LT 99 ]
|
||
Echo " Test 6 79 -LT 99 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 6 79 -LT 99 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 6 79 -LT 99 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 6 79 -LT 99 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Seventh Test 99 <= 79
|
||
SET T = $T + 1
|
||
IF [ 99 -LE 79 ]
|
||
Echo " Test 7 99 -LE 79 : True : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 7 99 -LE 79 : True : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 7 99 -LE 79 : False : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 7 99 -LE 79 : False : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
FI
|
||
# Eighth Test 79 <= 99
|
||
SET T = $T + 1
|
||
IF [ 79 -LE 99 ]
|
||
Echo " Test 8 79 -LE 99 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 8 79 -LE 99 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 8 79 -LE 99 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 8 79 -LE 99 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Nineth Test 99 <= 99
|
||
SET T = $T + 1
|
||
IF [ 99 -LE 99 ]
|
||
Echo " Test 9 99 -LE 99 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 9 99 -LE 99 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 9 99 -LE 99 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 9 99 -LE 99 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Tenth Test 99 > 79
|
||
SET T = $T + 1
|
||
IF [ 99 -GT 79 ]
|
||
Echo " Test 10 99 -GT 79 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 10 99 -GT 79 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 10 99 -GT 79 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 10 99 -GT 79 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Eleventh Test 79 > 99
|
||
SET T = $T + 1
|
||
IF [ 79 -GT 99 ]
|
||
Echo " Test 11 79 -GT 99 : True : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 11 79 -GT 99 : True : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 11 79 -GT 99 : False : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 11 79 -GT 99 : False : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
FI
|
||
# Twelveth Test 99 => 79
|
||
SET T = $T + 1
|
||
IF [ 99 -GE 79 ]
|
||
Echo " Test 12 99 -GE 79 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 12 99 -GE 79 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 12 99 -GE 79 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 12 99 -GE 79 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Thirteenth Test 79 => 99
|
||
SET T = $T + 1
|
||
IF [ 79 -GE 99 ]
|
||
Echo " Test 13 79 -GE 99 : True : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 13 79 -GE 99 : True : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 13 79 -GE 99 : False : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 13 79 -GE 99 : False : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
FI
|
||
# Fourteenth Test 99 => 99
|
||
SET T = $T + 1
|
||
IF [ 99 -GE 99 ]
|
||
Echo " Test 14 99 -GE 99 : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 14 99 -GE 99 : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 14 99 -GE 99 : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 14 99 -GE 99 : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Fifteenth Test Dec Var to Constant Int
|
||
SET ABC = 1234.4321
|
||
SET T = $T + 1
|
||
IF [ $ABC -EQ 1234 ]
|
||
Echo " Test 15 Dec Var to Int : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 15 Dec Var to Int : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 15 Dec Var to Int : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 15 Dec Var to Int : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Sixteenth Test Upper Limit Rollover
|
||
SET ABC = 2147483645
|
||
SET DEF = $ABC + 3
|
||
SET T = $T + 1
|
||
IF [ $DEF -EQ -2147483648 ]
|
||
Echo " Test 16 Upper Rollover : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 16 Upper Rollover : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 16 Upper Rollover : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 16 Upper Rollover : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
# Seventeenth Test Lower Limit Rollover
|
||
SET GHI = $DEF - 5
|
||
SET T = $T + 1
|
||
IF [ $GHI -EQ 2147483643 ]
|
||
Echo " Test 17 Lower Rollover : True : PASSED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 17 Lower Rollover : True : PASSED" >> ${Log}
|
||
SET P = $P + 1
|
||
FI
|
||
ELSE
|
||
Echo " Test 17 Lower Rollover : False : FAILED"
|
||
IF [ -N $Log ]
|
||
ECHO "Test 17 Lower Rollover : False : FAILED" >> ${Log}
|
||
SET F = $F + 1
|
||
FI
|
||
FI
|
||
ECHO
|
||
ECHO "End IF Numeric Tests"
|
||
ECHO
|
||
IF [ -N $Log ]
|
||
ECHO "End IF Numeric Tests" >> ${Log}
|
||
FI
|
||
SET ABC =
|
||
SET DEF =
|
||
SET GHI =
|
||
MAN
|
||
TEXT /MAKE/USR/SHARE/TESTS/IFNUMTEST
|