main_testing4/knight_test.sh
changeset 376 944db68cddbd
parent 352 644aca68e203
child 415 368556c8df56
equal deleted inserted replaced
375:d886c0fd7374 376:944db68cddbd
    29 }
    29 }
    30 
    30 
    31 # purity test
    31 # purity test
    32 
    32 
    33 function scala_vars {
    33 function scala_vars {
    34    (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
    34    (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
    35 }
    35 }
    36 
    36 
    37 
    37 
    38 
    38 
    39 
    39 
    70 fi    
    70 fi    
    71 
    71 
    72 
    72 
    73 ### knight1 test
    73 ### knight1 test
    74 
    74 
    75 if [ $tsts1 -eq 0 ]
    75 #if [ $tsts1 -eq 0 ]
    76 then
    76 #then
    77     #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
    77 #    #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
    78     echo -e " is_legal(8, Nil, (3, 4)) == true " >> $out
    78 #    echo -e " is_legal(8, Nil, (3, 4)) == true " >> $out
    79     echo -e " is_legal(8, List((4, 1), (1, 0)), (4, 1)) == false " >> $out
    79 #    echo -e " is_legal(8, List((4, 1), (1, 0)), (4, 1)) == false " >> $out
    80     echo -e " is_legal(2, Nil, (0, 0)) == true" >> $out                          
    80 #    echo -e " is_legal(2, Nil, (0, 0)) == true" >> $out                          
    81 
    81 #
    82     if (scala_assert "knight1.scala" "knight_test1.scala")
    82 #    if (scala_assert "knight1.scala" "knight_test1.scala")
    83     then
    83 #    then
    84         echo -e "  --> success" >> $out
    84 #        echo -e "  --> success" >> $out
    85     else
    85 #    else
    86         echo -e "  --> \n ONE TEST FAILED\n" >> $out
    86 #        echo -e "  --> \n ONE TEST FAILED\n" >> $out
    87     fi
    87 #    fi
    88 fi
    88 #fi
    89 
    89 
    90 ### knight2 test
    90 ### knight2 test
    91 
    91 
    92 if [ $tsts1 -eq 0 ]
    92 #if [ $tsts1 -eq 0 ]
    93 then
    93 #then
    94   #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
    94 #  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
    95   echo -e " legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4))" >> $out
    95 #  echo -e " legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4))" >> $out
    96   echo -e " legal_moves(8, Nil, (7,7)) == List((6,5), (5,6))" >> $out
    96 #  echo -e " legal_moves(8, Nil, (7,7)) == List((6,5), (5,6))" >> $out
    97   echo -e " legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4))" >> $out
    97 #  echo -e " legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4))" >> $out
    98   echo -e " legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6))" >> $out
    98 #  echo -e " legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6))" >> $out
    99   echo -e " legal_moves(1, Nil, (0,0)) == Nil" >> $out
    99 #  echo -e " legal_moves(1, Nil, (0,0)) == Nil" >> $out
   100   echo -e " legal_moves(2, Nil, (0,0)) == Nil" >> $out
   100 #  echo -e " legal_moves(2, Nil, (0,0)) == Nil" >> $out
   101   echo -e " legal_moves(3, Nil, (0,0)) == List((1,2), (2,1))" >> $out
   101 #  echo -e " legal_moves(3, Nil, (0,0)) == List((1,2), (2,1))" >> $out
   102   
   102 #  
   103   if (scala_assert "knight1.scala" "knight_test2.scala")
   103 #  if (scala_assert "knight1.scala" "knight_test2.scala")
   104   then
   104 #  then
   105     echo -e "  --> success" >> $out
   105 #    echo -e "  --> success" >> $out
   106   else
   106 #  else
   107     echo -e "  --> \n ONE TEST FAILED\n" >> $out
   107 #    echo -e "  --> \n ONE TEST FAILED\n" >> $out
   108   fi
   108 #  fi
   109 fi
   109 #fi
   110 
   110 
   111 
   111 
   112 ### knight3 test
   112 ### knight3 test
   113 
   113 
   114 if [ $tsts1 -eq 0 ]
   114 #if [ $tsts1 -eq 0 ]
   115 then
   115 #then
   116   #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
   116 #  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
   117   echo -e " count_tours from every position on the board" >> $out
   117 #  echo -e " count_tours from every position on the board" >> $out
   118   echo -e " dim = 1: 1" >> $out
   118 #  echo -e " dim = 1: 1" >> $out
   119   echo -e "       2: 0,0,0,0" >>  $out
   119 #  echo -e "       2: 0,0,0,0" >>  $out
   120   echo -e "       3: 0,0,0,0,0,0,0,0,0" >>  $out
   120 #  echo -e "       3: 0,0,0,0,0,0,0,0,0" >>  $out
   121   echo -e "       4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" >> $out
   121 #  echo -e "       4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" >> $out
   122   #echo -e "       5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56,0,56,0,56,0,304,0,56,0,304" >> $out
   122 #  #echo -e "       5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56,0,56,0,56,0,304,0,56,0,304" >> $out
   123   echo -e " enum_tours(5, List((0,0)) ) == 304 and all correct?" >> $out
   123 #  echo -e " enum_tours(5, List((0,0)) ) == 304 and all correct?" >> $out
   124   echo -e " enum_tours(5, List((0,1)) ) == 0" >> $out
   124 #  echo -e " enum_tours(5, List((0,1)) ) == 0" >> $out
   125   echo -e " enum_tours(5, List((0,2)) ) == 56 and all correct?" >> $out
   125 #  echo -e " enum_tours(5, List((0,2)) ) == 56 and all correct?" >> $out
   126   
   126 #  
   127   if (scala_assert "knight1.scala" "knight_test3.scala") 
   127 #  if (scala_assert "knight1.scala" "knight_test3.scala") 
   128   then
   128 #  then
   129     echo -e "  --> success" >> $out
   129 #    echo -e "  --> success" >> $out
   130   else
   130 #  else
   131     echo -e "  --> \n ONE TEST FAILED\n" >> $out
   131 #    echo -e "  --> \n ONE TEST FAILED\n" >> $out
   132   fi
   132 #  fi
   133 fi
   133 #fi
   134 
   134 
   135 ### knight4 test
   135 ### knight4 test
   136 
   136 
   137 if [ $tsts1 -eq 0 ]
   137 if [ $tsts1 -eq 0 ]
   138 then
   138 then