trackler 2.2.1.139 → 2.2.1.140
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/csharp/exercises/matrix/Example.cs +1 -1
- data/tracks/csharp/exercises/matrix/Matrix.cs +2 -2
- data/tracks/csharp/exercises/matrix/MatrixTest.cs +41 -48
- data/tracks/csharp/exercises/twelve-days/Example.cs +17 -22
- data/tracks/csharp/exercises/twelve-days/README.md +0 -11
- data/tracks/csharp/exercises/twelve-days/TwelveDays.cs +3 -8
- data/tracks/csharp/exercises/twelve-days/TwelveDaysTest.cs +69 -56
- data/tracks/csharp/generators/Exercises/Matrix.cs +18 -0
- data/tracks/csharp/generators/Exercises/TwelveDays.cs +28 -0
- data/tracks/elm/docs/TESTS.md +3 -4
- data/tracks/erlang/config.json +8 -0
- data/tracks/erlang/exercises/pascals-triangle/README.md +64 -0
- data/tracks/erlang/exercises/pascals-triangle/rebar.config +30 -0
- data/tracks/erlang/exercises/pascals-triangle/src/example.erl +30 -0
- data/tracks/erlang/exercises/pascals-triangle/src/pascals_triangle.app.src +9 -0
- data/tracks/erlang/exercises/pascals-triangle/src/pascals_triangle.erl +8 -0
- data/tracks/erlang/exercises/pascals-triangle/test/pascals_triangle_tests.erl +51 -0
- data/tracks/fsharp/exercises/diffie-hellman/DiffieHellmanTest.fs +30 -50
- data/tracks/fsharp/exercises/yacht/YachtTest.fs +5 -1
- data/tracks/fsharp/generators/Generators.fs +53 -0
- data/tracks/go/config.json +12 -0
- data/tracks/go/exercises/markdown/.meta/gen.go +59 -0
- data/tracks/go/exercises/markdown/README.md +35 -0
- data/tracks/go/exercises/markdown/cases_test.go +59 -0
- data/tracks/go/exercises/markdown/example.go +70 -0
- data/tracks/go/exercises/markdown/markdown.go +66 -0
- data/tracks/go/exercises/markdown/markdown_test.go +21 -0
- data/tracks/python/exercises/crypto-square/README.md +23 -19
- data/tracks/python/exercises/yacht/yacht_test.py +4 -1
- data/tracks/swift/exercises/phone-number/Tests/PhoneNumberTests/PhoneNumberTests.swift +14 -14
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a62c88fac34309c111a0502963d5822d523f4fc
|
4
|
+
data.tar.gz: aada3879b2d773e6dbc351bafb9a250a2b209d0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce8cd0a7ea03a56184febc3d0bcb850d36a7a4d1fe0e8c46454e4df9e64f4c2d663a02bfe34cf588e258806c4d0f8c9717ece6e313e29289377636cf3786c10
|
7
|
+
data.tar.gz: 298c7e83badf8b099995f688d5c95bc4981c8c2a2e9a1094f8b1126c5084add6d50b0b75ce8a4fa678babb180a53814cd3b619eb4182dd98f5e240b379a523df
|
data/lib/trackler/version.rb
CHANGED
@@ -22,12 +22,12 @@ public class Matrix
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
|
25
|
-
public int[] Row(int row)
|
25
|
+
public int[] Row(int row)
|
26
26
|
{
|
27
27
|
throw new NotImplementedException("You need to implement this function.");
|
28
28
|
}
|
29
29
|
|
30
|
-
public int[]
|
30
|
+
public int[] Column(int col)
|
31
31
|
{
|
32
32
|
throw new NotImplementedException("You need to implement this function.");
|
33
33
|
}
|
@@ -1,69 +1,62 @@
|
|
1
|
-
|
1
|
+
// This file was auto-generated based on version 1.0.0 of the canonical data.
|
2
|
+
|
3
|
+
using Xunit;
|
2
4
|
|
3
5
|
public class MatrixTest
|
4
6
|
{
|
5
|
-
[
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
[Fact]
|
8
|
+
public void Extract_row_from_one_number_matrix()
|
9
|
+
{
|
10
|
+
var sut = new Matrix("1");
|
11
|
+
Assert.Equal(new[] { 1 }, sut.Row(0));
|
12
|
+
}
|
13
|
+
|
14
|
+
[Fact(Skip = "Remove to run test")]
|
15
|
+
public void Can_extract_row()
|
16
|
+
{
|
17
|
+
var sut = new Matrix("1 2\n3 4");
|
18
|
+
Assert.Equal(new[] { 3, 4 }, sut.Row(1));
|
19
|
+
}
|
20
|
+
|
21
|
+
[Fact(Skip = "Remove to run test")]
|
22
|
+
public void Extract_row_where_numbers_have_different_widths()
|
11
23
|
{
|
12
|
-
var
|
13
|
-
Assert.Equal(
|
24
|
+
var sut = new Matrix("1 2\n10 20");
|
25
|
+
Assert.Equal(new[] { 10, 20 }, sut.Row(1));
|
14
26
|
}
|
15
27
|
|
16
|
-
[
|
17
|
-
|
18
|
-
[InlineData("9 7", new[] { 9, 7 })]
|
19
|
-
[InlineData("9 8 7\n19 18 17", new[] { 19, 18, 17 })]
|
20
|
-
[InlineData("1 4 9\n16 25 36\n5 6 7", new[] { 5, 6, 7 })]
|
21
|
-
public void Extract_last_row(string input, int[] expected)
|
28
|
+
[Fact(Skip = "Remove to run test")]
|
29
|
+
public void Can_extract_row_from_non_square_matrix()
|
22
30
|
{
|
23
|
-
var
|
24
|
-
Assert.Equal(
|
31
|
+
var sut = new Matrix("1 2 3\n4 5 6\n7 8 9\n8 7 6");
|
32
|
+
Assert.Equal(new[] { 7, 8, 9 }, sut.Row(2));
|
25
33
|
}
|
26
34
|
|
27
|
-
[
|
28
|
-
|
29
|
-
[InlineData("89 1903\n18 3", new[] { 89, 18 })]
|
30
|
-
[InlineData("1 2 3\n4 5 6\n7 8 9\n8 7 6", new[] { 1, 4, 7, 8 })]
|
31
|
-
public void Extract_first_column(string input, int[] expected)
|
35
|
+
[Fact(Skip = "Remove to run test")]
|
36
|
+
public void Extract_column_from_one_number_matrix()
|
32
37
|
{
|
33
|
-
var
|
34
|
-
Assert.Equal(
|
38
|
+
var sut = new Matrix("1");
|
39
|
+
Assert.Equal(new[] { 1 }, sut.Column(0));
|
35
40
|
}
|
36
41
|
|
37
|
-
[
|
38
|
-
|
39
|
-
[InlineData("13\n16\n19", new[] { 13, 16, 19 })]
|
40
|
-
[InlineData("289 21903 23\n218 23 21", new[] { 23, 21 })]
|
41
|
-
[InlineData("11 12 13\n14 15 16\n17 18 19\n18 17 16", new[] { 13, 16, 19, 16 })]
|
42
|
-
public void Extract_last_column(string input, int[] expected)
|
42
|
+
[Fact(Skip = "Remove to run test")]
|
43
|
+
public void Can_extract_column()
|
43
44
|
{
|
44
|
-
var
|
45
|
-
Assert.Equal(
|
45
|
+
var sut = new Matrix("1 2 3\n4 5 6\n7 8 9");
|
46
|
+
Assert.Equal(new[] { 3, 6, 9 }, sut.Column(2));
|
46
47
|
}
|
47
48
|
|
48
|
-
[
|
49
|
-
|
50
|
-
[InlineData("13\n16", 2)]
|
51
|
-
[InlineData("289 21903\n23 218\n23 21", 3)]
|
52
|
-
[InlineData("11 12 13\n14 15 16\n17 18 19\n18 17 16", 4)]
|
53
|
-
public void Number_of_rows(string input, int expected)
|
49
|
+
[Fact(Skip = "Remove to run test")]
|
50
|
+
public void Can_extract_column_from_non_square_matrix()
|
54
51
|
{
|
55
|
-
var
|
56
|
-
Assert.Equal(
|
52
|
+
var sut = new Matrix("1 2 3\n4 5 6\n7 8 9\n8 7 6");
|
53
|
+
Assert.Equal(new[] { 3, 6, 9, 6 }, sut.Column(2));
|
57
54
|
}
|
58
55
|
|
59
|
-
[
|
60
|
-
|
61
|
-
[InlineData("13 2\n16 3\n19 4", 2)]
|
62
|
-
[InlineData("289 21903\n23 218\n23 21", 2)]
|
63
|
-
[InlineData("11 12 13\n14 15 16\n17 18 19\n18 17 16", 3)]
|
64
|
-
public void Number_of_columns(string input, int expected)
|
56
|
+
[Fact(Skip = "Remove to run test")]
|
57
|
+
public void Extract_column_where_numbers_have_different_widths()
|
65
58
|
{
|
66
|
-
var
|
67
|
-
Assert.Equal(
|
59
|
+
var sut = new Matrix("89 1903 3\n18 3 1\n9 4 800");
|
60
|
+
Assert.Equal(new[] { 1903, 3, 4 }, sut.Column(1));
|
68
61
|
}
|
69
62
|
}
|
@@ -4,52 +4,47 @@ using System.Linq;
|
|
4
4
|
using System.Text;
|
5
5
|
using System.Threading.Tasks;
|
6
6
|
|
7
|
-
public static class
|
7
|
+
public static class TwelveDays
|
8
8
|
{
|
9
|
-
public static string
|
10
|
-
{
|
11
|
-
return Verses(1, 12);
|
12
|
-
}
|
13
|
-
|
14
|
-
public static string Verse(int verseNumber)
|
9
|
+
public static string Recite(int verseNumber)
|
15
10
|
{
|
16
11
|
switch(verseNumber)
|
17
12
|
{
|
18
13
|
case 1:
|
19
|
-
return "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree
|
14
|
+
return "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.";
|
20
15
|
case 2:
|
21
|
-
return "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree
|
16
|
+
return "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.";
|
22
17
|
case 3:
|
23
|
-
return "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
18
|
+
return "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
24
19
|
case 4:
|
25
|
-
return "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
20
|
+
return "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
26
21
|
case 5:
|
27
|
-
return "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
22
|
+
return "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
28
23
|
case 6:
|
29
|
-
return "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
24
|
+
return "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
30
25
|
case 7:
|
31
|
-
return "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
26
|
+
return "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
32
27
|
case 8:
|
33
|
-
return "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
28
|
+
return "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
34
29
|
case 9:
|
35
|
-
return "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
30
|
+
return "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
36
31
|
case 10:
|
37
|
-
return "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
32
|
+
return "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
38
33
|
case 11:
|
39
|
-
return "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
34
|
+
return "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
40
35
|
case 12:
|
41
|
-
return "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
36
|
+
return "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
42
37
|
default:
|
43
38
|
return "";
|
44
39
|
}
|
45
40
|
}
|
46
41
|
|
47
|
-
public static string
|
42
|
+
public static string Recite(int start, int end)
|
48
43
|
{
|
49
44
|
var stringBuilder = new StringBuilder();
|
50
45
|
|
51
|
-
Enumerable.Range(start, end).ToList().ForEach(i => stringBuilder.Append(
|
46
|
+
Enumerable.Range(start, end - start + 1).ToList().ForEach(i => stringBuilder.Append(Recite(i)).Append("\n"));
|
52
47
|
|
53
|
-
return stringBuilder.ToString();
|
48
|
+
return stringBuilder.ToString().Trim();
|
54
49
|
}
|
55
50
|
}
|
@@ -4,27 +4,16 @@ Output the lyrics to 'The Twelve Days of Christmas'.
|
|
4
4
|
|
5
5
|
```text
|
6
6
|
On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.
|
7
|
-
|
8
7
|
On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.
|
9
|
-
|
10
8
|
On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
11
|
-
|
12
9
|
On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
13
|
-
|
14
10
|
On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
15
|
-
|
16
11
|
On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
17
|
-
|
18
12
|
On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
19
|
-
|
20
13
|
On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
21
|
-
|
22
14
|
On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
23
|
-
|
24
15
|
On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
25
|
-
|
26
16
|
On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
27
|
-
|
28
17
|
On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
|
29
18
|
```
|
30
19
|
|
@@ -1,18 +1,13 @@
|
|
1
1
|
using System;
|
2
2
|
|
3
|
-
public static class
|
3
|
+
public static class TwelveDays
|
4
4
|
{
|
5
|
-
public static string
|
5
|
+
public static string Recite(int verseNumber)
|
6
6
|
{
|
7
7
|
throw new NotImplementedException("You need to implement this function.");
|
8
8
|
}
|
9
9
|
|
10
|
-
public static string
|
11
|
-
{
|
12
|
-
throw new NotImplementedException("You need to implement this function.");
|
13
|
-
}
|
14
|
-
|
15
|
-
public static string Verses(int start, int end)
|
10
|
+
public static string Recite(int start, int end)
|
16
11
|
{
|
17
12
|
throw new NotImplementedException("You need to implement this function.");
|
18
13
|
}
|
@@ -1,116 +1,129 @@
|
|
1
|
-
|
1
|
+
// This file was auto-generated based on version 1.1.0 of the canonical data.
|
2
|
+
|
3
|
+
using Xunit;
|
2
4
|
|
3
5
|
public class TwelveDaysTest
|
4
6
|
{
|
5
7
|
[Fact]
|
6
|
-
public void
|
8
|
+
public void First_day_a_partridge_in_a_pear_tree()
|
7
9
|
{
|
8
|
-
var expected = "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree
|
9
|
-
|
10
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(1));
|
10
|
+
var expected = "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.";
|
11
|
+
Assert.Equal(expected, TwelveDays.Recite(1));
|
11
12
|
}
|
12
13
|
|
13
14
|
[Fact(Skip = "Remove to run test")]
|
14
|
-
public void
|
15
|
+
public void Second_day_two_turtle_doves()
|
15
16
|
{
|
16
|
-
var expected = "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree
|
17
|
-
|
18
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(2));
|
17
|
+
var expected = "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.";
|
18
|
+
Assert.Equal(expected, TwelveDays.Recite(2));
|
19
19
|
}
|
20
20
|
|
21
21
|
[Fact(Skip = "Remove to run test")]
|
22
|
-
public void
|
22
|
+
public void Third_day_three_french_hens()
|
23
23
|
{
|
24
|
-
var expected = "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
25
|
-
|
26
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(3));
|
24
|
+
var expected = "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
25
|
+
Assert.Equal(expected, TwelveDays.Recite(3));
|
27
26
|
}
|
28
27
|
|
29
28
|
[Fact(Skip = "Remove to run test")]
|
30
|
-
public void
|
29
|
+
public void Fourth_day_four_calling_birds()
|
31
30
|
{
|
32
|
-
var expected = "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
33
|
-
|
34
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(4));
|
31
|
+
var expected = "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
32
|
+
Assert.Equal(expected, TwelveDays.Recite(4));
|
35
33
|
}
|
36
34
|
|
37
35
|
[Fact(Skip = "Remove to run test")]
|
38
|
-
public void
|
36
|
+
public void Fifth_day_five_gold_rings()
|
39
37
|
{
|
40
|
-
var expected = "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
41
|
-
|
42
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(5));
|
38
|
+
var expected = "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
39
|
+
Assert.Equal(expected, TwelveDays.Recite(5));
|
43
40
|
}
|
44
41
|
|
45
42
|
[Fact(Skip = "Remove to run test")]
|
46
|
-
public void
|
43
|
+
public void Sixth_day_six_geese_a_laying()
|
47
44
|
{
|
48
|
-
var expected = "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
49
|
-
|
50
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(6));
|
45
|
+
var expected = "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
46
|
+
Assert.Equal(expected, TwelveDays.Recite(6));
|
51
47
|
}
|
52
48
|
|
53
49
|
[Fact(Skip = "Remove to run test")]
|
54
|
-
public void
|
50
|
+
public void Seventh_day_seven_swans_a_swimming()
|
55
51
|
{
|
56
|
-
var expected = "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
57
|
-
|
58
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(7));
|
52
|
+
var expected = "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
53
|
+
Assert.Equal(expected, TwelveDays.Recite(7));
|
59
54
|
}
|
60
55
|
|
61
56
|
[Fact(Skip = "Remove to run test")]
|
62
|
-
public void
|
57
|
+
public void Eighth_day_eight_maids_a_milking()
|
63
58
|
{
|
64
|
-
var expected = "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
65
|
-
|
66
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(8));
|
59
|
+
var expected = "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
60
|
+
Assert.Equal(expected, TwelveDays.Recite(8));
|
67
61
|
}
|
68
62
|
|
69
63
|
[Fact(Skip = "Remove to run test")]
|
70
|
-
public void
|
64
|
+
public void Ninth_day_nine_ladies_dancing()
|
71
65
|
{
|
72
|
-
var expected = "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
73
|
-
|
74
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(9));
|
66
|
+
var expected = "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
67
|
+
Assert.Equal(expected, TwelveDays.Recite(9));
|
75
68
|
}
|
76
69
|
|
77
70
|
[Fact(Skip = "Remove to run test")]
|
78
|
-
public void
|
71
|
+
public void Tenth_day_ten_lords_a_leaping()
|
79
72
|
{
|
80
|
-
var expected = "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
81
|
-
|
82
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(10));
|
73
|
+
var expected = "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
74
|
+
Assert.Equal(expected, TwelveDays.Recite(10));
|
83
75
|
}
|
84
76
|
|
85
77
|
[Fact(Skip = "Remove to run test")]
|
86
|
-
public void
|
78
|
+
public void Eleventh_day_eleven_pipers_piping()
|
87
79
|
{
|
88
|
-
var expected = "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
89
|
-
|
90
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(11));
|
80
|
+
var expected = "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
81
|
+
Assert.Equal(expected, TwelveDays.Recite(11));
|
91
82
|
}
|
92
83
|
|
93
84
|
[Fact(Skip = "Remove to run test")]
|
94
|
-
public void
|
85
|
+
public void Twelfth_day_twelve_drummers_drumming()
|
95
86
|
{
|
96
|
-
var expected = "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree
|
97
|
-
|
98
|
-
Assert.Equal(expected, TwelveDaysSong.Verse(12));
|
87
|
+
var expected = "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
88
|
+
Assert.Equal(expected, TwelveDays.Recite(12));
|
99
89
|
}
|
100
90
|
|
101
91
|
[Fact(Skip = "Remove to run test")]
|
102
|
-
public void
|
92
|
+
public void Recites_first_three_verses_of_the_song()
|
103
93
|
{
|
104
|
-
var expected =
|
105
|
-
|
106
|
-
|
94
|
+
var expected =
|
95
|
+
"On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.\n" +
|
96
|
+
"On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
97
|
+
"On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
98
|
+
Assert.Equal(expected, TwelveDays.Recite(1, 3));
|
99
|
+
}
|
107
100
|
|
108
|
-
|
101
|
+
[Fact(Skip = "Remove to run test")]
|
102
|
+
public void Recites_three_verses_from_the_middle_of_the_song()
|
103
|
+
{
|
104
|
+
var expected =
|
105
|
+
"On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
106
|
+
"On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
107
|
+
"On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
108
|
+
Assert.Equal(expected, TwelveDays.Recite(4, 6));
|
109
109
|
}
|
110
110
|
|
111
111
|
[Fact(Skip = "Remove to run test")]
|
112
|
-
public void
|
112
|
+
public void Recites_the_whole_song()
|
113
113
|
{
|
114
|
-
|
114
|
+
var expected =
|
115
|
+
"On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.\n" +
|
116
|
+
"On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
117
|
+
"On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
118
|
+
"On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
119
|
+
"On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
120
|
+
"On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
121
|
+
"On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
122
|
+
"On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
123
|
+
"On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
124
|
+
"On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
125
|
+
"On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" +
|
126
|
+
"On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.";
|
127
|
+
Assert.Equal(expected, TwelveDays.Recite(1, 12));
|
115
128
|
}
|
116
129
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
using Generators.Input;
|
2
|
+
|
3
|
+
namespace Generators.Exercises
|
4
|
+
{
|
5
|
+
public class Matrix : GeneratorExercise
|
6
|
+
{
|
7
|
+
protected override void UpdateCanonicalData(CanonicalData canonicalData)
|
8
|
+
{
|
9
|
+
foreach (var canonicalDataCase in canonicalData.Cases)
|
10
|
+
{
|
11
|
+
canonicalDataCase.Properties["string"] = canonicalDataCase.Properties["input"]["string"];
|
12
|
+
canonicalDataCase.SetConstructorInputParameters("string");
|
13
|
+
canonicalDataCase.Properties["index"] = canonicalDataCase.Properties["input"]["index"];
|
14
|
+
canonicalDataCase.SetInputParameters("index");
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Collections.Generic;
|
3
|
+
using System.Text;
|
4
|
+
using Generators.Input;
|
5
|
+
using Generators.Output;
|
6
|
+
using System.Linq;
|
7
|
+
using Humanizer;
|
8
|
+
|
9
|
+
namespace Generators.Exercises
|
10
|
+
{
|
11
|
+
public class TwelveDays : GeneratorExercise
|
12
|
+
{
|
13
|
+
protected override void UpdateCanonicalData(CanonicalData canonicalData)
|
14
|
+
{
|
15
|
+
foreach (var canonicalDataCase in canonicalData.Cases)
|
16
|
+
{
|
17
|
+
canonicalDataCase.UseVariableForExpected = true;
|
18
|
+
canonicalDataCase.Expected = ConvertHelper.ToMultiLineString(canonicalDataCase.Expected);
|
19
|
+
var properties = canonicalDataCase.Properties as Dictionary<string, object>;
|
20
|
+
var input = properties["input"] as Dictionary<string, object>;
|
21
|
+
if ((long)input["startVerse"] == (long)input["endVerse"])
|
22
|
+
{
|
23
|
+
properties["input"] = input["startVerse"];
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
data/tracks/elm/docs/TESTS.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
The Elm exercise test suites may be run from the exercise directory.
|
2
2
|
|
3
3
|
```bash
|
4
|
-
$ cd exercism/
|
5
|
-
$
|
6
|
-
$ npm test
|
4
|
+
$ cd ~/exercism/elm/hello-world
|
5
|
+
$ elm test
|
7
6
|
```
|
8
7
|
|
9
8
|
## Hints and tips
|
@@ -13,7 +12,7 @@ $ npm test
|
|
13
12
|
Automatically run tests again when you save changes:
|
14
13
|
|
15
14
|
```bash
|
16
|
-
$
|
15
|
+
$ elm test --watch
|
17
16
|
```
|
18
17
|
|
19
18
|
### Coding the exercise
|
data/tracks/erlang/config.json
CHANGED
@@ -422,6 +422,14 @@
|
|
422
422
|
|
423
423
|
]
|
424
424
|
},
|
425
|
+
{
|
426
|
+
"uuid": "589b763c-2b3a-11e8-b467-0ed5f89f718b",
|
427
|
+
"slug": "pascals-triangle",
|
428
|
+
"core": false,
|
429
|
+
"unlocked_by": null,
|
430
|
+
"difficulty": 6,
|
431
|
+
"topics": []
|
432
|
+
},
|
425
433
|
{
|
426
434
|
"uuid": "058b48a9-03ec-43bc-88eb-9dbce8b79e59",
|
427
435
|
"slug": "circular-buffer",
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Pascal's Triangle
|
2
|
+
|
3
|
+
Compute Pascal's triangle up to a given number of rows.
|
4
|
+
|
5
|
+
In Pascal's Triangle each number is computed by adding the numbers to
|
6
|
+
the right and left of the current position in the previous row.
|
7
|
+
|
8
|
+
```text
|
9
|
+
1
|
10
|
+
1 1
|
11
|
+
1 2 1
|
12
|
+
1 3 3 1
|
13
|
+
1 4 6 4 1
|
14
|
+
# ... etc
|
15
|
+
```
|
16
|
+
|
17
|
+
## Running tests
|
18
|
+
|
19
|
+
In order to run the tests, issue the following command from the exercise
|
20
|
+
directory:
|
21
|
+
|
22
|
+
For running the tests provided, `rebar3` is used as it is the official build and
|
23
|
+
dependency management tool for erlang now. Please refer to [the tracks installation
|
24
|
+
instructions](http://exercism.io/languages/erlang/installation) on how to do that.
|
25
|
+
|
26
|
+
In order to run the tests, you can issue the following command from the exercise
|
27
|
+
directory.
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$ rebar3 eunit
|
31
|
+
```
|
32
|
+
|
33
|
+
### Test versioning
|
34
|
+
|
35
|
+
Each problem defines a macro `TEST_VERSION` in the test file and
|
36
|
+
verifies that the solution defines and exports a function `test_version`
|
37
|
+
returning that same value.
|
38
|
+
|
39
|
+
To make tests pass, add the following to your solution:
|
40
|
+
|
41
|
+
```erlang
|
42
|
+
-export([test_version/0]).
|
43
|
+
|
44
|
+
test_version() ->
|
45
|
+
1.
|
46
|
+
```
|
47
|
+
|
48
|
+
The benefit of this is that reviewers can see against which test version
|
49
|
+
an iteration was written if, for example, a previously posted solution
|
50
|
+
does not solve the current problem or passes current tests.
|
51
|
+
|
52
|
+
## Questions?
|
53
|
+
|
54
|
+
For detailed information about the Erlang track, please refer to the
|
55
|
+
[help page](http://exercism.io/languages/erlang) on the Exercism site.
|
56
|
+
This covers the basic information on setting up the development
|
57
|
+
environment expected by the exercises.
|
58
|
+
|
59
|
+
## Source
|
60
|
+
|
61
|
+
Pascal's Triangle at Wolfram Math World [http://mathworld.wolfram.com/PascalsTriangle.html](http://mathworld.wolfram.com/PascalsTriangle.html)
|
62
|
+
|
63
|
+
## Submitting Incomplete Solutions
|
64
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|