trackler 2.2.1.46 → 2.2.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/nucleotide-count/canonical-data.json +7 -7
- data/tracks/c/README.md +1 -1
- data/tracks/c/docs/SNIPPET.txt +2 -3
- data/tracks/c/exercises/acronym/test/test_acronym.c +8 -0
- data/tracks/c/exercises/all-your-base/test/test_all_your_base.c +8 -0
- data/tracks/c/exercises/allergies/test/test_allergies.c +8 -0
- data/tracks/c/exercises/anagram/test/test_anagram.c +8 -0
- data/tracks/c/exercises/atbash-cipher/test/test_atbash_cipher.c +8 -0
- data/tracks/c/exercises/beer-song/src/example.c +23 -22
- data/tracks/c/exercises/beer-song/src/example.h +3 -3
- data/tracks/c/exercises/beer-song/test/test_beer_song.c +8 -0
- data/tracks/c/exercises/binary-search/test/test_binary_search.c +8 -0
- data/tracks/c/exercises/binary/test/test_binary.c +8 -0
- data/tracks/c/exercises/bob/test/test_bob.c +8 -0
- data/tracks/c/exercises/clock/test/test_clock.c +8 -0
- data/tracks/c/exercises/difference-of-squares/test/test_difference_of_squares.c +8 -0
- data/tracks/c/exercises/gigasecond/test/test_gigasecond.c +8 -0
- data/tracks/c/exercises/grains/test/test_grains.c +8 -0
- data/tracks/c/exercises/hamming/test/test_hamming.c +8 -0
- data/tracks/c/exercises/hello-world/src/example.c +0 -2
- data/tracks/c/exercises/hello-world/test/test_hello_world.c +8 -0
- data/tracks/c/exercises/isogram/test/test_isogram.c +8 -0
- data/tracks/c/exercises/largest-series-product/test/test_largest_series_product.c +8 -0
- data/tracks/c/exercises/leap/test/test_leap.c +8 -0
- data/tracks/c/exercises/meetup/test/test_meetup.c +8 -0
- data/tracks/c/exercises/nth-prime/test/test_nth_prime.c +8 -0
- data/tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c +8 -0
- data/tracks/c/exercises/palindrome-products/test/test_palindrome_products.c +8 -0
- data/tracks/c/exercises/pangram/test/test_pangram.c +8 -0
- data/tracks/c/exercises/pascals-triangle/test/test_pascals_triangle.c +8 -0
- data/tracks/c/exercises/perfect-numbers/src/example.c +4 -4
- data/tracks/c/exercises/perfect-numbers/src/example.h +4 -4
- data/tracks/c/exercises/perfect-numbers/src/perfect_numbers.h +4 -4
- data/tracks/c/exercises/perfect-numbers/test/test_perfect_numbers.c +23 -13
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +8 -0
- data/tracks/c/exercises/raindrops/test/test_raindrops.c +5 -1
- data/tracks/c/exercises/react/src/example.c +8 -8
- data/tracks/c/exercises/react/test/test_react.c +8 -0
- data/tracks/c/exercises/rna-transcription/test/test_rna_transcription.c +8 -0
- data/tracks/c/exercises/robot-simulator/src/example.c +12 -12
- data/tracks/c/exercises/robot-simulator/src/robot_simulator.h +11 -11
- data/tracks/c/exercises/robot-simulator/test/test_robot_simulator.c +33 -25
- data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +8 -0
- data/tracks/c/exercises/scrabble-score/test/test_scrabble_score.c +8 -0
- data/tracks/c/exercises/series/test/test_series.c +8 -0
- data/tracks/c/exercises/sieve/test/test_sieve.c +8 -0
- data/tracks/c/exercises/space-age/src/example.h +8 -8
- data/tracks/c/exercises/space-age/test/test_space_age.c +16 -8
- data/tracks/c/exercises/sum-of-multiples/test/test_sum_of_multiples.c +8 -0
- data/tracks/c/exercises/triangle/test/test_triangle.c +8 -0
- data/tracks/c/exercises/word-count/test/test_word_count.c +8 -0
- data/tracks/cfml/config.json +8 -0
- data/tracks/cfml/exercises/anagram/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/anagram/Anagram.cfc +13 -0
- data/tracks/cfml/exercises/anagram/AnagramTest.cfc +79 -0
- data/tracks/cfml/exercises/anagram/README.md +29 -0
- data/tracks/cfml/exercises/anagram/Solution.cfc +42 -0
- data/tracks/cfml/exercises/anagram/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/anagram/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/anagram/box.json +8 -0
- data/tracks/cfml/exercises/anagram/index.cfm +37 -0
- data/tracks/common-lisp/config.json +5 -5
- data/tracks/csharp/exercises/two-bucket/Example.cs +53 -79
- data/tracks/csharp/exercises/two-bucket/TwoBucketTest.cs +2 -2
- data/tracks/csharp/generators/Exercises/QueenAttack.cs +3 -3
- data/tracks/dart/exercises/leap/test/leap_test.dart +1 -1
- data/tracks/delphi/exercises/hamming/uHammingTests.pas +2 -2
- data/tracks/delphi/exercises/leap/uLeapTests.pas +11 -38
- data/tracks/delphi/exercises/nucleotide-count/uNucleotideCountExample.pas +1 -1
- data/tracks/delphi/exercises/nucleotide-count/uNucleotideCountTest.pas +31 -55
- data/tracks/ecmascript/config.json +31 -0
- data/tracks/ecmascript/config/maintainers.json +5 -5
- data/tracks/ecmascript/exercises/accumulate/package.json +1 -1
- data/tracks/ecmascript/exercises/acronym/package.json +1 -1
- data/tracks/ecmascript/exercises/all-your-base/package.json +1 -1
- data/tracks/ecmascript/exercises/allergies/package.json +1 -1
- data/tracks/ecmascript/exercises/alphametics/package.json +1 -1
- data/tracks/ecmascript/exercises/anagram/package.json +1 -1
- data/tracks/ecmascript/exercises/atbash-cipher/package.json +1 -1
- data/tracks/ecmascript/exercises/beer-song/package.json +1 -1
- data/tracks/ecmascript/exercises/binary-search-tree/package.json +1 -1
- data/tracks/ecmascript/exercises/binary-search/package.json +1 -1
- data/tracks/ecmascript/exercises/binary/package.json +1 -1
- data/tracks/ecmascript/exercises/bob/package.json +1 -1
- data/tracks/ecmascript/exercises/bracket-push/package.json +1 -1
- data/tracks/ecmascript/exercises/circular-buffer/package.json +1 -1
- data/tracks/ecmascript/exercises/clock/package.json +1 -1
- data/tracks/ecmascript/exercises/collatz-conjecture/README.md +59 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/collatz-conjecture.spec.js +31 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/example.js +14 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/package.json +69 -0
- data/tracks/ecmascript/exercises/connect/package.json +1 -1
- data/tracks/ecmascript/exercises/crypto-square/package.json +1 -1
- data/tracks/ecmascript/exercises/custom-set/package.json +1 -1
- data/tracks/ecmascript/exercises/diamond/package.json +1 -1
- data/tracks/ecmascript/exercises/difference-of-squares/package.json +1 -1
- data/tracks/ecmascript/exercises/diffie-hellman/package.json +1 -1
- data/tracks/ecmascript/exercises/etl/package.json +1 -1
- data/tracks/ecmascript/exercises/flatten-array/package.json +1 -1
- data/tracks/ecmascript/exercises/food-chain/package.json +1 -1
- data/tracks/ecmascript/exercises/gigasecond/package.json +1 -1
- data/tracks/ecmascript/exercises/grade-school/package.json +1 -1
- data/tracks/ecmascript/exercises/grains/package.json +1 -1
- data/tracks/ecmascript/exercises/hamming/package.json +1 -1
- data/tracks/ecmascript/exercises/hello-world/package.json +1 -1
- data/tracks/ecmascript/exercises/hexadecimal/package.json +1 -1
- data/tracks/ecmascript/exercises/isogram/package.json +1 -1
- data/tracks/ecmascript/exercises/kindergarten-garden/package.json +1 -1
- data/tracks/ecmascript/exercises/largest-series-product/package.json +1 -1
- data/tracks/ecmascript/exercises/leap/package.json +1 -1
- data/tracks/ecmascript/exercises/linked-list/package.json +1 -1
- data/tracks/ecmascript/exercises/list-ops/package.json +1 -1
- data/tracks/ecmascript/exercises/luhn/package.json +1 -1
- data/tracks/ecmascript/exercises/matrix/package.json +1 -1
- data/tracks/ecmascript/exercises/meetup/package.json +1 -1
- data/tracks/ecmascript/exercises/minesweeper/package.json +1 -1
- data/tracks/ecmascript/exercises/nth-prime/package.json +1 -1
- data/tracks/ecmascript/exercises/ocr-numbers/package.json +1 -1
- data/tracks/ecmascript/exercises/octal/package.json +1 -1
- data/tracks/ecmascript/exercises/palindrome-products/package.json +1 -1
- data/tracks/ecmascript/exercises/pangram/package.json +1 -1
- data/tracks/ecmascript/exercises/pascals-triangle/package.json +1 -1
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +1 -1
- data/tracks/ecmascript/exercises/phone-number/package.json +1 -1
- data/tracks/ecmascript/exercises/pig-latin/package.json +1 -1
- data/tracks/ecmascript/exercises/prime-factors/package.json +1 -1
- data/tracks/ecmascript/exercises/proverb/package.json +1 -1
- data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +1 -1
- data/tracks/ecmascript/exercises/queen-attack/package.json +1 -1
- data/tracks/ecmascript/exercises/raindrops/package.json +1 -1
- data/tracks/ecmascript/exercises/rna-transcription/package.json +1 -1
- data/tracks/ecmascript/exercises/robot-name/package.json +1 -1
- data/tracks/ecmascript/exercises/robot-simulator/package.json +1 -1
- data/tracks/ecmascript/exercises/roman-numerals/package.json +1 -1
- data/tracks/ecmascript/exercises/run-length-encoding/package.json +1 -1
- data/tracks/ecmascript/exercises/saddle-points/package.json +1 -1
- data/tracks/ecmascript/exercises/say/package.json +1 -1
- data/tracks/ecmascript/exercises/scrabble-score/package.json +1 -1
- data/tracks/ecmascript/exercises/secret-handshake/package.json +1 -1
- data/tracks/ecmascript/exercises/series/package.json +1 -1
- data/tracks/ecmascript/exercises/sieve/package.json +1 -1
- data/tracks/ecmascript/exercises/simple-cipher/package.json +1 -1
- data/tracks/ecmascript/exercises/simple-linked-list/package.json +1 -1
- data/tracks/ecmascript/exercises/space-age/package.json +1 -1
- data/tracks/ecmascript/exercises/strain/package.json +1 -1
- data/tracks/ecmascript/exercises/sublist/package.json +1 -1
- data/tracks/ecmascript/exercises/sum-of-multiples/package.json +1 -1
- data/tracks/ecmascript/exercises/triangle/package.json +1 -1
- data/tracks/ecmascript/exercises/trinary/package.json +1 -1
- data/tracks/ecmascript/exercises/twelve-days/package.json +1 -1
- data/tracks/ecmascript/exercises/two-bucket/package.json +1 -1
- data/tracks/ecmascript/exercises/word-count/package.json +1 -1
- data/tracks/ecmascript/exercises/word-search/README.md +58 -0
- data/tracks/ecmascript/exercises/word-search/example.js +146 -0
- data/tracks/ecmascript/exercises/word-search/package.json +69 -0
- data/tracks/ecmascript/exercises/word-search/word-search.spec.js +626 -0
- data/tracks/ecmascript/exercises/wordy/package.json +1 -1
- data/tracks/ecmascript/package.json +1 -1
- data/tracks/elixir/config.json +11 -0
- data/tracks/elixir/exercises/luhn/example.exs +26 -46
- data/tracks/elixir/exercises/luhn/luhn.exs +0 -13
- data/tracks/elixir/exercises/luhn/luhn_test.exs +44 -14
- data/tracks/elixir/exercises/transpose/README.md +101 -0
- data/tracks/elixir/exercises/transpose/example.exs +46 -0
- data/tracks/elixir/exercises/transpose/transpose.exs +22 -0
- data/tracks/elixir/exercises/transpose/transpose_test.exs +248 -0
- data/tracks/fsharp/exercises/grains/Example.fs +10 -2
- data/tracks/fsharp/exercises/grains/Grains.fs +2 -4
- data/tracks/fsharp/exercises/grains/GrainsTest.fs +52 -25
- data/tracks/fsharp/exercises/phone-number/Example.fs +11 -3
- data/tracks/fsharp/exercises/phone-number/PhoneNumber.fs +1 -1
- data/tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs +32 -21
- data/tracks/fsharp/exercises/prime-factors/Example.fs +6 -13
- data/tracks/fsharp/exercises/prime-factors/PrimeFactors.fs +1 -1
- data/tracks/fsharp/exercises/prime-factors/PrimeFactorsTest.fs +23 -32
- data/tracks/fsharp/exercises/rail-fence-cipher/RailFenceCipherTest.fs +22 -13
- data/tracks/fsharp/generators/Exercise.fs +3 -4
- data/tracks/fsharp/generators/Generators.fs +31 -0
- data/tracks/gnu-apl/bin/run-all-tests +5 -2
- data/tracks/java/CONTRIBUTING.md +8 -0
- data/tracks/java/POLICIES.md +2 -2
- data/tracks/java/config.json +26 -4
- data/tracks/java/exercises/triangle/.meta/.version +1 -0
- data/tracks/java/exercises/triangle/.meta/src/reference/java/Triangle.java +1 -1
- data/tracks/java/exercises/triangle/src/test/java/TriangleTest.java +59 -40
- data/tracks/javascript/config.json +30 -0
- data/tracks/javascript/config/maintainers.json +8 -8
- data/tracks/javascript/exercises/change/example.js +6 -22
- data/tracks/javascript/exercises/collatz-conjecture/README.md +57 -0
- data/tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js +37 -0
- data/tracks/javascript/exercises/collatz-conjecture/example.js +20 -0
- data/tracks/javascript/exercises/protein-translation/example.js +30 -31
- data/tracks/javascript/exercises/protein-translation/protein-translation.spec.js +60 -60
- data/tracks/javascript/exercises/transpose/README.md +89 -0
- data/tracks/javascript/exercises/transpose/example.js +17 -0
- data/tracks/javascript/exercises/transpose/transpose.spec.js +67 -0
- data/tracks/objective-c/config.json +283 -263
- data/tracks/objective-c/exercises/grains/GrainsExample.h +6 -0
- data/tracks/objective-c/exercises/grains/GrainsExample.m +19 -0
- data/tracks/objective-c/exercises/grains/GrainsTest.m +85 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeExample.h +6 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeExample.m +39 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeTest.m +53 -0
- data/tracks/python/config.json +42 -11
- data/tracks/python/exercises/change/README.md +34 -0
- data/tracks/python/exercises/two-bucket/README.md +47 -0
- data/tracks/ruby/README.md +4 -1
- data/tracks/ruby/lib/generator/command_line.rb +3 -3
- data/tracks/ruby/lib/generator/command_line/generator_optparser.rb +3 -3
- data/tracks/ruby/test/generator/command_line/generator_optparser_test.rb +4 -4
- data/tracks/ruby/test/generator/command_line_test.rb +5 -5
- data/tracks/typescript/config.json +15 -0
- data/tracks/typescript/exercises/strain/README.md +60 -0
- data/tracks/typescript/exercises/strain/package.json +36 -0
- data/tracks/typescript/exercises/strain/strain.example.ts +23 -0
- data/tracks/typescript/exercises/strain/strain.test.ts +76 -0
- data/tracks/typescript/exercises/strain/strain.ts +0 -0
- data/tracks/typescript/exercises/strain/tsconfig.json +22 -0
- data/tracks/typescript/exercises/strain/tslint.json +127 -0
- data/tracks/typescript/exercises/strain/yarn.lock +2305 -0
- metadata +46 -3
- data/tracks/ecmascript/package-lock.json +0 -2835
@@ -3,10 +3,11 @@
|
|
3
3
|
STATUS=0
|
4
4
|
APL=/usr/bin/apl
|
5
5
|
APL_OPTS='--silent --Color'
|
6
|
+
TMP=tmp
|
6
7
|
|
7
|
-
cp --recursive exercises
|
8
|
+
cp --recursive exercises $TMP
|
8
9
|
|
9
|
-
for exercise in
|
10
|
+
for exercise in ${TMP}/*; do
|
10
11
|
pushd $exercise
|
11
12
|
for example in *-example.apl; do
|
12
13
|
mv $example ${example/-example/}
|
@@ -17,5 +18,7 @@ for exercise in tmp/*; do
|
|
17
18
|
popd
|
18
19
|
done
|
19
20
|
|
21
|
+
rm -r $TMP
|
22
|
+
|
20
23
|
echo "Exiting with status ${STATUS}."
|
21
24
|
exit $STATUS
|
data/tracks/java/CONTRIBUTING.md
CHANGED
@@ -164,5 +164,13 @@ See [The Problem Submodules](#the-problem-submodules) section for what needs to
|
|
164
164
|
The `build.gradle` file can just be copied from any other exercise submodule.
|
165
165
|
See the [POLICIES doc](https://github.com/exercism/java/blob/master/POLICIES.md#starter-implementations) for an explanation of when you need to add a starter implementation.
|
166
166
|
|
167
|
+
4. Check if there is canonical data for the exercise you're adding.
|
168
|
+
This can be found at `https://github.com/exercism/problem-specifications/tree/master/exercises/EXERCISE-SLUG/canonical-data.json`.
|
169
|
+
If there is canonical data for your exercise then you should follow this when making the tests.
|
170
|
+
We aim to follow the canonical data as closely as possible in our tests to ensure thorough test coverage.
|
171
|
+
If there is canonical data available you also need to create a file at `exercises/exercise-slug/.meta/version` specifying the canonical data version you have implemented (e.g. `1.0.0`).
|
172
|
+
The canonical data version can be found at the top of the canonical data file for that exercise.
|
173
|
+
See other exercises, e.g. [acronym](https://github.com/exercism/java/tree/master/exercises/acronym/.meta), for an example `version` file.
|
174
|
+
|
167
175
|
Hopefully that should be enough information to help you port an exercise to the Java track.
|
168
176
|
Feel free to open an issue or post in the [Gitter exercism/java room](https://gitter.im/exercism/java) if you have any questions and we'll try and answer as soon as we can.
|
data/tracks/java/POLICIES.md
CHANGED
@@ -35,7 +35,7 @@ References: [[1](https://github.com/exercism/java/issues/177#issuecomment-261291
|
|
35
35
|
|
36
36
|
> - Exercises 1-20: provide stubs for all required constructors and methods. Stubs should include the following body:
|
37
37
|
`throw new UnsupportedOperationException("Delete this statement and write your own implementation.");`
|
38
|
-
> - Exercises 21+: provide no stubs by default, but either (1) add hints to the
|
38
|
+
> - Exercises 21+: provide no stubs by default, but either (1) add hints to the hints.md file (which gets merged into the README.md for the exercise) or (2) provide stubs as in exercises 1-20 for exercises that demand complicated method signatures.
|
39
39
|
|
40
40
|
References: [[1](https://github.com/exercism/java/issues/178)], [[2](https://github.com/exercism/java/pull/683#discussion_r125506930)]
|
41
41
|
|
@@ -56,7 +56,7 @@ References: [[1](https://github.com/exercism/java/issues/101#issuecomment-249349
|
|
56
56
|
|
57
57
|
### Multiple file submissions
|
58
58
|
|
59
|
-
> The first exercise in the track whose test suite mandates multiple solution files should be accompanied by a
|
59
|
+
> The first exercise in the track whose test suite mandates multiple solution files should be accompanied by a hints.md file reminding the practitioner that the CLI supports multiple file submissions.
|
60
60
|
|
61
61
|
References: [[1](https://github.com/exercism/java/issues/365#issuecomment-292533120)]
|
62
62
|
|
data/tracks/java/config.json
CHANGED
@@ -432,7 +432,12 @@
|
|
432
432
|
"core": false,
|
433
433
|
"difficulty": 5,
|
434
434
|
"slug": "run-length-encoding",
|
435
|
-
"topics":
|
435
|
+
"topics": [
|
436
|
+
"strings",
|
437
|
+
"integers",
|
438
|
+
"pattern_matching",
|
439
|
+
"transforming"
|
440
|
+
],
|
436
441
|
"unlocked_by": "rotational-cipher",
|
437
442
|
"uuid": "4499a3f9-73a7-48bf-8753-d5b6abf588c9"
|
438
443
|
},
|
@@ -548,7 +553,13 @@
|
|
548
553
|
"core": false,
|
549
554
|
"difficulty": 6,
|
550
555
|
"slug": "spiral-matrix",
|
551
|
-
"topics":
|
556
|
+
"topics": [
|
557
|
+
"loops",
|
558
|
+
"arrays",
|
559
|
+
"integers",
|
560
|
+
"mathematics",
|
561
|
+
"matrices"
|
562
|
+
],
|
552
563
|
"unlocked_by": "matrix",
|
553
564
|
"uuid": "163fcc6b-c054-4232-a88b-0aded846a6eb"
|
554
565
|
},
|
@@ -917,7 +928,12 @@
|
|
917
928
|
"core": false,
|
918
929
|
"difficulty": 8,
|
919
930
|
"slug": "rectangles",
|
920
|
-
"topics":
|
931
|
+
"topics": [
|
932
|
+
"arrays",
|
933
|
+
"logic",
|
934
|
+
"pattern_recognition",
|
935
|
+
"strings"
|
936
|
+
],
|
921
937
|
"unlocked_by": "robot-name",
|
922
938
|
"uuid": "64cda115-919a-4eef-9a45-9ec5d1af98cc"
|
923
939
|
},
|
@@ -966,7 +982,13 @@
|
|
966
982
|
"core": false,
|
967
983
|
"difficulty": 8,
|
968
984
|
"slug": "list-ops",
|
969
|
-
"topics":
|
985
|
+
"topics": [
|
986
|
+
"filtering",
|
987
|
+
"functional_programming",
|
988
|
+
"generics",
|
989
|
+
"lists",
|
990
|
+
"loops"
|
991
|
+
],
|
970
992
|
"unlocked_by": "linked-list",
|
971
993
|
"uuid": "a9836565-5c39-4285-b83a-53408be36ccc"
|
972
994
|
},
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -4,6 +4,7 @@ import org.junit.Rule;
|
|
4
4
|
import org.junit.rules.ExpectedException;
|
5
5
|
|
6
6
|
import static org.junit.Assert.assertTrue;
|
7
|
+
import static org.junit.Assert.assertFalse;
|
7
8
|
|
8
9
|
public class TriangleTest {
|
9
10
|
|
@@ -19,24 +20,39 @@ public class TriangleTest {
|
|
19
20
|
|
20
21
|
@Ignore("Remove to run test")
|
21
22
|
@Test
|
22
|
-
public void
|
23
|
-
Triangle triangle = new Triangle(
|
23
|
+
public void trianglesWithOneUnequalSideAreNotEquilateral() throws TriangleException {
|
24
|
+
Triangle triangle = new Triangle(2, 3, 2);
|
24
25
|
|
25
|
-
|
26
|
+
assertFalse(triangle.isEquilateral());
|
26
27
|
}
|
27
28
|
|
28
29
|
@Ignore("Remove to run test")
|
29
30
|
@Test
|
30
|
-
public void
|
31
|
-
Triangle triangle = new Triangle(
|
31
|
+
public void trianglesWithNoEqualSidesAreNotEquilateral() throws TriangleException {
|
32
|
+
Triangle triangle = new Triangle(5, 4, 6);
|
32
33
|
|
33
|
-
|
34
|
+
assertFalse(triangle.isEquilateral());
|
35
|
+
}
|
36
|
+
|
37
|
+
@Ignore("Remove to run test")
|
38
|
+
@Test
|
39
|
+
public void trianglesWithNoSizeAreIllegal() throws TriangleException {
|
40
|
+
expectedException.expect(TriangleException.class);
|
41
|
+
new Triangle(0, 0, 0);
|
34
42
|
}
|
35
43
|
|
36
44
|
@Ignore("Remove to run test")
|
37
45
|
@Test
|
38
|
-
public void
|
39
|
-
Triangle triangle = new Triangle(
|
46
|
+
public void verySmallTrianglesCanBeEquilateral() throws TriangleException {
|
47
|
+
Triangle triangle = new Triangle(0.5, 0.5, 0.5);
|
48
|
+
|
49
|
+
assertTrue(triangle.isEquilateral());
|
50
|
+
}
|
51
|
+
|
52
|
+
@Ignore("Remove to run test")
|
53
|
+
@Test
|
54
|
+
public void isoscelesTrianglesHaveLastTwoSidesEqual() throws TriangleException {
|
55
|
+
Triangle triangle = new Triangle(3, 4, 4);
|
40
56
|
|
41
57
|
assertTrue(triangle.isIsosceles());
|
42
58
|
}
|
@@ -48,79 +64,82 @@ public class TriangleTest {
|
|
48
64
|
|
49
65
|
assertTrue(triangle.isIsosceles());
|
50
66
|
}
|
51
|
-
|
67
|
+
|
52
68
|
@Ignore("Remove to run test")
|
53
69
|
@Test
|
54
|
-
public void
|
55
|
-
Triangle triangle = new Triangle(
|
70
|
+
public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws TriangleException {
|
71
|
+
Triangle triangle = new Triangle(4, 3, 4);
|
56
72
|
|
57
73
|
assertTrue(triangle.isIsosceles());
|
58
74
|
}
|
59
75
|
|
60
76
|
@Ignore("Remove to run test")
|
61
77
|
@Test
|
62
|
-
public void
|
63
|
-
Triangle triangle = new Triangle(
|
78
|
+
public void isoscelesTrianglesCanHaveAllSidesEqual() throws TriangleException {
|
79
|
+
Triangle triangle = new Triangle(4, 4, 4);
|
64
80
|
|
65
|
-
assertTrue(triangle.
|
81
|
+
assertTrue(triangle.isIsosceles());
|
66
82
|
}
|
67
83
|
|
68
84
|
@Ignore("Remove to run test")
|
69
85
|
@Test
|
70
|
-
public void
|
71
|
-
Triangle triangle = new Triangle(
|
86
|
+
public void isoscelesTrianglesMustHaveAtLeastTwoEqualSides() throws TriangleException {
|
87
|
+
Triangle triangle = new Triangle(2, 3, 4);
|
72
88
|
|
73
|
-
|
89
|
+
assertFalse(triangle.isIsosceles());
|
74
90
|
}
|
75
|
-
|
91
|
+
|
76
92
|
@Ignore("Remove to run test")
|
77
93
|
@Test
|
78
|
-
public void
|
79
|
-
|
80
|
-
|
81
|
-
assertTrue(triangle.isScalene());
|
94
|
+
public void testSidesThatViolateTriangleInequalityAreNotIsoscelesEvenIfTwoAreEqual() throws TriangleException {
|
95
|
+
expectedException.expect(TriangleException.class);
|
96
|
+
new Triangle(1, 1, 3);
|
82
97
|
}
|
83
98
|
|
84
99
|
@Ignore("Remove to run test")
|
85
100
|
@Test
|
86
|
-
public void
|
87
|
-
Triangle triangle = new Triangle(0.
|
101
|
+
public void verySmallTrianglesCanBeIsosceles() throws TriangleException {
|
102
|
+
Triangle triangle = new Triangle(0.5, 0.4, 0.5);
|
88
103
|
|
89
|
-
assertTrue(triangle.
|
104
|
+
assertTrue(triangle.isIsosceles());
|
90
105
|
}
|
91
106
|
|
92
107
|
@Ignore("Remove to run test")
|
93
108
|
@Test
|
94
|
-
public void
|
95
|
-
|
96
|
-
|
109
|
+
public void scaleneTrianglesHaveNoEqualSides() throws TriangleException {
|
110
|
+
Triangle triangle = new Triangle(5, 4, 6);
|
111
|
+
|
112
|
+
assertTrue(triangle.isScalene());
|
97
113
|
}
|
98
114
|
|
99
115
|
@Ignore("Remove to run test")
|
100
116
|
@Test
|
101
|
-
public void
|
102
|
-
|
103
|
-
|
117
|
+
public void trianglesWithAllSidesEqualAreNotScalene() throws TriangleException {
|
118
|
+
Triangle triangle = new Triangle(4, 4, 4);
|
119
|
+
|
120
|
+
assertFalse(triangle.isScalene());
|
104
121
|
}
|
105
122
|
|
106
123
|
@Ignore("Remove to run test")
|
107
124
|
@Test
|
108
|
-
public void
|
109
|
-
|
110
|
-
new Triangle(1, 1, 3);
|
111
|
-
}
|
125
|
+
public void trianglesWithOneUnequalSideAreNotScalene() throws TriangleException {
|
126
|
+
Triangle triangle = new Triangle(4, 4, 3);
|
112
127
|
|
128
|
+
assertFalse(triangle.isScalene());
|
129
|
+
}
|
130
|
+
|
113
131
|
@Ignore("Remove to run test")
|
114
132
|
@Test
|
115
|
-
public void
|
133
|
+
public void testSidesThatViolateTriangleInequalityAreNotScaleneEvenIfTheyAreAllDifferent() throws TriangleException {
|
116
134
|
expectedException.expect(TriangleException.class);
|
117
|
-
new Triangle(
|
135
|
+
new Triangle(7, 3, 2);
|
118
136
|
}
|
119
137
|
|
120
138
|
@Ignore("Remove to run test")
|
121
139
|
@Test
|
122
|
-
public void
|
123
|
-
|
124
|
-
|
140
|
+
public void verySmallTrianglesCanBeScalene() throws TriangleException {
|
141
|
+
Triangle triangle = new Triangle(0.5, 0.4, 0.6);
|
142
|
+
|
143
|
+
assertTrue(triangle.isScalene());
|
125
144
|
}
|
126
145
|
}
|
@@ -1056,6 +1056,21 @@
|
|
1056
1056
|
"unlocked_by": "prime-factors",
|
1057
1057
|
"uuid" : "910fe904-7e3c-11e7-bb31-be2e44b06b34"
|
1058
1058
|
},
|
1059
|
+
{
|
1060
|
+
"core" : false,
|
1061
|
+
"difficulty" : 1,
|
1062
|
+
"slug" : "collatz-conjecture",
|
1063
|
+
"topics": [
|
1064
|
+
"Control-flow (loops)",
|
1065
|
+
"Control-flow (conditionals)",
|
1066
|
+
"Recursion",
|
1067
|
+
"Integers",
|
1068
|
+
"Algorithms",
|
1069
|
+
"Mathematics"
|
1070
|
+
],
|
1071
|
+
"unlocked_by": "null",
|
1072
|
+
"uuid" : "fd435dad-311a-4c40-9868-70863455831e"
|
1073
|
+
},
|
1059
1074
|
{
|
1060
1075
|
"deprecated": true,
|
1061
1076
|
"slug": "nucleotide-count",
|
@@ -1081,6 +1096,21 @@
|
|
1081
1096
|
"Regular expressions"
|
1082
1097
|
]
|
1083
1098
|
},
|
1099
|
+
{
|
1100
|
+
"core": false,
|
1101
|
+
"difficulty": 1,
|
1102
|
+
"slug": "transpose",
|
1103
|
+
"topics": [
|
1104
|
+
"loops",
|
1105
|
+
"arrays",
|
1106
|
+
"lists",
|
1107
|
+
"matrices",
|
1108
|
+
"strings",
|
1109
|
+
"text_formatting"
|
1110
|
+
],
|
1111
|
+
"unlocked_by": "matrix",
|
1112
|
+
"uuid": "7c024853-0540-473d-b2d9-cad84953c00f"
|
1113
|
+
},
|
1084
1114
|
{
|
1085
1115
|
"uuid": "52c775a4-7ddb-4cba-8a78-8544220bd1b6",
|
1086
1116
|
"slug": "protein-translation",
|
@@ -14,22 +14,22 @@
|
|
14
14
|
{
|
15
15
|
"alumnus": false,
|
16
16
|
"avatar_url": null,
|
17
|
-
"bio":
|
17
|
+
"bio": "I'm a Web Developer with a passion for taking code that is hard to maintain and cleaning, refactoring, and bringing it back into a manageable state",
|
18
18
|
"github_username": "rchavarria",
|
19
|
-
"link_text":
|
20
|
-
"link_url":
|
21
|
-
"name":
|
22
|
-
"show_on_website":
|
19
|
+
"link_text": "Here is where I blog",
|
20
|
+
"link_url": "https://rchavarria.github.io/",
|
21
|
+
"name": "Rubén Chavarría",
|
22
|
+
"show_on_website": true
|
23
23
|
},
|
24
24
|
{
|
25
25
|
"alumnus": false,
|
26
26
|
"avatar_url": null,
|
27
|
-
"bio":
|
27
|
+
"bio": "Brazilian full-stack web developer. Mentor at Thinkful",
|
28
28
|
"github_username": "joelwallis",
|
29
29
|
"link_text": null,
|
30
30
|
"link_url": null,
|
31
31
|
"name": null,
|
32
|
-
"show_on_website":
|
32
|
+
"show_on_website": true
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"alumnus": false,
|
@@ -82,4 +82,4 @@
|
|
82
82
|
"show_on_website": false
|
83
83
|
}
|
84
84
|
]
|
85
|
-
}
|
85
|
+
}
|
@@ -14,7 +14,7 @@ var Candidate = function () {
|
|
14
14
|
var searched = false;
|
15
15
|
var coins = [];
|
16
16
|
|
17
|
-
this.
|
17
|
+
this.searched = function () {
|
18
18
|
searched = true;
|
19
19
|
};
|
20
20
|
|
@@ -52,7 +52,7 @@ Change.prototype.calculate = function (coinArray, target) {
|
|
52
52
|
candidates.fill(0);
|
53
53
|
|
54
54
|
// validation checks up front
|
55
|
-
if (target
|
55
|
+
if (target === 0) return [];
|
56
56
|
|
57
57
|
if (target < 0) {
|
58
58
|
throw new Error( 'Negative totals are not allowed.');
|
@@ -64,34 +64,18 @@ Change.prototype.calculate = function (coinArray, target) {
|
|
64
64
|
|
65
65
|
|
66
66
|
initialize();
|
67
|
-
// printAll();
|
68
|
-
|
69
67
|
|
70
68
|
// process the arrange until everything is searched
|
71
|
-
while (isDone()
|
69
|
+
while (isDone() === false) {
|
72
70
|
let candidate = getNext();
|
73
71
|
branch(candidate);
|
74
|
-
candidate.
|
72
|
+
candidate.searched();
|
75
73
|
}
|
76
|
-
// printAll();
|
77
|
-
|
78
74
|
|
79
75
|
// print the result
|
80
76
|
if (typeof (candidates[target]) !== 'number') {return candidates[target].getCoins();}
|
81
77
|
throw new Error('The total ' + target + ' cannot be represented in the given currency.');
|
82
78
|
|
83
|
-
|
84
|
-
// print the candidate array
|
85
|
-
function printAll() {
|
86
|
-
for (let j = 0; j < candidates.length; j++) {
|
87
|
-
if (typeof (candidates[j]) === 'object') {
|
88
|
-
console.log('index: ' + j + ' ' + candidates[j].getCoins() + ' searched: ' + candidates[j].isSearched());
|
89
|
-
} else {
|
90
|
-
console.log('index: ' + j + ' is empty ' + typeof (candidates[j]));
|
91
|
-
}
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
79
|
// initialize the candidate array with the given coins only
|
96
80
|
function initialize() {
|
97
81
|
for (let j = 0; j < coinArray.length; j++) {
|
@@ -108,7 +92,7 @@ Change.prototype.calculate = function (coinArray, target) {
|
|
108
92
|
for (let i = 0; i < candidates.length; i++) {
|
109
93
|
let temp = candidates[i];
|
110
94
|
if (typeof (temp) !== 'number') {
|
111
|
-
if (temp.isSearched()
|
95
|
+
if (temp.isSearched() === false) {
|
112
96
|
done = false;
|
113
97
|
break;
|
114
98
|
}
|
@@ -122,7 +106,7 @@ Change.prototype.calculate = function (coinArray, target) {
|
|
122
106
|
for (let i = 0; i < candidates.length; i++) {
|
123
107
|
let temp = candidates[i];
|
124
108
|
if (typeof (temp) !== 'number' &&
|
125
|
-
temp.isSearched()
|
109
|
+
temp.isSearched() === false) return temp;
|
126
110
|
}
|
127
111
|
return null;
|
128
112
|
}
|