trackler 2.0.6.40 → 2.0.6.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/book-store/canonical-data.json +7 -1
  3. data/common/exercises/rotational-cipher/{cannonical-data.json → canonical-data.json} +0 -0
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/c/config.json +9 -0
  6. data/tracks/c/exercises/triangle/makefile +16 -0
  7. data/tracks/c/exercises/triangle/src/example.c +33 -0
  8. data/tracks/c/exercises/triangle/src/example.h +15 -0
  9. data/tracks/c/exercises/triangle/src/triangle.h +10 -0
  10. data/tracks/c/exercises/triangle/test/test_triangle.c +121 -0
  11. data/tracks/c/exercises/triangle/test/vendor/unity.c +1300 -0
  12. data/tracks/c/exercises/triangle/test/vendor/unity.h +274 -0
  13. data/tracks/c/exercises/triangle/test/vendor/unity_internals.h +701 -0
  14. data/tracks/clojure/.gitignore +1 -0
  15. data/tracks/clojure/_src/clock_generator.clj +5 -0
  16. data/tracks/clojure/_src/generator.clj +72 -0
  17. data/tracks/clojure/config.json +6 -0
  18. data/tracks/clojure/exercises/clock/clock.mustache +34 -0
  19. data/tracks/clojure/exercises/clock/project.clj +4 -0
  20. data/tracks/clojure/exercises/clock/src/example.clj +19 -0
  21. data/tracks/clojure/exercises/clock/test/clock_test.clj +177 -0
  22. data/tracks/clojure/project.clj +4 -1
  23. data/tracks/csharp/exercises/poker/Example.cs +1 -1
  24. data/tracks/csharp/exercises/poker/PokerTest.cs +10 -0
  25. data/tracks/erlang/docs/INSTALLATION.md +14 -3
  26. data/tracks/erlang/docs/LEARNING.md +1 -0
  27. data/tracks/go/exercises/gigasecond/gigasecond_test.go +5 -2
  28. data/tracks/go/exercises/grade-school/example.go +2 -0
  29. data/tracks/go/exercises/grade-school/grade_school_test.go +8 -0
  30. data/tracks/go/exercises/hamming/hamming_test.go +1 -1
  31. data/tracks/go/exercises/hello-world/hello_test.go +6 -4
  32. data/tracks/haskell/exercises/accumulate/src/Accumulate.hs +1 -1
  33. data/tracks/haskell/exercises/anagram/src/Anagram.hs +1 -1
  34. data/tracks/java/bin/journey-test.sh +21 -4
  35. data/tracks/java/exercises/allergies/src/example/java/Allergen.java +20 -0
  36. data/tracks/java/exercises/hamming/src/test/java/HammingTest.java +10 -3
  37. data/tracks/java/exercises/luhn/src/example/java/LuhnValidator.java +19 -11
  38. data/tracks/java/exercises/luhn/src/test/java/LuhnValidatorTest.java +43 -1
  39. data/tracks/java/exercises/meetup/src/example/java/MeetupSchedule.java +8 -0
  40. data/tracks/java/exercises/meetup/src/test/java/MeetupTest.java +91 -91
  41. data/tracks/java/exercises/perfect-numbers/src/example/java/Classification.java +5 -0
  42. data/tracks/java/exercises/robot-simulator/src/example/java/GridPosition.java +29 -0
  43. data/tracks/java/exercises/robot-simulator/src/example/java/Orientation.java +5 -0
  44. data/tracks/java/exercises/secret-handshake/src/example/java/Signal.java +5 -0
  45. data/tracks/java/exercises/sublist/src/example/java/Relationship.java +5 -0
  46. data/tracks/java/exercises/triangle/src/example/java/TriangleException.java +5 -0
  47. data/tracks/java/exercises/triangle/src/example/java/TriangleKind.java +5 -0
  48. data/tracks/julia/config.json +10 -1
  49. data/tracks/julia/exercises/atbash-cipher/runtests.jl +36 -36
  50. data/tracks/julia/exercises/pangram/example.jl +2 -0
  51. data/tracks/julia/exercises/pangram/pangram.jl +4 -0
  52. data/tracks/julia/exercises/pangram/runtests.jl +40 -0
  53. data/tracks/perl5/exercises/bob/Example.pm +1 -1
  54. data/tracks/perl5/exercises/bob/bob.t +27 -31
  55. data/tracks/php/exercises/accumulate/accumulate_test.php +1 -1
  56. data/tracks/php/exercises/acronym/acronym_test.php +1 -1
  57. data/tracks/php/exercises/allergies/allergies_test.php +1 -1
  58. data/tracks/php/exercises/anagram/anagram_test.php +1 -1
  59. data/tracks/php/exercises/atbash-cipher/atbash-cipher_test.php +1 -1
  60. data/tracks/php/exercises/beer-song/beer-song_test.php +1 -1
  61. data/tracks/php/exercises/binary/binary_test.php +2 -2
  62. data/tracks/php/exercises/bob/bob_test.php +1 -1
  63. data/tracks/php/exercises/book-store/book-store_test.php +1 -1
  64. data/tracks/php/exercises/bowling/bowling_test.php +1 -1
  65. data/tracks/php/exercises/bracket-push/bracket-push_test.php +1 -1
  66. data/tracks/php/exercises/change/change_test.php +3 -3
  67. data/tracks/php/exercises/clock/clock_test.php +1 -1
  68. data/tracks/php/exercises/connect/connect_test.php +1 -1
  69. data/tracks/php/exercises/difference-of-squares/difference-of-squares_test.php +1 -1
  70. data/tracks/php/exercises/etl/etl_test.php +1 -1
  71. data/tracks/php/exercises/gigasecond/gigasecond_test.php +1 -1
  72. data/tracks/php/exercises/grains/grains_test.php +1 -1
  73. data/tracks/php/exercises/hamming/hamming_test.php +2 -2
  74. data/tracks/php/exercises/hello-world/hello-world_test.php +1 -1
  75. data/tracks/php/exercises/isogram/isogram_test.php +1 -1
  76. data/tracks/php/exercises/largest-series-product/largest-series-product_test.php +1 -1
  77. data/tracks/php/exercises/leap/leap_test.php +1 -1
  78. data/tracks/php/exercises/markdown/markdown_test.php +1 -1
  79. data/tracks/php/exercises/minesweeper/minesweeper_test.php +7 -7
  80. data/tracks/php/exercises/nucleotide-count/nucleotide-count_test.php +1 -1
  81. data/tracks/php/exercises/ocr-numbers/ocr-numbers_test.php +1 -1
  82. data/tracks/php/exercises/pangram/pangram_test.php +1 -1
  83. data/tracks/php/exercises/phone-number/phone-number_test.php +1 -1
  84. data/tracks/php/exercises/pig-latin/pig-latin_test.php +1 -1
  85. data/tracks/php/exercises/raindrops/raindrops_test.php +1 -1
  86. data/tracks/php/exercises/rna-transcription/rna-transcription_test.php +1 -1
  87. data/tracks/php/exercises/robot-name/robot-name_test.php +1 -1
  88. data/tracks/php/exercises/robot-simulator/robot-simulator_test.php +1 -1
  89. data/tracks/php/exercises/roman-numerals/roman-numerals_test.php +1 -1
  90. data/tracks/php/exercises/sieve/sieve_test.php +1 -1
  91. data/tracks/php/exercises/space-age/space-age_test.php +1 -1
  92. data/tracks/php/exercises/triangle/triangle_test.php +1 -1
  93. data/tracks/php/exercises/trinary/trinary_test.php +1 -1
  94. data/tracks/php/exercises/variable-length-quantity/variable-length-quantity_test.php +3 -3
  95. data/tracks/php/exercises/word-count/word-count_test.php +1 -1
  96. data/tracks/php/exercises/wordy/wordy_test.php +3 -3
  97. data/tracks/python/config.json +3 -13
  98. data/tracks/python/exercises/rectangles/rectangles_count_test.py +15 -22
  99. data/tracks/scala/config.json +684 -665
  100. data/tracks/scala/exercises/binary-search/build.sbt +3 -0
  101. data/tracks/scala/exercises/binary-search/example.scala +23 -0
  102. data/tracks/scala/exercises/binary-search/src/main/scala/BinarySearch.scala +0 -0
  103. data/tracks/scala/exercises/binary-search/src/test/scala/BinarySearchTest.scala +63 -0
  104. data/tracks/scala/exercises/strain/build.sbt +3 -0
  105. data/tracks/scala/exercises/strain/example.scala +22 -0
  106. data/tracks/scala/exercises/strain/src/main/scala/Strain.scala +0 -0
  107. data/tracks/scala/exercises/strain/src/test/scala/StrainTest.scala +78 -0
  108. data/tracks/scala/testgen/src/main/scala/AllYourBaseTestGenerator.scala +13 -20
  109. data/tracks/scala/testgen/src/main/scala/BinarySearchTestGenerator.scala +48 -0
  110. data/tracks/scala/testgen/src/main/scala/BowlingTestGenerator.scala +24 -32
  111. data/tracks/scala/testgen/src/main/scala/CustomSetTestGenerator.scala +148 -112
  112. data/tracks/scala/testgen/src/main/scala/TestBuilder.scala +86 -0
  113. metadata +30 -3
  114. data/tracks/java/exercises/allergies/src/example/java/Allergen.java +0 -1
  115. data/tracks/java/exercises/meetup/src/example/java/MeetupSchedule.java +0 -1
  116. data/tracks/java/exercises/perfect-numbers/src/example/java/Classification.java +0 -1
  117. data/tracks/java/exercises/robot-simulator/src/example/java/GridPosition.java +0 -1
  118. data/tracks/java/exercises/robot-simulator/src/example/java/Orientation.java +0 -1
  119. data/tracks/java/exercises/secret-handshake/src/example/java/Signal.java +0 -1
  120. data/tracks/java/exercises/sublist/src/example/java/Relationship.java +0 -1
  121. data/tracks/java/exercises/triangle/src/example/java/TriangleException.java +0 -1
  122. data/tracks/java/exercises/triangle/src/example/java/TriangleKind.java +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9dd7b33f1e64f5706eb217f9a9fd9bea021b045
4
- data.tar.gz: 8209d45d738da47c10ed9d039910330f1f4d6d43
3
+ metadata.gz: 8a0eb8e8f6259e62c8da17ca7ac0eefaba3d5e97
4
+ data.tar.gz: 47716a522574a595c6d5ee22065df620e969ffb4
5
5
  SHA512:
6
- metadata.gz: 52e6304330e158e3c2587e1cd9951a9cca505bbc2c01d096de577b48d2ec2d6810623337c31e00ce522ccc303744cd6b9be5d055abd3edb453a507b39893cd55
7
- data.tar.gz: 9aaec6c5a8d50017273f72c566b78d77337c7fe80ea078c00880df61b00d15fd8b80ab1361d7f976ce4eb74b41beeac62784a5c111b46647e5fd2312d01ec585
6
+ metadata.gz: a223ce1ceebc06956d09fda5aee39e7227a773cbbe684f871f036ae05c0a18aea9aff606571237f2dae98c4bfabc6e97567a5392aa6837a78ddf47d705787bc2
7
+ data.tar.gz: 19a3b26186351a315f71436f3ad1d8a83119d7e95722304eb95c97ff1e1690a36a810d7194e4f37bf85ac1dc012221ef69406e4eaeef17eba262868ec8e87b3c
@@ -52,11 +52,17 @@
52
52
  "expected": 30.00
53
53
  },
54
54
  {
55
- "description": "Two each of first 3 books and 1 copy each of rest",
55
+ "description": "Two groups of four is cheaper than group of five plus group of three",
56
56
  "basket": [1,1,2,2,3,3,4,5],
57
57
  "targetgrouping": [[1,2,3,4],[1,2,3,5]],
58
58
  "expected": 51.20
59
59
  },
60
+ {
61
+ "description": "Group of four plus group of two is cheaper than two groups of three",
62
+ "basket": [1,1,2,2,3,4],
63
+ "targetgrouping": [[1,2,3,4],[1,2]],
64
+ "expected": 40.8
65
+ },
60
66
  {
61
67
  "description": "Two each of first 4 books and 1 copy each of rest",
62
68
  "basket": [1,1,2,2,3,3,4,4,5],
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.6.40"
2
+ VERSION = "2.0.6.41"
3
3
  end
data/tracks/c/config.json CHANGED
@@ -216,6 +216,15 @@
216
216
  "variable argument lists",
217
217
  "pointers"
218
218
  ]
219
+ }, {
220
+ "difficulty": 1,
221
+ "slug": "triangle",
222
+ "topics": [
223
+ "control-flow (if-else statements)",
224
+ "Booleans",
225
+ "Structs",
226
+ "Mathematics"
227
+ ]
219
228
  }, {
220
229
  "difficulty": 1,
221
230
  "slug": "binary",
@@ -0,0 +1,16 @@
1
+ CFLAGS = -std=c99
2
+ CFLAGS += -Wall
3
+ CFLAGS += -Wextra
4
+ CFLAGS += -pedantic
5
+ CFLAGS += -Werror
6
+
7
+
8
+ test: tests.out
9
+ @./tests.out
10
+
11
+ clean:
12
+ rm -f *.o *.out
13
+
14
+ tests.out: test/test_triangle.c src/triangle.c src/triangle.h
15
+ @echo Compiling $@
16
+ @cc $(CFLAGS) src/triangle.c test/vendor/unity.c test/test_triangle.c -o tests.out
@@ -0,0 +1,33 @@
1
+ #include "triangle.h"
2
+
3
+ bool triangle_equality(Triangle_t * input)
4
+ {
5
+ return (input->a < (input->b + input->c)
6
+ && input->b < (input->a + input->c)
7
+ && input->c < (input->a + input->b)
8
+ );
9
+ }
10
+
11
+ bool is_equilateral(Triangle_t * input)
12
+ {
13
+ return (triangle_equality(input)
14
+ && (input->a == input->b)
15
+ && (input->b == input->c)
16
+ );
17
+ }
18
+
19
+ bool is_isosceles(Triangle_t * input)
20
+ {
21
+ return (triangle_equality(input) && ((input->a == input->b)
22
+ || (input->b == input->c)
23
+ || (input->a == input->c))
24
+ );
25
+ }
26
+
27
+ bool is_scalene(Triangle_t * input)
28
+ {
29
+ return (!(is_equilateral(input))
30
+ && !(is_isosceles(input))
31
+ && triangle_equality(input)
32
+ );
33
+ }
@@ -0,0 +1,15 @@
1
+ #ifndef TRIANGLE_H
2
+ #define TRIANGLE_H
3
+ #include <stdbool.h>
4
+
5
+ typedef struct {
6
+ double a;
7
+ double b;
8
+ double c;
9
+ } Triangle_t;
10
+
11
+ bool is_equilateral(Triangle_t * input);
12
+ bool is_isosceles(Triangle_t * input);
13
+ bool is_scalene(Triangle_t * input);
14
+
15
+ #endif
@@ -0,0 +1,10 @@
1
+ #ifndef TRIANGLE_H
2
+ #define TRIANGLE_H
3
+
4
+ typedef struct {
5
+ double a;
6
+ double b;
7
+ double c;
8
+ } Triangle_t;
9
+
10
+ #endif
@@ -0,0 +1,121 @@
1
+ #include "vendor/unity.h"
2
+ #include "../src/triangle.h"
3
+
4
+ void test_equilateral_is_true_if_all_sides_are_equal(void)
5
+ {
6
+ Triangle_t sides = { 2, 2, 2 };
7
+ TEST_ASSERT_TRUE(is_equilateral(&sides));
8
+ }
9
+
10
+ void test_equilateral_is_false_if_any_side_is_unequal(void)
11
+ {
12
+ Triangle_t sides = { 2, 3, 2 };
13
+ TEST_ASSERT_FALSE(is_equilateral(&sides));
14
+ }
15
+
16
+ void test_equilateral_is_false_if_all_sides_zero(void)
17
+ {
18
+ Triangle_t sides = { 0, 0, 0 };
19
+ TEST_ASSERT_FALSE(is_equilateral(&sides));
20
+ }
21
+
22
+ void test_equilateral_sides_may_be_floats(void)
23
+ {
24
+ Triangle_t sides = { 0.5, 0.5, 0.5 };
25
+ TEST_ASSERT_TRUE(is_equilateral(&sides));
26
+ }
27
+
28
+ void test_isosceles_is_true_if_last_two_sides_are_equal(void)
29
+ {
30
+ Triangle_t sides = { 3, 4, 4 };
31
+ TEST_ASSERT_TRUE(is_isosceles(&sides));
32
+ }
33
+
34
+ void test_isosceles_is_true_if_first_two_sides_are_equal(void)
35
+ {
36
+ Triangle_t sides = { 4, 4, 3 };
37
+ TEST_ASSERT_TRUE(is_isosceles(&sides));
38
+ }
39
+
40
+ void test_isosceles_is_true_if_first_and_last_sides_are_equal(void)
41
+ {
42
+ Triangle_t sides = { 4, 3, 4 };
43
+ TEST_ASSERT_TRUE(is_isosceles(&sides));
44
+ }
45
+
46
+ void test_equilateral_triangles_are_also_isosceles(void)
47
+ {
48
+ Triangle_t sides = { 4, 4, 4 };
49
+ TEST_ASSERT_TRUE(is_isosceles(&sides));
50
+ }
51
+
52
+ void test_isosceles_is_false_if_no_sides_are_equal(void)
53
+ {
54
+ Triangle_t sides = { 2, 3, 4 };
55
+ TEST_ASSERT_FALSE(is_isosceles(&sides));
56
+ }
57
+
58
+ void test_isosceles_is_false_if_two_sides_equal_and_violate_inequality(void)
59
+ {
60
+ Triangle_t sides = { 1, 1, 3 };
61
+ TEST_ASSERT_FALSE(is_isosceles(&sides));
62
+ }
63
+
64
+ void test_isosceles_sides_may_be_floats(void)
65
+ {
66
+ Triangle_t sides = { 0.5, 0.4, 0.5 };
67
+ TEST_ASSERT_TRUE(is_isosceles(&sides));
68
+ }
69
+
70
+ void test_scalene_is_true_if_no_sides_are_equal(void)
71
+ {
72
+ Triangle_t sides = { 5, 4, 6 };
73
+ TEST_ASSERT_TRUE(is_scalene(&sides));
74
+ }
75
+
76
+ void test_scalene_is_false_if_all_sides_are_equal(void)
77
+ {
78
+ Triangle_t sides = { 4, 4, 4 };
79
+ TEST_ASSERT_FALSE(is_scalene(&sides));
80
+ }
81
+
82
+ void test_scalene_is_false_if_two_sides_are_equal(void)
83
+ {
84
+ Triangle_t sides = { 4, 4, 3 };
85
+ TEST_ASSERT_FALSE(is_scalene(&sides));
86
+ }
87
+
88
+ void test_scalene_is_false_if_no_sides_equal_and_violate_inequality(void)
89
+ {
90
+ Triangle_t sides = { 7, 3, 2 };
91
+ TEST_ASSERT_FALSE(is_scalene(&sides));
92
+ }
93
+
94
+ void test_scalene_sides_may_be_floats(void)
95
+ {
96
+ Triangle_t sides = { 0.5, 0.4, 0.6 };
97
+ TEST_ASSERT_TRUE(is_scalene(&sides));
98
+ }
99
+
100
+ int main(void)
101
+ {
102
+ UnityBegin("test/test_triangle.c");
103
+ RUN_TEST(test_equilateral_is_true_if_all_sides_are_equal);
104
+ RUN_TEST(test_equilateral_is_false_if_any_side_is_unequal);
105
+ RUN_TEST(test_equilateral_is_false_if_all_sides_zero);
106
+ RUN_TEST(test_equilateral_sides_may_be_floats);
107
+ RUN_TEST(test_isosceles_is_true_if_last_two_sides_are_equal);
108
+ RUN_TEST(test_isosceles_is_true_if_first_two_sides_are_equal);
109
+ RUN_TEST(test_isosceles_is_true_if_first_and_last_sides_are_equal);
110
+ RUN_TEST(test_equilateral_triangles_are_also_isosceles);
111
+ RUN_TEST(test_isosceles_is_false_if_no_sides_are_equal);
112
+ RUN_TEST(test_isosceles_is_false_if_two_sides_equal_and_violate_inequality);
113
+ RUN_TEST(test_isosceles_sides_may_be_floats);
114
+ RUN_TEST(test_scalene_is_true_if_no_sides_are_equal);
115
+ RUN_TEST(test_scalene_is_false_if_all_sides_are_equal);
116
+ RUN_TEST(test_scalene_is_false_if_two_sides_are_equal);
117
+ RUN_TEST(test_scalene_is_false_if_no_sides_equal_and_violate_inequality);
118
+ RUN_TEST(test_scalene_sides_may_be_floats);
119
+ UnityEnd();
120
+ return 0;
121
+ }