2019-02-18 05:41:06 +00:00
|
|
|
|
NEW
|
|
|
|
|
PREFIX
|
|
|
|
|
AUTO 4,1
|
|
|
|
|
#!/BIN/SH
|
|
|
|
|
#
|
|
|
|
|
# Testing the new IF -Z -N Options
|
|
|
|
|
#
|
2019-03-07 02:13:28 +00:00
|
|
|
|
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
|
2019-02-18 05:41:06 +00:00
|
|
|
|
SET ABC = "HELLO"
|
2019-03-07 02:13:28 +00:00
|
|
|
|
SET DEF = ""
|
|
|
|
|
SET T = $T + 1
|
2019-02-18 05:41:06 +00:00
|
|
|
|
IF [ -Z $ABC ]
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "-Z for ABC True: Failed"
|
|
|
|
|
SET F = $F + 1
|
|
|
|
|
IF [ -N $Log ]
|
|
|
|
|
ECHO "-Z for ABC True: Failed" >> ${Log}
|
|
|
|
|
FI
|
2019-02-18 05:41:06 +00:00
|
|
|
|
ELSE
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "-Z for ABC False: Passed"
|
|
|
|
|
SET P = $P + 1
|
|
|
|
|
IF [ -N $Log ]
|
|
|
|
|
ECHO "-Z for ABC False: Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-02-18 05:41:06 +00:00
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
SET T = $T + 1
|
2019-02-18 05:41:06 +00:00
|
|
|
|
IF [ -N $ABC ]
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "-N for ABC True: Passed"
|
|
|
|
|
SET P = $P + 1
|
|
|
|
|
IF [ -N $Log ]
|
|
|
|
|
ECHO "-N for ABC True: Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-02-18 05:41:06 +00:00
|
|
|
|
ELSE
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "-N for ABC False: Failed"
|
|
|
|
|
SET F = $F + 1
|
|
|
|
|
IF [ -N $Log ]
|
|
|
|
|
ECHO "-N for ABC False: Failed" >> ${Log}
|
|
|
|
|
FI
|
2019-02-18 05:41:06 +00:00
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
SET T = $T + 1
|
2019-02-18 05:41:06 +00:00
|
|
|
|
IF [ -Z $DEF ]
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "-Z for NULL True: Passed"
|
|
|
|
|
SET P = $P + 1
|
|
|
|
|
IF [ -N $Log ]
|
|
|
|
|
ECHO "-Z for NULL True: Passed" >> ${Log}
|
|
|
|
|
FI
|
2019-02-18 05:41:06 +00:00
|
|
|
|
ELSE
|
2019-03-07 02:13:28 +00:00
|
|
|
|
ECHO "-Z for NULL False: Failed"
|
|
|
|
|
SET F = $F + 1
|
|
|
|
|
IF [ -N $Log ]
|
|
|
|
|
ECHO "-Z for NULL False: Failed" >> ${Log}
|
|
|
|
|
FI
|
2019-02-18 05:41:06 +00:00
|
|
|
|
FI
|
2019-03-07 02:13:28 +00:00
|
|
|
|
SET T = $T + 1
|
2019-02-18 05:41:06 +00:00
|
|
|
|
IF [ -N $DEF ]
|
2019-03-07 02:13:28 +00:00
|
|
|
|
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
|
2019-02-18 05:41:06 +00:00
|
|
|
|
ELSE
|
2019-03-07 02:13:28 +00:00
|
|
|
|
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}
|
2019-02-18 05:41:06 +00:00
|
|
|
|
FI
|
|
|
|
|
MAN
|
|
|
|
|
TEXT /MAKE/USR/SHARE/TESTS/IFZNTEST
|