trackler 2.0.8.22 → 2.0.8.23
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/tracks/csharp/exercises/accumulate/HINTS.md +1 -2
- data/tracks/csharp/exercises/nth-prime/HINTS.md +7 -0
- data/tracks/csharp/exercises/proverb/HINTS.md +3 -0
- data/tracks/go/exercises/trinary/trinary_test.go +1 -1
- data/tracks/go/exercises/twelve-days/twelve_days_test.go +6 -6
- data/tracks/java/.Rhistory +0 -0
- data/tracks/java/config.json +12 -0
- data/tracks/java/exercises/book-store/build.gradle +17 -0
- data/tracks/java/exercises/book-store/src/example/java/.keep +0 -0
- data/tracks/java/exercises/book-store/src/example/java/Bookstore.java +61 -0
- data/tracks/java/exercises/book-store/src/main/java/.keep +0 -0
- data/tracks/java/exercises/book-store/src/test/java/.keep +0 -0
- data/tracks/java/exercises/book-store/src/test/java/BookstoreTest.java +117 -0
- data/tracks/java/exercises/hamming/src/example/java/Hamming.java +11 -2
- data/tracks/java/exercises/hamming/src/test/java/HammingTest.java +9 -10
- data/tracks/java/exercises/isogram/build.gradle +17 -0
- data/tracks/java/exercises/isogram/src/example/java/IsogramChecker.java +34 -0
- data/tracks/java/exercises/isogram/src/main/java/.keep +0 -0
- data/tracks/java/exercises/isogram/src/test/java/IsogramTest.java +80 -0
- data/tracks/java/exercises/raindrops/src/example/java/{Raindrops.java → RaindropConverter.java} +2 -2
- data/tracks/java/exercises/raindrops/src/test/java/{RaindropsTest.java → RaindropConverterTest.java} +3 -3
- data/tracks/java/exercises/settings.gradle +2 -0
- data/tracks/ocaml/.vscode/launch.json +13 -0
- data/tracks/ocaml/config.json +5 -0
- data/tracks/ocaml/exercises/beer-song/test.ml +15 -7
- data/tracks/ocaml/exercises/phone-number/test.ml +2 -2
- data/tracks/ocaml/exercises/prime-factors/test.ml +20 -16
- data/tracks/ocaml/exercises/roman-numerals/test.ml +40 -22
- data/tracks/ocaml/exercises/run-length-encoding/test.ml +6 -4
- data/tracks/ocaml/exercises/space-age/test.ml +20 -35
- data/tracks/ocaml/exercises/triangle/.merlin +5 -0
- data/tracks/ocaml/exercises/triangle/Makefile +11 -0
- data/tracks/ocaml/exercises/triangle/example.ml +17 -0
- data/tracks/ocaml/exercises/triangle/test.ml +48 -0
- data/tracks/ocaml/exercises/triangle/triangle.mli +5 -0
- data/tracks/ocaml/tools/test-generator/.merlin +0 -1
- data/tracks/ocaml/tools/test-generator/Makefile +3 -0
- data/tracks/ocaml/tools/test-generator/src/codegen.ml +1 -1
- data/tracks/ocaml/tools/test-generator/src/controller.ml +22 -10
- data/tracks/ocaml/tools/test-generator/src/debug.ml +12 -0
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +8 -0
- data/tracks/ocaml/tools/test-generator/src/template.ml +91 -41
- data/tracks/ocaml/tools/test-generator/src/test_gen.ml +2 -1
- data/tracks/ocaml/tools/test-generator/templates/atbash-cipher/template.ml +11 -3
- data/tracks/ocaml/tools/test-generator/templates/beer-song/template.ml +13 -3
- data/tracks/ocaml/tools/test-generator/templates/difference-of-squares/template.ml +17 -3
- data/tracks/ocaml/tools/test-generator/templates/prime-factors/template.ml +25 -0
- data/tracks/ocaml/tools/test-generator/templates/roman-numerals/template.ml +15 -0
- data/tracks/ocaml/tools/test-generator/templates/run-length-encoding/template.ml +19 -3
- data/tracks/ocaml/tools/test-generator/templates/space-age/template.ml +19 -0
- data/tracks/ocaml/tools/test-generator/templates/triangle/template.ml +33 -0
- data/tracks/ocaml/tools/test-generator/test/template_test.ml +8 -7
- data/tracks/powershell/exercises/hamming/hamming.tests.ps1 +4 -4
- metadata +28 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a1f212f5e5a8fe0bd77c82df4bb702031173e6a
|
4
|
+
data.tar.gz: f69ad361660445af45147b30a15af3bb30028a46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c6afffb4a75f583baf4673a4b88c6b8f27ec0d9c91732abdd13823ac97e1663c24b14b891477fddc97e273997a09df02ec50590909400960a0e8a6f9aebc6e
|
7
|
+
data.tar.gz: ca2bbf86a9563cb67f6577505b5e7a7bce225cbdc6edb380cd7595b9a868e5661384ffbec352580083aa0b67564e329195a8612d74a47084e47b46fe5d6b6f23
|
data/lib/trackler/version.rb
CHANGED
@@ -1,3 +1,2 @@
|
|
1
1
|
## Hints
|
2
|
-
This exercise requires you to write an extension method. For more information, see [this page]
|
3
|
-
(https://msdn.microsoft.com/en-us//library/bb383977.aspx).
|
2
|
+
This exercise requires you to write an extension method. For more information, see [this page](https://msdn.microsoft.com/en-us//library/bb383977.aspx).
|
@@ -0,0 +1,7 @@
|
|
1
|
+
## Hints
|
2
|
+
|
3
|
+
For this exercise the following C# feature comes in handy:
|
4
|
+
Enumerables are evaluated lazily. They allow you to work with an infinite sequence of values.
|
5
|
+
See [this article](https://blogs.msdn.microsoft.com/pedram/2007/06/02/lazy-evaluation-in-c/).
|
6
|
+
|
7
|
+
Note: to help speedup calculation, you should not check numbers which you know beforehand will never be prime. For more information, see the [Sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes).
|
@@ -22,7 +22,7 @@ var tests = []struct {
|
|
22
22
|
|
23
23
|
func TestTestVersion(t *testing.T) {
|
24
24
|
if testVersion != targetTestVersion {
|
25
|
-
t.
|
25
|
+
t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
|
26
26
|
}
|
27
27
|
}
|
28
28
|
|
@@ -52,6 +52,12 @@ func diff(got, want string) string {
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
|
55
|
+
func TestTestVersion(t *testing.T) {
|
56
|
+
if testVersion != targetTestVersion {
|
57
|
+
t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
55
61
|
func TestSong(t *testing.T) {
|
56
62
|
var expected = ""
|
57
63
|
for _, test := range testCases {
|
@@ -71,9 +77,3 @@ func TestVerse(t *testing.T) {
|
|
71
77
|
}
|
72
78
|
}
|
73
79
|
}
|
74
|
-
|
75
|
-
func TestTestVersion(t *testing.T) {
|
76
|
-
if testVersion != targetTestVersion {
|
77
|
-
t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
|
78
|
-
}
|
79
|
-
}
|
File without changes
|
data/tracks/java/config.json
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
"language": "Java",
|
4
4
|
"repository": "https://github.com/exercism/xjava",
|
5
5
|
"active": true,
|
6
|
+
|
6
7
|
"exercises": [
|
7
8
|
{
|
8
9
|
"slug": "hello-world",
|
@@ -313,6 +314,16 @@
|
|
313
314
|
"slug": "ocr-numbers",
|
314
315
|
"difficulty": 1,
|
315
316
|
"topics": []
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"slug": "isogram",
|
320
|
+
"difficulty": 1,
|
321
|
+
"topics": []
|
322
|
+
},
|
323
|
+
{
|
324
|
+
"slug": "book-store",
|
325
|
+
"difficulty": 1,
|
326
|
+
"topics": []
|
316
327
|
}
|
317
328
|
],
|
318
329
|
"deprecated": [
|
@@ -335,3 +346,4 @@
|
|
335
346
|
"say"
|
336
347
|
]
|
337
348
|
}
|
349
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
apply plugin: "java"
|
2
|
+
apply plugin: "eclipse"
|
3
|
+
apply plugin: "idea"
|
4
|
+
|
5
|
+
repositories {
|
6
|
+
mavenCentral()
|
7
|
+
}
|
8
|
+
|
9
|
+
dependencies {
|
10
|
+
testCompile "junit:junit:4.12"
|
11
|
+
}
|
12
|
+
test {
|
13
|
+
testLogging {
|
14
|
+
exceptionFormat = 'full'
|
15
|
+
events = ["passed", "failed", "skipped"]
|
16
|
+
}
|
17
|
+
}
|
File without changes
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import java.awt.print.Printable;
|
2
|
+
import java.util.ArrayList;
|
3
|
+
import java.util.Arrays;
|
4
|
+
import java.util.List;
|
5
|
+
import java.util.stream.Collectors;
|
6
|
+
|
7
|
+
public class Bookstore{
|
8
|
+
|
9
|
+
private static int BOOK_PRICE = 8, MAX_GROUP_SIZE = 5;
|
10
|
+
private List<Integer> books;
|
11
|
+
private static double[] DISCOUNT_TIERS = {0,5,10,20,25};
|
12
|
+
|
13
|
+
public Bookstore (List<Integer> books){
|
14
|
+
this.books = books;
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
public double calculateTotalCost(){
|
21
|
+
return calculateTotalCost(this.books,0);
|
22
|
+
}
|
23
|
+
|
24
|
+
private double calculateTotalCost (List<Integer> books,double priceSoFar ){
|
25
|
+
double minPrice = Double.MAX_VALUE;
|
26
|
+
|
27
|
+
|
28
|
+
if(books.size() == 0){
|
29
|
+
return priceSoFar;
|
30
|
+
}
|
31
|
+
|
32
|
+
List<Integer> groups = (ArrayList<Integer>) books.stream().distinct().collect(Collectors.toList());
|
33
|
+
|
34
|
+
|
35
|
+
double price = 0;
|
36
|
+
|
37
|
+
for(int i = 0;i<groups.size();i++){
|
38
|
+
books.remove(groups.get(i));
|
39
|
+
}
|
40
|
+
|
41
|
+
try {
|
42
|
+
price = calculateTotalCost(books,priceSoFar + costPerGroup(groups.size()));
|
43
|
+
} catch (Exception e) {
|
44
|
+
e.printStackTrace();
|
45
|
+
}
|
46
|
+
|
47
|
+
minPrice = Math.min(minPrice, price);
|
48
|
+
return minPrice;
|
49
|
+
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
private double costPerGroup(int groupSize) throws Exception{
|
54
|
+
if (groupSize < 1 || groupSize > MAX_GROUP_SIZE){
|
55
|
+
throw new Exception("Invalid group size : " + groupSize );
|
56
|
+
}
|
57
|
+
return BOOK_PRICE * groupSize * (100 - DISCOUNT_TIERS[groupSize-1])/100;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
}
|
File without changes
|
File without changes
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import static org.junit.Assert.assertEquals;
|
2
|
+
|
3
|
+
import java.util.List;
|
4
|
+
import java.util.ArrayList;
|
5
|
+
import java.util.Arrays;
|
6
|
+
|
7
|
+
import org.junit.Test;
|
8
|
+
|
9
|
+
public class BookstoreTest{
|
10
|
+
|
11
|
+
@Test
|
12
|
+
public void onlyASingleBook(){
|
13
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1));
|
14
|
+
Bookstore bookstore = new Bookstore(books);
|
15
|
+
assertEquals(8,bookstore.calculateTotalCost(),2);
|
16
|
+
}
|
17
|
+
|
18
|
+
@Ignore
|
19
|
+
@Test
|
20
|
+
public void twoOfSameBook(){
|
21
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1));
|
22
|
+
Bookstore bookstore = new Bookstore(books);
|
23
|
+
assertEquals(16,bookstore.calculateTotalCost(),2);
|
24
|
+
}
|
25
|
+
|
26
|
+
@Ignore
|
27
|
+
@Test
|
28
|
+
public void emptyBasket(){
|
29
|
+
List<Integer> books = new ArrayList<>();
|
30
|
+
Bookstore bookstore = new Bookstore(books);
|
31
|
+
assertEquals(0,bookstore.calculateTotalCost(),2);
|
32
|
+
}
|
33
|
+
|
34
|
+
@Ignore
|
35
|
+
@Test
|
36
|
+
public void twoDifferentBooks(){
|
37
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,2));
|
38
|
+
Bookstore bookstore = new Bookstore(books);
|
39
|
+
assertEquals(15.20,bookstore.calculateTotalCost(),2);
|
40
|
+
}
|
41
|
+
|
42
|
+
@Ignore
|
43
|
+
@Test
|
44
|
+
public void threeDifferentBooks(){
|
45
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,2,3));
|
46
|
+
Bookstore bookstore = new Bookstore(books);
|
47
|
+
assertEquals(21.6,bookstore.calculateTotalCost(),2);
|
48
|
+
}
|
49
|
+
|
50
|
+
@Ignore
|
51
|
+
@Test
|
52
|
+
public void fourDifferentBooks(){
|
53
|
+
ArrayList<Integer> books = new ArrayList<>(Arrays.asList(1,2,3,4));
|
54
|
+
Bookstore bookstore = new Bookstore(books);
|
55
|
+
assertEquals(25.6,bookstore.calculateTotalCost(),2);
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
@Ignore
|
60
|
+
@Test
|
61
|
+
public void fiveDifferentBooks(){
|
62
|
+
ArrayList<Integer> books = new ArrayList<>(Arrays.asList(1,2,3,4,5));
|
63
|
+
Bookstore bookstore = new Bookstore(books);
|
64
|
+
assertEquals(30,bookstore.calculateTotalCost(),2);
|
65
|
+
}
|
66
|
+
|
67
|
+
@Ignore
|
68
|
+
@Test
|
69
|
+
public void twoGroupsOfFourIsCheaperThanGroupOfFivePlusGroupOfThree(){
|
70
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1,2,2,3,3,4,5));
|
71
|
+
Bookstore bookstore = new Bookstore(books);
|
72
|
+
assertEquals(51.20,bookstore.calculateTotalCost(),2);
|
73
|
+
}
|
74
|
+
|
75
|
+
@Ignore
|
76
|
+
@Test
|
77
|
+
public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree(){
|
78
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1,2,2,3,4));
|
79
|
+
Bookstore bookstore = new Bookstore(books);
|
80
|
+
assertEquals(40.8,bookstore.calculateTotalCost(),2);
|
81
|
+
}
|
82
|
+
|
83
|
+
@Ignore
|
84
|
+
@Test
|
85
|
+
public void twoEachOfFirst4BooksAnd1CopyEachOfRest(){
|
86
|
+
Integer[] p = {1,1,2,2,3,3,4,4,5};
|
87
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1,2,2,3,3,4,4,5));
|
88
|
+
Bookstore bookstore = new Bookstore(books);
|
89
|
+
assertEquals(55.60,bookstore.calculateTotalCost(),2);
|
90
|
+
}
|
91
|
+
|
92
|
+
@Ignore
|
93
|
+
@Test
|
94
|
+
public void twoCopiesOfEachBook(){
|
95
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1,2,2,3,3,4,4,5,5));
|
96
|
+
Bookstore bookstore = new Bookstore(books);
|
97
|
+
assertEquals(60.00,bookstore.calculateTotalCost(),2);
|
98
|
+
}
|
99
|
+
|
100
|
+
@Ignore
|
101
|
+
@Test
|
102
|
+
public void threeCopiesOfFirstBookAnd2EachOfRemaining(){
|
103
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1,2,2,3,3,4,4,5,5,1));
|
104
|
+
Bookstore bookstore = new Bookstore(books);
|
105
|
+
assertEquals(68.00,bookstore.calculateTotalCost(),2);
|
106
|
+
}
|
107
|
+
|
108
|
+
@Ignore
|
109
|
+
@Test
|
110
|
+
public void threeEachOFirst2BooksAnd2EachOfRemainingBooks(){
|
111
|
+
List<Integer> books = new ArrayList<>(Arrays.asList(1,1,2,2,3,3,4,4,5,5,1,2));
|
112
|
+
Bookstore bookstore = new Bookstore(books);
|
113
|
+
assertEquals(75.20,bookstore.calculateTotalCost(),2);
|
114
|
+
}
|
115
|
+
|
116
|
+
}
|
117
|
+
|
@@ -1,6 +1,15 @@
|
|
1
1
|
public class Hamming {
|
2
|
+
private final int hammingDistance;
|
2
3
|
|
3
|
-
public
|
4
|
+
public Hamming(String leftStrand, String rightStrand) {
|
5
|
+
hammingDistance = computeHammingDistance(leftStrand, rightStrand);
|
6
|
+
}
|
7
|
+
|
8
|
+
public int getHammingDistance() {
|
9
|
+
return hammingDistance;
|
10
|
+
}
|
11
|
+
|
12
|
+
private int computeHammingDistance(String leftStrand, String rightStrand) {
|
4
13
|
if(leftStrand.length() != rightStrand.length()) {
|
5
14
|
throw new IllegalArgumentException("leftStrand and rightStrand must be of equal length.");
|
6
15
|
}
|
@@ -13,7 +22,7 @@ public class Hamming {
|
|
13
22
|
return distance;
|
14
23
|
}
|
15
24
|
|
16
|
-
private
|
25
|
+
private int hammingContributionAt(int index, String leftStrand, String rightStrand) {
|
17
26
|
return leftStrand.charAt(index) != rightStrand.charAt(index) ? 1 : 0;
|
18
27
|
}
|
19
28
|
|
@@ -7,64 +7,63 @@ import org.junit.Rule;
|
|
7
7
|
import org.junit.rules.ExpectedException;
|
8
8
|
|
9
9
|
public class HammingTest {
|
10
|
-
|
11
10
|
|
12
11
|
@Rule
|
13
12
|
public ExpectedException thrown = ExpectedException.none();
|
14
13
|
|
15
14
|
@Test
|
16
15
|
public void testNoDifferenceBetweenIdenticalStrands() {
|
17
|
-
assertThat(Hamming
|
16
|
+
assertThat(new Hamming("A", "A").getHammingDistance(), is(0));
|
18
17
|
}
|
19
18
|
|
20
19
|
@Ignore
|
21
20
|
@Test
|
22
21
|
public void testHammingDistanceForSingleNucleotideStrand() {
|
23
|
-
assertThat(Hamming
|
22
|
+
assertThat(new Hamming("A", "G").getHammingDistance(), is(1));
|
24
23
|
}
|
25
24
|
|
26
25
|
@Ignore
|
27
26
|
@Test
|
28
27
|
public void testHammingDistanceForSmallStrand() {
|
29
|
-
assertThat(Hamming
|
28
|
+
assertThat(new Hamming("AG", "CT").getHammingDistance(), is(2));
|
30
29
|
}
|
31
30
|
|
32
31
|
@Ignore
|
33
32
|
@Test
|
34
33
|
public void testSmallHammingDistance() {
|
35
|
-
assertThat(Hamming
|
34
|
+
assertThat(new Hamming("AT", "CT").getHammingDistance(), is(1));
|
36
35
|
}
|
37
36
|
|
38
37
|
@Ignore
|
39
38
|
@Test
|
40
39
|
public void testSmallHammingDistanceInLongerStrand() {
|
41
|
-
assertThat(Hamming
|
40
|
+
assertThat(new Hamming("GGACG", "GGTCG").getHammingDistance(), is(1));
|
42
41
|
}
|
43
42
|
|
44
43
|
@Ignore
|
45
44
|
@Test
|
46
45
|
public void testValidatesFirstStrandNotLonger() {
|
47
46
|
thrown.expect(IllegalArgumentException.class);
|
48
|
-
Hamming
|
47
|
+
new Hamming("AAAG", "AAA");
|
49
48
|
}
|
50
49
|
|
51
50
|
@Ignore
|
52
51
|
@Test
|
53
52
|
public void testValidatesOtherStrandNotLonger() {
|
54
53
|
thrown.expect(IllegalArgumentException.class);
|
55
|
-
Hamming
|
54
|
+
new Hamming("AAA", "AAAG");
|
56
55
|
}
|
57
56
|
|
58
57
|
@Ignore
|
59
58
|
@Test
|
60
59
|
public void testLargeHammingDistance() {
|
61
|
-
assertThat(Hamming
|
60
|
+
assertThat(new Hamming("GATACA", "GCATAA").getHammingDistance(), is(4));
|
62
61
|
}
|
63
62
|
|
64
63
|
@Ignore
|
65
64
|
@Test
|
66
65
|
public void testHammingDistanceInVeryLongStrand() {
|
67
|
-
assertThat(Hamming
|
66
|
+
assertThat(new Hamming("GGACGGATTCTG", "AGGACGGATTCT").getHammingDistance(), is(9));
|
68
67
|
}
|
69
68
|
|
70
69
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
apply plugin: "java"
|
2
|
+
apply plugin: "eclipse"
|
3
|
+
apply plugin: "idea"
|
4
|
+
|
5
|
+
repositories {
|
6
|
+
mavenCentral()
|
7
|
+
}
|
8
|
+
|
9
|
+
dependencies {
|
10
|
+
testCompile "junit:junit:4.12"
|
11
|
+
}
|
12
|
+
test {
|
13
|
+
testLogging {
|
14
|
+
exceptionFormat = 'full'
|
15
|
+
events = ["passed", "failed", "skipped"]
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
package example;
|
2
|
+
|
3
|
+
import java.util.HashSet;
|
4
|
+
import java.util.Set;
|
5
|
+
import static java.util.Arrays.stream;
|
6
|
+
import static java.util.stream.Collectors.joining;
|
7
|
+
|
8
|
+
public class IsogramChecker {
|
9
|
+
|
10
|
+
public IsogramChecker(){
|
11
|
+
}
|
12
|
+
|
13
|
+
public boolean isIsogram(String word){
|
14
|
+
|
15
|
+
Set<Character> charSet = new HashSet<>();
|
16
|
+
|
17
|
+
String[] words = word.split(" ");
|
18
|
+
String newWord = concat(words);
|
19
|
+
|
20
|
+
words = newWord.split("-");
|
21
|
+
newWord = concat(words).toLowerCase();
|
22
|
+
|
23
|
+
for(int i = 0; i < newWord.length(); i++){
|
24
|
+
charSet.add(newWord.charAt(i));
|
25
|
+
}
|
26
|
+
|
27
|
+
return charSet.size() == newWord.length();
|
28
|
+
}
|
29
|
+
|
30
|
+
private String concat(String[] words){
|
31
|
+
return stream(words).collect(joining());
|
32
|
+
}
|
33
|
+
|
34
|
+
}
|
File without changes
|
@@ -0,0 +1,80 @@
|
|
1
|
+
package test;
|
2
|
+
|
3
|
+
import static org.junit.Assert.*;
|
4
|
+
|
5
|
+
import org.junit.Ignore;
|
6
|
+
import org.junit.Test;
|
7
|
+
import example.IsogramChecker;
|
8
|
+
|
9
|
+
public class IsogramTest {
|
10
|
+
|
11
|
+
@Test
|
12
|
+
public void testIsogram() {
|
13
|
+
IsogramChecker iso = new IsogramChecker();
|
14
|
+
assertTrue(iso.isIsogram("duplicates"));
|
15
|
+
}
|
16
|
+
|
17
|
+
@Ignore
|
18
|
+
@Test
|
19
|
+
public void testNotIsogram() {
|
20
|
+
IsogramChecker iso = new IsogramChecker();
|
21
|
+
assertFalse(iso.isIsogram("eleven"));
|
22
|
+
}
|
23
|
+
|
24
|
+
@Ignore
|
25
|
+
@Test
|
26
|
+
public void testMediumLongIsogram() {
|
27
|
+
IsogramChecker iso = new IsogramChecker();
|
28
|
+
assertTrue(iso.isIsogram("subdermatoglyphic"));
|
29
|
+
}
|
30
|
+
|
31
|
+
@Ignore
|
32
|
+
@Test
|
33
|
+
public void testCaseInsensitive() {
|
34
|
+
IsogramChecker iso = new IsogramChecker();
|
35
|
+
assertFalse(iso.isIsogram("Alphabet"));
|
36
|
+
}
|
37
|
+
|
38
|
+
@Ignore
|
39
|
+
@Test
|
40
|
+
public void testIsogramWithHyphen() {
|
41
|
+
IsogramChecker iso = new IsogramChecker();
|
42
|
+
assertTrue(iso.isIsogram("thumbscrew-japingly"));
|
43
|
+
}
|
44
|
+
|
45
|
+
@Ignore
|
46
|
+
@Test
|
47
|
+
public void testIgnoresMultipleHyphens() {
|
48
|
+
IsogramChecker iso = new IsogramChecker();
|
49
|
+
assertTrue(iso.isIsogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"));
|
50
|
+
}
|
51
|
+
|
52
|
+
@Ignore
|
53
|
+
@Test
|
54
|
+
public void testWorksWithGermanLetters() {
|
55
|
+
IsogramChecker iso = new IsogramChecker();
|
56
|
+
assertTrue(iso.isIsogram("Heizölrückstoßabdämpfung"));
|
57
|
+
}
|
58
|
+
|
59
|
+
@Ignore
|
60
|
+
@Test
|
61
|
+
public void testIgnoresSpaces() {
|
62
|
+
IsogramChecker iso = new IsogramChecker();
|
63
|
+
assertFalse(iso.isIsogram("the quick brown fox"));
|
64
|
+
}
|
65
|
+
|
66
|
+
@Ignore
|
67
|
+
@Test
|
68
|
+
public void testIgnoresSpaces2() {
|
69
|
+
IsogramChecker iso = new IsogramChecker();
|
70
|
+
assertTrue(iso.isIsogram("Emily Jung Schwartzkopf"));
|
71
|
+
}
|
72
|
+
|
73
|
+
@Ignore
|
74
|
+
@Test
|
75
|
+
public void testDuplicateAccentedLetters() {
|
76
|
+
IsogramChecker iso = new IsogramChecker();
|
77
|
+
assertFalse(iso.isIsogram("éléphant"));
|
78
|
+
}
|
79
|
+
|
80
|
+
}
|
data/tracks/java/exercises/raindrops/src/test/java/{RaindropsTest.java → RaindropConverterTest.java}
RENAMED
@@ -10,7 +10,7 @@ import java.util.Collection;
|
|
10
10
|
import static org.junit.Assert.assertEquals;
|
11
11
|
|
12
12
|
@RunWith(Parameterized.class)
|
13
|
-
public class
|
13
|
+
public class RaindropConverterTest {
|
14
14
|
|
15
15
|
private int inputNumber;
|
16
16
|
private String outputFromRaindropConversion;
|
@@ -46,7 +46,7 @@ public class RaindropsTest {
|
|
46
46
|
});
|
47
47
|
}
|
48
48
|
|
49
|
-
public
|
49
|
+
public RaindropConverterTest(int inputNumber, String outputFromRaindropConversion) {
|
50
50
|
this.inputNumber = inputNumber;
|
51
51
|
this.outputFromRaindropConversion = outputFromRaindropConversion;
|
52
52
|
}
|
@@ -54,6 +54,6 @@ public class RaindropsTest {
|
|
54
54
|
|
55
55
|
@Test
|
56
56
|
public void test() {
|
57
|
-
assertEquals(outputFromRaindropConversion,
|
57
|
+
assertEquals(outputFromRaindropConversion, new RaindropConverter().convert(inputNumber));
|
58
58
|
}
|
59
59
|
}
|
@@ -9,6 +9,7 @@ include 'binary'
|
|
9
9
|
include 'binary-search'
|
10
10
|
include 'binary-search-tree'
|
11
11
|
include 'bob'
|
12
|
+
include 'book-store'
|
12
13
|
include 'bracket-push'
|
13
14
|
include 'change'
|
14
15
|
include 'clock'
|
@@ -23,6 +24,7 @@ include 'grade-school'
|
|
23
24
|
include 'hamming'
|
24
25
|
include 'hexadecimal'
|
25
26
|
include 'hello-world'
|
27
|
+
include 'isogram'
|
26
28
|
include 'largest-series-product'
|
27
29
|
include 'linked-list'
|
28
30
|
include 'list-ops'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"version": "0.2.0",
|
3
|
+
"configurations": [
|
4
|
+
{
|
5
|
+
"name": "OCaml",
|
6
|
+
"type": "ocamldebug",
|
7
|
+
"request": "launch",
|
8
|
+
"program": "/home/steve/dev/exercism/xocaml/tools/test-generator/debug.byte",
|
9
|
+
"console": "internalConsole",
|
10
|
+
"stopOnEntry": false
|
11
|
+
}
|
12
|
+
]
|
13
|
+
}
|