| author | Christian Urban <christian.urban@kcl.ac.uk> | 
| Wed, 09 Nov 2022 18:44:40 +0000 | |
| changeset 435 | 5d06cbea2000 | 
| parent 433 | a6aa851361d0 | 
| child 436 | 2f17f233cddc | 
| permissions | -rwxr-xr-x | 
| 433 | 1 | #!/bin/bash | 
| 432 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 2 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 3 | # to make the script fail safely | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 4 | set -euo pipefail | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 5 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 6 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 7 | out=${1:-output}
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 8 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 9 | echo -e "" > $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 10 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 11 | echo "The feedback for your submission for wordle.scala" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 12 | echo "" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 13 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 14 | # marks for main part 2 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 15 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 16 | # compilation tests | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 17 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 18 | function scala_compile {
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 19 | (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 20 | } | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 21 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 22 | # functional tests | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 23 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 24 | function scala_assert {
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 25 | (ulimit -t 35; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 26 | } | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 27 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 28 | # purity test | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 29 | function scala_vars {
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 30 | (sed 's/immutable/ok/g' c$out > cb$out; | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 31 | egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 32 | } | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 33 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 34 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 35 | ### compilation test | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 36 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 37 | echo -e "wordle.scala runs?" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 38 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 39 | if (scala_compile wordle.scala) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 40 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 41 | echo -e " --> success" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 42 | tsts0=$(( 0 )) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 43 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 44 | echo -e " --> SCALA DID NOT RUN wordle.scala\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 45 | tsts0=$(( 1 )) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 46 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 47 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 48 | # var, .par return, ListBuffer test | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 49 | # | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 50 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 51 | if [ $tsts0 -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 52 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 53 | echo -e "wordle.scala does not contain VARS, RETURNS etc?" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 54 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 55 | if (scala_vars wordle.scala) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 56 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 57 | echo -e " --> test failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 58 | tsts=$(( 1 )) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 59 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 60 | echo -e " --> success" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 61 | tsts=$(( 0 )) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 62 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 63 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 64 | tsts=$(( 1 )) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 65 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 66 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 67 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 68 | echo >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 69 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 70 | ### wordle tests: Task 1 (0.25%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 71 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 72 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 73 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 74 | echo "Task 1:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 75 | echo " val wordle_url = \"\"\"https://nms.kcl.ac.uk/christian.urban/wordle.txt\"\"\"" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 76 | echo " val secrets = get_wordle_list(wordle_url)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 77 | echo " secrets.length == 12972" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 78 | echo " secrets.filter(_.length != 5) == Nil" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 79 | echo " get_wordle_list(wordle_url ++ \"2\") == Nil" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 80 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 81 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 82 | if (scala_assert "wordle.scala" "wordle_test1.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 83 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 84 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 85 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 86 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 87 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 88 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 89 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 90 | ### wordle tests: Task 2 (0.25%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 91 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 92 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 93 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 94 | echo "Task 2:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 95 | echo " removeOne(List(1,2,3,2,1), 3) == List(1, 2, 2, 1)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 96 | echo " removeOne(List(1,2,3,2,1), 2) == List(1, 3, 2, 1)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 97 | echo " removeOne(List(1,2,3,2,1), 1) == List(2, 3, 2, 1)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 98 | echo " removeOne(List(1,2,3,2,1), 0) == List(1, 2, 3, 2, 1)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 99 | echo " removeOne(List(\"a\", \"b\", \"b\"), \"b\") == List(\"a\", \"b\")" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 100 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 101 | if (scala_assert "wordle.scala" "wordle_test2.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 102 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 103 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 104 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 105 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 106 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 107 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 108 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 109 | ### wordle tests: Task 3 (1.5%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 110 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 111 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 112 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 113 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 114 | echo "Task 3:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 115 |   echo "  pool(\"chess\", \"caves\").toSet == Set('h', 'e', 's')" >> $out
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 116 |   echo "  pool(\"chess\", \"swiss\").toSet == Set('c', 'h', 'e')" >> $out
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 117 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 118 | if (scala_assert "wordle.scala" "wordle_test3a.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 119 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 120 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 121 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 122 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 123 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 124 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 125 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 126 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 127 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 128 | echo " score(\"chess\", \"caves\") == List(C, A, A, P, C)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 129 | echo " score(\"doses\", \"slide\") == List(P, A, A, P, P)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 130 | echo " score(\"chess\", \"swiss\") == List(A, A, A, C, C)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 131 | echo " score(\"chess\", \"eexss\") == List(P, A, A, C, C)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 132 | echo "" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 133 | echo " val p = pool(\"chess\", \"caves\")" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 134 | echo " aux(\"chess\".toList, \"caves\".toList, Nil) == List(P, A, A, A, C)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 135 | echo " aux(\"chess\".toList, \"caves\".toList, p) == List(P, A, A, P, C)" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 136 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 137 | if (scala_assert "wordle.scala" "wordle_test3b.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 138 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 139 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 140 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 141 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 142 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 143 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 144 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 145 | ### wordle tests: Task 4 (0.5%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 146 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 147 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 148 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 149 | echo "Task 4:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 150 | echo " iscore(\"chess\", \"caves\") == 21" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 151 | echo " iscore(\"chess\", \"swiss\") == 20" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 152 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 153 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 154 | if (scala_assert "wordle.scala" "wordle_test4.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 155 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 156 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 157 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 158 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 159 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 160 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 161 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 162 | ### wordle tests: Task 5 (1.5%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 163 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 164 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 165 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 166 | echo "Task 5:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 167 | echo " val secrets = ..." >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 168 | echo " evil(secrets, \"stent\").length == 1907" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 169 | echo " evil(secrets, \"hexes\").length == 2966" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 170 | echo " evil(secrets, \"horse\").length == 1203" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 171 | echo " evil(secrets, \"hoise\").length == 901" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 172 | echo " evil(secrets, \"house\").length == 1228" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 173 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 174 | if (scala_assert "wordle.scala" "wordle_test5.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 175 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 176 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 177 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 178 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 179 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 180 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 181 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 182 | ### wordle tests: Task 6 (1.0%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 183 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 184 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 185 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 186 | echo "Task 6:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 187 | echo " val secrets = ..." >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 188 |   echo "  frequencies(secrets)('y') == 0.9680234350909651" >> $out
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 189 |   echo "  frequencies(secrets)('e') == 0.897286463151403"  >> $out
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 190 |   echo "  frequencies(secrets)('z') == 0.9933086648165279" >> $out
 | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 191 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 192 | if (scala_assert "wordle.scala" "wordle_test6.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 193 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 194 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 195 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 196 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 197 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 198 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 199 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 200 | ### wordle tests: Task 7 (1.0%) | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 201 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 202 | if [ $tsts -eq 0 ] | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 203 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 204 | echo "Task 7:" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 205 | echo " val secrets = ..." >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 206 | echo " ranked_evil(secrets, \"beats\") == List(\"orlon\") || ... == List(\"fuzzy\")" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 207 | echo " ranked_evil(secrets, \"vitae\") == List(\"sools\", \"solos\") || ... == List(\"fuzzy\")" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 208 | echo " ranked_evil(secrets, \"bento\") == List(\"assai\") || ... == List(\"fuzzy\")" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 209 | echo " ranked_evil(secrets, \"belts\") == List(\"anana\") || ... == List(\"fuzzy\")" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 210 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 211 | if (scala_assert "wordle.scala" "wordle_test7.scala") | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 212 | then | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 213 | echo -e " --> success\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 214 | else | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 215 | echo -e " --> one of the tests failed\n" >> $out | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 216 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 217 | fi | 
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 218 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 219 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 220 | |
| 
87e487ccbd7c
updated wordle testing
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 221 |