diff --git a/bin/journey-test.sh b/bin/journey-test.sh index fca6a77fa..3532b7fe7 100755 --- a/bin/journey-test.sh +++ b/bin/journey-test.sh @@ -72,6 +72,8 @@ get_operating_system() { echo "linux";; (Windows*) echo "windows";; + (MINGW*) + echo "windows";; (*) echo "linux";; esac @@ -102,10 +104,25 @@ download_exercism_cli() { # "curl..." :: HTTP 302 headers, including "Location" -- URL to redirect to. # "awk..." :: pluck last path segment from "Location" (i.e. the version number) local version="$(curl --head --silent ${latest} | awk -v FS=/ '/Location:/{print $NF}' | tr -d '\r')" - local download_url=${CLI_RELEASES}/download/${version}/exercism-${os}-${arch}.tgz + + local download_url_suffix + local unzip_command + local unzip_from_file_option + if [[ ${os} == "windows" ]] ; then + download_url_suffix="zip" + unzip_command="unzip -d" + unzip_from_file_option="" + else + download_url_suffix="tgz" + unzip_command="tar xz -C" + unzip_from_file_option="-f" + fi + local download_url=${CLI_RELEASES}/download/${version}/exercism-${os}-${arch}.${download_url_suffix} mkdir -p ${exercism_home} - curl -s --location ${download_url} | tar xz -C ${exercism_home} + local temp=`mktemp` + curl -s --location ${download_url} > ${temp} + ${unzip_command} ${exercism_home} ${unzip_from_file_option} ${temp} echo "<<< download_exercism_cli()" } @@ -192,8 +209,8 @@ solve_all_exercises() { local xjava=$( pwd ) local exercism_cli="./exercism --config ${exercism_configfile}" - local exercises=`cat config.json | jq '.problems []' --raw-output` - local total_exercises=`cat config.json | jq '.problems | length'` + local exercises=`cat config.json | jq '.exercises[].slug + " "' --join-output` + local total_exercises=`cat config.json | jq '.exercises | length'` local current_exercise_number=1 local tempfile="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt" diff --git a/exercises/allergies/src/example/java/Allergen.java b/exercises/allergies/src/example/java/Allergen.java deleted file mode 120000 index a05344060..000000000 --- a/exercises/allergies/src/example/java/Allergen.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/Allergen.java \ No newline at end of file diff --git a/exercises/allergies/src/example/java/Allergen.java b/exercises/allergies/src/example/java/Allergen.java new file mode 100644 index 000000000..dd136480d --- /dev/null +++ b/exercises/allergies/src/example/java/Allergen.java @@ -0,0 +1,20 @@ +public enum Allergen { + EGGS(1), + PEANUTS(2), + SHELLFISH(4), + STRAWBERRIES(8), + TOMATOES(16), + CHOCOLATE(32), + POLLEN(64), + CATS(128); + + private final int score; + + Allergen(int score) { + this.score = score; + } + + public int getScore() { + return score; + } +} diff --git a/exercises/meetup/src/example/java/MeetupSchedule.java b/exercises/meetup/src/example/java/MeetupSchedule.java deleted file mode 120000 index 438972d56..000000000 --- a/exercises/meetup/src/example/java/MeetupSchedule.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/MeetupSchedule.java \ No newline at end of file diff --git a/exercises/meetup/src/example/java/MeetupSchedule.java b/exercises/meetup/src/example/java/MeetupSchedule.java new file mode 100644 index 000000000..8e36afdb2 --- /dev/null +++ b/exercises/meetup/src/example/java/MeetupSchedule.java @@ -0,0 +1,8 @@ +public enum MeetupSchedule { + FIRST, + SECOND, + THIRD, + FOURTH, + LAST, + TEENTH +} diff --git a/exercises/perfect-numbers/src/example/java/Classification.java b/exercises/perfect-numbers/src/example/java/Classification.java deleted file mode 120000 index a09bb66b1..000000000 --- a/exercises/perfect-numbers/src/example/java/Classification.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/Classification.java \ No newline at end of file diff --git a/exercises/perfect-numbers/src/example/java/Classification.java b/exercises/perfect-numbers/src/example/java/Classification.java new file mode 100644 index 000000000..e98ab5a54 --- /dev/null +++ b/exercises/perfect-numbers/src/example/java/Classification.java @@ -0,0 +1,5 @@ +enum Classification { + + DEFICIENT, PERFECT, ABUNDANT + +} diff --git a/exercises/robot-simulator/src/example/java/GridPosition.java b/exercises/robot-simulator/src/example/java/GridPosition.java deleted file mode 120000 index 8d4d836b8..000000000 --- a/exercises/robot-simulator/src/example/java/GridPosition.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/GridPosition.java \ No newline at end of file diff --git a/exercises/robot-simulator/src/example/java/GridPosition.java b/exercises/robot-simulator/src/example/java/GridPosition.java new file mode 100644 index 000000000..9ee0d69c6 --- /dev/null +++ b/exercises/robot-simulator/src/example/java/GridPosition.java @@ -0,0 +1,29 @@ +final class GridPosition { + + final int x; + + final int y; + + GridPosition(final int x, final int y) { + this.x = x; + this.y = y; + } + + /* + * This equals method is of deliberately narrow scope (only allows comparison with another GridPosition) to increase + * readability. In general, one should provide a full implementation of Object.equals(Object obj) and a + * corresponding implementation of Object.hashCode(). See + * + * https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object) + * + * and + * + * https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode() + * + * for more information. + */ + boolean equals(final GridPosition gridPosition) { + return this.x == gridPosition.x && this.y == gridPosition.y; + } + +} diff --git a/exercises/robot-simulator/src/example/java/Orientation.java b/exercises/robot-simulator/src/example/java/Orientation.java deleted file mode 120000 index 137f51735..000000000 --- a/exercises/robot-simulator/src/example/java/Orientation.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/Orientation.java \ No newline at end of file diff --git a/exercises/robot-simulator/src/example/java/Orientation.java b/exercises/robot-simulator/src/example/java/Orientation.java new file mode 100644 index 000000000..49ecae184 --- /dev/null +++ b/exercises/robot-simulator/src/example/java/Orientation.java @@ -0,0 +1,5 @@ +enum Orientation { + + NORTH, EAST, SOUTH, WEST + +} diff --git a/exercises/secret-handshake/src/example/java/Signal.java b/exercises/secret-handshake/src/example/java/Signal.java deleted file mode 120000 index 67607d1ed..000000000 --- a/exercises/secret-handshake/src/example/java/Signal.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/Signal.java \ No newline at end of file diff --git a/exercises/secret-handshake/src/example/java/Signal.java b/exercises/secret-handshake/src/example/java/Signal.java new file mode 100644 index 000000000..c776de99e --- /dev/null +++ b/exercises/secret-handshake/src/example/java/Signal.java @@ -0,0 +1,5 @@ +enum Signal { + + WINK, DOUBLE_BLINK, CLOSE_YOUR_EYES, JUMP + +} diff --git a/exercises/sublist/src/example/java/Relationship.java b/exercises/sublist/src/example/java/Relationship.java deleted file mode 120000 index a5701f7ae..000000000 --- a/exercises/sublist/src/example/java/Relationship.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/Relationship.java \ No newline at end of file diff --git a/exercises/sublist/src/example/java/Relationship.java b/exercises/sublist/src/example/java/Relationship.java new file mode 100644 index 000000000..1d0da2e5f --- /dev/null +++ b/exercises/sublist/src/example/java/Relationship.java @@ -0,0 +1,5 @@ +enum Relationship { + + EQUAL, SUBLIST, SUPERLIST, UNEQUAL + +} diff --git a/exercises/triangle/src/example/java/TriangleException.java b/exercises/triangle/src/example/java/TriangleException.java deleted file mode 120000 index 309476ff4..000000000 --- a/exercises/triangle/src/example/java/TriangleException.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/TriangleException.java \ No newline at end of file diff --git a/exercises/triangle/src/example/java/TriangleException.java b/exercises/triangle/src/example/java/TriangleException.java new file mode 100644 index 000000000..3b1071e94 --- /dev/null +++ b/exercises/triangle/src/example/java/TriangleException.java @@ -0,0 +1,5 @@ +public class TriangleException extends Exception { + + public TriangleException() { + } +} diff --git a/exercises/triangle/src/example/java/TriangleKind.java b/exercises/triangle/src/example/java/TriangleKind.java deleted file mode 120000 index 73a629d32..000000000 --- a/exercises/triangle/src/example/java/TriangleKind.java +++ /dev/null @@ -1 +0,0 @@ -../../main/java/TriangleKind.java \ No newline at end of file diff --git a/exercises/triangle/src/example/java/TriangleKind.java b/exercises/triangle/src/example/java/TriangleKind.java new file mode 100644 index 000000000..5dbf64b90 --- /dev/null +++ b/exercises/triangle/src/example/java/TriangleKind.java @@ -0,0 +1,5 @@ +public enum TriangleKind { + EQUILATERAL, + ISOSCELES, + SCALENE +}