mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
170 lines
3.5 KiB
Plaintext
170 lines
3.5 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
#!/BIN/SH
|
||
#
|
||
# Testing the new IF -Z -N Options
|
||
#
|
||
echo "\f\n\n IF Null Tests"
|
||
echo "\n\nThis script tests that the IF -Z (NULL) and -N"
|
||
echo "(non-NULL) options perform as expected for both "
|
||
echo "string, numeric, null and non-existent variables."
|
||
echo
|
||
IF [ -N $Log ]
|
||
ECHO "Begin IF Null Tests" >> ${Log}
|
||
ELSE
|
||
SET T = 0
|
||
SET F = 0
|
||
SET P = 0
|
||
FI
|
||
SET ABC = "HELLO"
|
||
SET DEF = ""
|
||
SET T = $T + 1
|
||
IF [ -Z $ABC ]
|
||
ECHO "-Z for ABC True: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for ABC True: Failed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-Z for ABC False: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for ABC False: Passed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -N $ABC ]
|
||
ECHO "-N for ABC True: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for ABC True: Passed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-N for ABC False: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for ABC False: Failed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -Z $DEF ]
|
||
ECHO "-Z for NULL True: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for NULL True: Passed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-Z for NULL False: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for NULL False: Failed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -N $DEF ]
|
||
ECHO "-N for NULL True: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for NULL True: Failed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-N for NULL False: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for NULL False: Passed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET ABC = 123
|
||
SET DEF = 0
|
||
SET T = $T + 1
|
||
IF [ -Z $ABC ]
|
||
ECHO "-Z for 123 True: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for 123 True: Failed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-Z for 123 False: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for 123 False: Passed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -N $ABC ]
|
||
ECHO "-N for 123 True: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for 123 True: Passed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-N for 123 False: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for 123 False: Failed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -Z $DEF ]
|
||
ECHO "-Z for 0 True: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for 0 True: Failed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-Z for 0 False: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for 0 False: Passed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -N $DEF ]
|
||
ECHO "-N for 0 True: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for 0 True: Passed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-N for 0 False: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for 0 False: Failed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -Z $XYZ123 ]
|
||
ECHO "-Z for non-existent var True: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for non-existent var True: Passed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-Z for non-existent var False: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-Z for non-existent var False: Failed" >> ${Log}
|
||
FI
|
||
FI
|
||
SET T = $T + 1
|
||
IF [ -N $XYZ123 ]
|
||
ECHO "-N for non-existent var True: Failed"
|
||
SET F = $F + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for non-existent var True: Failed" >> ${Log}
|
||
FI
|
||
ELSE
|
||
ECHO "-N for non-existent var False: Passed"
|
||
SET P = $P + 1
|
||
IF [ -N $Log ]
|
||
ECHO "-N for non-existent var False: Passed" >> ${Log}
|
||
FI
|
||
FI
|
||
ECHO
|
||
IF [ -N $Log ]
|
||
ECHO "End IF Null Tests" >> ${Log}
|
||
FI
|
||
MAN
|
||
TEXT /MAKE/USR/SHARE/TESTS/IFZNTEST
|