NEW
  PREFIX
AUTO 4,1
#!/BIN/SH
#
#  If Level test script
#
ECHO "\f\n\n          Nested IF Level Test"
SET GOODS = 0
SET BADS = 0
SET TESTS = 15
WHILE [ $TESTS -ne 0 ]
ECHO -N "\e[10;10HTesting Level: ${TESTS}  "
  IF [ $TESTS = "1" ]
    SET GOODS = $GOODS + 1
  ELSE
    IF [ $TESTS = "2" ]
      SET GOODS = $GOODS + 1
    ELSE
      IF [ $TESTS = "3" ]
        SET GOODS = $GOODS + 1
      ELSE
        IF [ $TESTS = "4" ]
          SET GOODS = $GOODS + 1
        ELSE
          IF [ $TESTS = "5" ]
            SET GOODS = $GOODS + 1
          ELSE
            IF [ $TESTS = "6" ]
              SET GOODS = $GOODS + 1
            ELSE
              IF [ $TESTS = "7" ]
                SET GOODS = $GOODS + 1
              ELSE
                IF [ $TESTS = "8" ]
                  SET GOODS = $GOODS + 1
                ELSE
                  IF [ $TESTS = "9" ]
                    SET GOODS = $GOODS + 1
                  ELSE
                    IF [ $TESTS = "10" ]
                      SET GOODS = $GOODS + 1
                    ELSE
                      IF [ $TESTS = "11" ]
                        SET GOODS = $GOODS + 1
                     ELSE
                        IF [ $TESTS = "12" ]
                          SET GOODS = $GOODS + 1
                        ELSE
                          SET BADS = $BADS + 1
                        FI
                      FI
                    FI
                  FI
                FI
              FI
            FI
          FI
        FI
      FI
    FI
  FI
SET TESTS = $TESTS - 1
LOOP
ECHO
ECHO
ECHO "         Goods: ${GOODS}   Bads: ${BADS}"
IF [ $GOODS -eq 12 ]
  IF [ $BADS -eq 3 ]
    ECHO "\n\n         Nested IF Level Test Passed"
    IF [ -N $Log ]
      SET T = $T + 1
      SET P = $P + 1
      ECHO "Nested IF Level Test Passed" >> ${Log}
    FI
  ELSE
    ECHO "\n\n         Nested IF Level Test Failed"
    ECHO "         Expected 3 Bads, result was ${BADS}"
    IF [ -N $Log ]
      SET T = $T + 1
      SET F = $F + 1
      ECHO "Nested IF Level Test Failed" >> ${Log}
      ECHO "Expected 3 Bads, result was ${BADS}" >> ${Log}
    FI
  FI
ELSE
  IF [ $BADS -eq 3 ]
    ECHO "\n\n         Nested IF Level Test Failed"
    ECHO "         Expected 12 Goods, result was ${GOODS}"
    IF [ -N $Log ]
      SET T = $T + 1
      SET F = $F + 1
      ECHO "Nested IF Level Test Failed" >> ${Log}
      ECHO "Expected 12 Goods, result was ${GOODS}" >> ${Log}
    FI
  ELSE
    ECHO "\n\n         Nested IF Level Test Failed"
    ECHO "         Expected 12 Goods, result was ${GOODS}"
    ECHO "         Expected 3 Bads, result was ${BADS}"
    IF [ -N $Log ]
      SET T = $T + 1
      SET F = $F + 1
      ECHO "Nested IF Level Test Failed" >> ${Log}
      ECHO "Expected 12 Goods, result was ${GOODS}" >> ${Log}
      ECHO "Expected 3 Bads, result was ${BADS}" >> ${Log}
    FI
  FI
FI
MAN
TEXT /MAKE/USR/SHARE/TESTS/IFLEVEL
