core_marking3/postfix_test.sh
changeset 463 0315d9983cd0
parent 424 daf561a83ba6
equal deleted inserted replaced
462:34feeb53c0ba 463:0315d9983cd0
    84   echo -e " syard(split(\"5 + 7 / 2\")) == List(\"5\", \"7\", \"2\", \"/\", \"+\")" | tee -a $out
    84   echo -e " syard(split(\"5 + 7 / 2\")) == List(\"5\", \"7\", \"2\", \"/\", \"+\")" | tee -a $out
    85   echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
    85   echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
    86   
    86   
    87   if (scala_assert "postfix.scala" "postfix_test1.scala")
    87   if (scala_assert "postfix.scala" "postfix_test1.scala")
    88   then
    88   then
    89     echo -e "  --> success" | tee -a $out
    89     echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
    90     marks=$(( marks + 1.0 ))
    90     marks=$(( marks + 1.0 ))
    91   else
    91   else
    92     echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
    92     echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
    93   fi
    93   fi
    94 fi
    94 fi
   104   echo -e " compute(syard(split(\"5 * 7 / 2\"))) == 17" | tee -a $out
   104   echo -e " compute(syard(split(\"5 * 7 / 2\"))) == 17" | tee -a $out
   105   echo -e " compute(syard(split(\"9 + 24 / ( 7 - 3 )\"))) == 15" | tee -a $out
   105   echo -e " compute(syard(split(\"9 + 24 / ( 7 - 3 )\"))) == 15" | tee -a $out
   106   
   106   
   107   if (scala_assert "postfix.scala" "postfix_test2.scala")
   107   if (scala_assert "postfix.scala" "postfix_test2.scala")
   108   then
   108   then
   109      echo -e "  --> success" | tee -a $out
   109      echo -e "  --> success (+ 1 Mark)\n" | tee -a $out
   110      marks=$(( marks + 1.0 ))
   110      marks=$(( marks + 1.0 ))
   111   else
   111   else
   112      echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   112      echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   113   fi
   113   fi
   114 fi
   114 fi
   124 
   124 
   125 echo -e "postfix2.scala runs?" | tee -a $out
   125 echo -e "postfix2.scala runs?" | tee -a $out
   126 
   126 
   127 if (scala_compile postfix2.scala)
   127 if (scala_compile postfix2.scala)
   128 then
   128 then
   129    echo -e "  --> success" | tee -a $out
   129    echo -e "  --> success\n" | tee -a $out
   130    tsts=$(( 0 ))
   130    tsts=$(( 0 ))
   131 else
   131 else
   132    echo -e "  --> SCALA DID NOT RUN postfix2.scala\n" | tee -a $out
   132    echo -e "  --> SCALA DID NOT RUN postfix2.scala\n" | tee -a $out
   133    tsts=$(( 1 )) 
   133    tsts=$(( 1 )) 
   134 fi
   134 fi
   143   if (scala_vars postfix2.scala)
   143   if (scala_vars postfix2.scala)
   144   then
   144   then
   145     echo -e "  --> FAIL\n" | tee -a $out  
   145     echo -e "  --> FAIL\n" | tee -a $out  
   146     tsts=$(( 1 ))
   146     tsts=$(( 1 ))
   147   else
   147   else
   148     echo -e "  --> success" | tee -a $out  
   148     echo -e "  --> success\n" | tee -a $out  
   149     tsts=$(( 0 )) 
   149     tsts=$(( 0 )) 
   150   fi
   150   fi
   151 else
   151 else
   152   tsts=$(( 1 ))  
   152   tsts=$(( 1 ))  
   153 fi
   153 fi
   164   echo -e " syard(split(\"3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3\")) == " | tee -a $out
   164   echo -e " syard(split(\"3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3\")) == " | tee -a $out
   165   echo -e "         List(\"3\", \"4\", \"8\", \"*\", \"5\", \"1\", \"-\", \"2\", \"3\", \"^\", \"^\", \"/\", \"+\")" | tee -a $out
   165   echo -e "         List(\"3\", \"4\", \"8\", \"*\", \"5\", \"1\", \"-\", \"2\", \"3\", \"^\", \"^\", \"/\", \"+\")" | tee -a $out
   166   
   166   
   167   if (scala_assert "postfix2.scala" "postfix_test3.scala")
   167   if (scala_assert "postfix2.scala" "postfix_test3.scala")
   168   then
   168   then
   169       echo -e "  --> success" | tee -a $out
   169       echo -e "  --> success (+ 0.5 Marks)\n" | tee -a $out
   170       marks=$(( marks + 0.5 ))
   170       marks=$(( marks + 0.5 ))
   171   else
   171   else
   172       echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   172       echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   173   fi
   173   fi
   174 fi
   174 fi
   186   echo -e " compute(syard(split(\"( 4 ^ 3 ) ^ 2\"))) == 4096" | tee -a $out
   186   echo -e " compute(syard(split(\"( 4 ^ 3 ) ^ 2\"))) == 4096" | tee -a $out
   187   echo -e " compute(syard(split(\"( 3 + 1 ) ^ 2 ^ 3\"))) == 65536" | tee -a $out
   187   echo -e " compute(syard(split(\"( 3 + 1 ) ^ 2 ^ 3\"))) == 65536" | tee -a $out
   188   
   188   
   189   if (scala_assert "postfix2.scala" "postfix_test4.scala")
   189   if (scala_assert "postfix2.scala" "postfix_test4.scala")
   190   then
   190   then
   191       echo -e "  --> success" | tee -a $out
   191       echo -e "  --> success (+ 0.5 Marks)\n" | tee -a $out
   192       marks=$(( marks + 0.5 ))
   192       marks=$(( marks + 0.5 ))
   193   else
   193   else
   194       echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   194       echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   195   fi
   195   fi
   196 fi
   196 fi