trackler 2.2.1.63 → 2.2.1.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/csharp/exercises/crypto-square/CryptoSquareTest.cs +23 -62
  4. data/tracks/csharp/exercises/food-chain/Example.cs +1 -3
  5. data/tracks/csharp/exercises/food-chain/FoodChain.cs +1 -6
  6. data/tracks/csharp/exercises/food-chain/FoodChainTest.cs +11 -11
  7. data/tracks/csharp/exercises/hamming/HammingTest.cs +3 -3
  8. data/tracks/csharp/exercises/house/Example.cs +4 -4
  9. data/tracks/csharp/exercises/house/House.cs +1 -6
  10. data/tracks/csharp/exercises/house/HouseTest.cs +15 -15
  11. data/tracks/csharp/exercises/isbn-verifier/IsbnVerifierTest.cs +1 -1
  12. data/tracks/csharp/exercises/isogram/IsogramTest.cs +3 -3
  13. data/tracks/csharp/exercises/kindergarten-garden/KindergartenGardenTest.cs +0 -28
  14. data/tracks/csharp/exercises/leap/LeapTest.cs +2 -2
  15. data/tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs +15 -1
  16. data/tracks/csharp/exercises/pangram/PangramTest.cs +9 -3
  17. data/tracks/csharp/exercises/pascals-triangle/PascalsTriangleTest.cs +22 -1
  18. data/tracks/csharp/exercises/queen-attack/QueenAttackTest.cs +7 -7
  19. data/tracks/csharp/exercises/two-bucket/TwoBucketTest.cs +1 -1
  20. data/tracks/csharp/generators/Exercises/IsbnVerifier.cs +0 -7
  21. data/tracks/dart/analysis_options.yaml +30 -0
  22. data/tracks/go/exercises/run-length-encoding/.meta/gen.go +90 -0
  23. data/tracks/go/exercises/run-length-encoding/cases_test.go +42 -0
  24. data/tracks/go/exercises/run-length-encoding/run_length_encoding_test.go +9 -37
  25. data/tracks/lua/config.json +11 -1
  26. data/tracks/lua/exercises/queen-attack/README.md +43 -0
  27. data/tracks/lua/exercises/queen-attack/example.lua +21 -0
  28. data/tracks/lua/exercises/queen-attack/queen-attack_spec.lua +75 -0
  29. data/tracks/objective-c/config.json +2 -2
  30. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 985e2ec336306b1046f8da6feb634a14e068b7fd
4
- data.tar.gz: f45ef713d40338b0e38ad34a68c6dddc71c19a1f
3
+ metadata.gz: 57d41b0eaa987c97fabde0492b8a8b8e0f258b0c
4
+ data.tar.gz: 3a527b59348b027830beef1678940ae20c9b49fb
5
5
  SHA512:
6
- metadata.gz: 68bbdd588b0c868aa758eabdf9f8b75979fe3d51381c0366ceff7deb718e4287238ad8840981175501f62c5b7068a8b4a8708100c5c8a9eb48f93e2435bb92c0
7
- data.tar.gz: e236fc32bcdb8620dfac8ae19c8f97e80dd45298cdcbec8c5d1ee34c0503036b5cfdf697aafe40629c3040a7f2ec5bacfdc1ed177bc1ce735ffe1022c0453492
6
+ metadata.gz: 023d2e323bf41620ade507abcb34196a705b2acf8133d59a4bcb20bb7a8e35441d9ee17ae7636eb92c6f3d15adedccb29021f39ad649692d4abaf55eecafbac9
7
+ data.tar.gz: 0f25d5e45f4fde1a66325c998fb059098fab80b197081e3e4a628797de75c5bd9099fd3b753e454536bfa89d11f4d5683c0bedb597923962451d5eac60063e53
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.63"
2
+ VERSION = "2.2.1.64"
3
3
  end
@@ -1,98 +1,59 @@
1
- // This file was auto-generated based on version 2.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 3.1.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
5
5
  public class CryptoSquareTest
6
6
  {
7
7
  [Fact]
8
- public void Lowercase()
9
- {
10
- var plaintext = "Hello";
11
- var expected = "hello";
12
- Assert.Equal(expected, CryptoSquare.NormalizedPlaintext(plaintext));
13
- }
14
-
15
- [Fact(Skip = "Remove to run test")]
16
- public void Remove_spaces()
17
- {
18
- var plaintext = "Hi there";
19
- var expected = "hithere";
20
- Assert.Equal(expected, CryptoSquare.NormalizedPlaintext(plaintext));
21
- }
22
-
23
- [Fact(Skip = "Remove to run test")]
24
- public void Remove_punctuation()
25
- {
26
- var plaintext = "@1, 2%, 3 Go!";
27
- var expected = "123go";
28
- Assert.Equal(expected, CryptoSquare.NormalizedPlaintext(plaintext));
29
- }
30
-
31
- [Fact(Skip = "Remove to run test")]
32
- public void Empty_plaintext_results_in_an_empty_rectangle()
8
+ public void Empty_plaintext_results_in_an_empty_ciphertext()
33
9
  {
34
10
  var plaintext = "";
35
- Assert.Empty(CryptoSquare.PlaintextSegments(plaintext));
36
- }
37
-
38
- [Fact(Skip = "Remove to run test")]
39
- public void Number_4_character_plaintext_results_in_an_2x2_rectangle()
40
- {
41
- var plaintext = "Ab Cd";
42
- var expected = new[] { "ab", "cd" };
43
- Assert.Equal(expected, CryptoSquare.PlaintextSegments(plaintext));
44
- }
45
-
46
- [Fact(Skip = "Remove to run test")]
47
- public void Number_9_character_plaintext_results_in_an_3x3_rectangle()
48
- {
49
- var plaintext = "This is fun!";
50
- var expected = new[] { "thi", "sis", "fun" };
51
- Assert.Equal(expected, CryptoSquare.PlaintextSegments(plaintext));
11
+ var expected = "";
12
+ Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
52
13
  }
53
14
 
54
15
  [Fact(Skip = "Remove to run test")]
55
- public void Number_54_character_plaintext_results_in_an_8x7_rectangle()
16
+ public void Lowercase()
56
17
  {
57
- var plaintext = "If man was meant to stay on the ground, god would have given us roots.";
58
- var expected = new[] { "ifmanwas", "meanttos", "tayonthe", "groundgo", "dwouldha", "vegivenu", "sroots" };
59
- Assert.Equal(expected, CryptoSquare.PlaintextSegments(plaintext));
18
+ var plaintext = "A";
19
+ var expected = "a";
20
+ Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
60
21
  }
61
22
 
62
23
  [Fact(Skip = "Remove to run test")]
63
- public void Empty_plaintext_results_in_an_empty_encode()
24
+ public void Remove_spaces()
64
25
  {
65
- var plaintext = "";
66
- var expected = "";
67
- Assert.Equal(expected, CryptoSquare.Encoded(plaintext));
26
+ var plaintext = " b ";
27
+ var expected = "b";
28
+ Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
68
29
  }
69
30
 
70
31
  [Fact(Skip = "Remove to run test")]
71
- public void Non_empty_plaintext_results_in_the_combined_plaintext_segments()
32
+ public void Remove_punctuation()
72
33
  {
73
- var plaintext = "If man was meant to stay on the ground, god would have given us roots.";
74
- var expected = "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau";
75
- Assert.Equal(expected, CryptoSquare.Encoded(plaintext));
34
+ var plaintext = "@1,%!";
35
+ var expected = "1";
36
+ Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
76
37
  }
77
38
 
78
39
  [Fact(Skip = "Remove to run test")]
79
- public void Empty_plaintext_results_in_an_empty_ciphertext()
40
+ public void Number_9_character_plaintext_results_in_3_chunks_of_3_characters()
80
41
  {
81
- var plaintext = "";
82
- var expected = "";
42
+ var plaintext = "This is fun!";
43
+ var expected = "tsf hiu isn";
83
44
  Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
84
45
  }
85
46
 
86
47
  [Fact(Skip = "Remove to run test")]
87
- public void Number_9_character_plaintext_results_in_3_chunks_of_3_characters()
48
+ public void Number_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space()
88
49
  {
89
- var plaintext = "This is fun!";
90
- var expected = "tsf hiu isn";
50
+ var plaintext = "Chill out.";
51
+ var expected = "clu hlt io ";
91
52
  Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
92
53
  }
93
54
 
94
55
  [Fact(Skip = "Remove to run test")]
95
- public void Number_54_character_plaintext_results_in_7_chunks_the_last_two_padded_with_spaces()
56
+ public void Number_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces()
96
57
  {
97
58
  var plaintext = "If man was meant to stay on the ground, god would have given us roots.";
98
59
  var expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ";
@@ -36,9 +36,7 @@ public static class FoodChain
36
36
  "I don't know why she swallowed the fly. Perhaps she'll die."
37
37
  };
38
38
 
39
- public static string Verse(int number) => $"{VerseBegin(number)}\n{VerseEnd(number)}";
40
-
41
- public static string Verse(int begin, int end) => string.Join("\n\n", Enumerable.Range(begin, end - begin + 1).Select(i => Verse(i)));
39
+ public static string Recite(int startVerse, int endVerse) => string.Join("\n\n", Enumerable.Range(startVerse, endVerse - startVerse + 1).Select(i => $"{VerseBegin(i)}\n{VerseEnd(i)}"));
42
40
 
43
41
  private static string VerseBegin(int number)
44
42
  {
@@ -2,12 +2,7 @@
2
2
 
3
3
  public static class FoodChain
4
4
  {
5
- public static string Verse(int number)
6
- {
7
- throw new NotImplementedException("You need to implement this function.");
8
- }
9
-
10
- public static string Verse(int begin, int end)
5
+ public static string Recite(int startVerse, int endVerse)
11
6
  {
12
7
  throw new NotImplementedException("You need to implement this function.");
13
8
  }
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 2.0.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -10,7 +10,7 @@ public void Fly()
10
10
  var expected =
11
11
  "I know an old lady who swallowed a fly.\n" +
12
12
  "I don't know why she swallowed the fly. Perhaps she'll die.";
13
- Assert.Equal(expected, FoodChain.Verse(1));
13
+ Assert.Equal(expected, FoodChain.Recite(1, 1));
14
14
  }
15
15
 
16
16
  [Fact(Skip = "Remove to run test")]
@@ -21,7 +21,7 @@ public void Spider()
21
21
  "It wriggled and jiggled and tickled inside her.\n" +
22
22
  "She swallowed the spider to catch the fly.\n" +
23
23
  "I don't know why she swallowed the fly. Perhaps she'll die.";
24
- Assert.Equal(expected, FoodChain.Verse(2));
24
+ Assert.Equal(expected, FoodChain.Recite(2, 2));
25
25
  }
26
26
 
27
27
  [Fact(Skip = "Remove to run test")]
@@ -33,7 +33,7 @@ public void Bird()
33
33
  "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
34
34
  "She swallowed the spider to catch the fly.\n" +
35
35
  "I don't know why she swallowed the fly. Perhaps she'll die.";
36
- Assert.Equal(expected, FoodChain.Verse(3));
36
+ Assert.Equal(expected, FoodChain.Recite(3, 3));
37
37
  }
38
38
 
39
39
  [Fact(Skip = "Remove to run test")]
@@ -46,7 +46,7 @@ public void Cat()
46
46
  "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
47
47
  "She swallowed the spider to catch the fly.\n" +
48
48
  "I don't know why she swallowed the fly. Perhaps she'll die.";
49
- Assert.Equal(expected, FoodChain.Verse(4));
49
+ Assert.Equal(expected, FoodChain.Recite(4, 4));
50
50
  }
51
51
 
52
52
  [Fact(Skip = "Remove to run test")]
@@ -60,7 +60,7 @@ public void Dog()
60
60
  "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
61
61
  "She swallowed the spider to catch the fly.\n" +
62
62
  "I don't know why she swallowed the fly. Perhaps she'll die.";
63
- Assert.Equal(expected, FoodChain.Verse(5));
63
+ Assert.Equal(expected, FoodChain.Recite(5, 5));
64
64
  }
65
65
 
66
66
  [Fact(Skip = "Remove to run test")]
@@ -75,7 +75,7 @@ public void Goat()
75
75
  "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
76
76
  "She swallowed the spider to catch the fly.\n" +
77
77
  "I don't know why she swallowed the fly. Perhaps she'll die.";
78
- Assert.Equal(expected, FoodChain.Verse(6));
78
+ Assert.Equal(expected, FoodChain.Recite(6, 6));
79
79
  }
80
80
 
81
81
  [Fact(Skip = "Remove to run test")]
@@ -91,7 +91,7 @@ public void Cow()
91
91
  "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
92
92
  "She swallowed the spider to catch the fly.\n" +
93
93
  "I don't know why she swallowed the fly. Perhaps she'll die.";
94
- Assert.Equal(expected, FoodChain.Verse(7));
94
+ Assert.Equal(expected, FoodChain.Recite(7, 7));
95
95
  }
96
96
 
97
97
  [Fact(Skip = "Remove to run test")]
@@ -100,7 +100,7 @@ public void Horse()
100
100
  var expected =
101
101
  "I know an old lady who swallowed a horse.\n" +
102
102
  "She's dead, of course!";
103
- Assert.Equal(expected, FoodChain.Verse(8));
103
+ Assert.Equal(expected, FoodChain.Recite(8, 8));
104
104
  }
105
105
 
106
106
  [Fact(Skip = "Remove to run test")]
@@ -120,7 +120,7 @@ public void Multiple_verses()
120
120
  "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
121
121
  "She swallowed the spider to catch the fly.\n" +
122
122
  "I don't know why she swallowed the fly. Perhaps she'll die.";
123
- Assert.Equal(expected, FoodChain.Verse(1, 3));
123
+ Assert.Equal(expected, FoodChain.Recite(1, 3));
124
124
  }
125
125
 
126
126
  [Fact(Skip = "Remove to run test")]
@@ -177,6 +177,6 @@ public void Full_song()
177
177
  "\n" +
178
178
  "I know an old lady who swallowed a horse.\n" +
179
179
  "She's dead, of course!";
180
- Assert.Equal(expected, FoodChain.Verse(1, 8));
180
+ Assert.Equal(expected, FoodChain.Recite(1, 8));
181
181
  }
182
182
  }
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 2.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 2.0.1 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
  using System;
@@ -56,13 +56,13 @@ public void Small_distance_in_long_strands()
56
56
  [Fact(Skip = "Remove to run test")]
57
57
  public void Non_unique_character_in_first_strand()
58
58
  {
59
- Assert.Equal(1, Hamming.Distance("AGA", "AGG"));
59
+ Assert.Equal(1, Hamming.Distance("AAG", "AAA"));
60
60
  }
61
61
 
62
62
  [Fact(Skip = "Remove to run test")]
63
63
  public void Non_unique_character_in_second_strand()
64
64
  {
65
- Assert.Equal(1, Hamming.Distance("AGG", "AGA"));
65
+ Assert.Equal(1, Hamming.Distance("AAA", "AAG"));
66
66
  }
67
67
 
68
68
  [Fact(Skip = "Remove to run test")]
@@ -34,13 +34,13 @@ public static class House
34
34
  ""
35
35
  };
36
36
 
37
- public static string Verses(int first, int last)
37
+ public static string Recite(int startVerse, int endVerse)
38
38
  {
39
- var numberOfVerses = last - first + 1;
40
- return string.Join("\n\n", Enumerable.Range(first, numberOfVerses).Select(Verse));
39
+ var numberOfVerses = endVerse - startVerse + 1;
40
+ return string.Join("\n\n", Enumerable.Range(startVerse, numberOfVerses).Select(Verse));
41
41
  }
42
42
 
43
- public static string Verse(int number)
43
+ private static string Verse(int number)
44
44
  {
45
45
  return string.Join("\n", Enumerable.Range(1, number).Reverse().Select(index => Line(number, index)));
46
46
  }
@@ -2,12 +2,7 @@
2
2
 
3
3
  public static class House
4
4
  {
5
- public static string Verse(int number)
6
- {
7
- throw new NotImplementedException("You need to implement this function.");
8
- }
9
-
10
- public static string Verses(int first, int last)
5
+ public static string Recite(int startVerse, int endVerse)
11
6
  {
12
7
  throw new NotImplementedException("You need to implement this function.");
13
8
  }
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 2.0.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -8,7 +8,7 @@ public class HouseTest
8
8
  public void Verse_one_the_house_that_jack_built()
9
9
  {
10
10
  var expected = "This is the house that Jack built.";
11
- Assert.Equal(expected, House.Verse(1));
11
+ Assert.Equal(expected, House.Recite(1, 1));
12
12
  }
13
13
 
14
14
  [Fact(Skip = "Remove to run test")]
@@ -17,7 +17,7 @@ public void Verse_two_the_malt_that_lay()
17
17
  var expected =
18
18
  "This is the malt\n" +
19
19
  "that lay in the house that Jack built.";
20
- Assert.Equal(expected, House.Verse(2));
20
+ Assert.Equal(expected, House.Recite(2, 2));
21
21
  }
22
22
 
23
23
  [Fact(Skip = "Remove to run test")]
@@ -27,7 +27,7 @@ public void Verse_three_the_rat_that_ate()
27
27
  "This is the rat\n" +
28
28
  "that ate the malt\n" +
29
29
  "that lay in the house that Jack built.";
30
- Assert.Equal(expected, House.Verse(3));
30
+ Assert.Equal(expected, House.Recite(3, 3));
31
31
  }
32
32
 
33
33
  [Fact(Skip = "Remove to run test")]
@@ -38,7 +38,7 @@ public void Verse_four_the_cat_that_killed()
38
38
  "that killed the rat\n" +
39
39
  "that ate the malt\n" +
40
40
  "that lay in the house that Jack built.";
41
- Assert.Equal(expected, House.Verse(4));
41
+ Assert.Equal(expected, House.Recite(4, 4));
42
42
  }
43
43
 
44
44
  [Fact(Skip = "Remove to run test")]
@@ -50,7 +50,7 @@ public void Verse_five_the_dog_that_worried()
50
50
  "that killed the rat\n" +
51
51
  "that ate the malt\n" +
52
52
  "that lay in the house that Jack built.";
53
- Assert.Equal(expected, House.Verse(5));
53
+ Assert.Equal(expected, House.Recite(5, 5));
54
54
  }
55
55
 
56
56
  [Fact(Skip = "Remove to run test")]
@@ -63,7 +63,7 @@ public void Verse_six_the_cow_with_the_crumpled_horn()
63
63
  "that killed the rat\n" +
64
64
  "that ate the malt\n" +
65
65
  "that lay in the house that Jack built.";
66
- Assert.Equal(expected, House.Verse(6));
66
+ Assert.Equal(expected, House.Recite(6, 6));
67
67
  }
68
68
 
69
69
  [Fact(Skip = "Remove to run test")]
@@ -77,7 +77,7 @@ public void Verse_seven_the_maiden_all_forlorn()
77
77
  "that killed the rat\n" +
78
78
  "that ate the malt\n" +
79
79
  "that lay in the house that Jack built.";
80
- Assert.Equal(expected, House.Verse(7));
80
+ Assert.Equal(expected, House.Recite(7, 7));
81
81
  }
82
82
 
83
83
  [Fact(Skip = "Remove to run test")]
@@ -92,7 +92,7 @@ public void Verse_eight_the_man_all_tattered_and_torn()
92
92
  "that killed the rat\n" +
93
93
  "that ate the malt\n" +
94
94
  "that lay in the house that Jack built.";
95
- Assert.Equal(expected, House.Verse(8));
95
+ Assert.Equal(expected, House.Recite(8, 8));
96
96
  }
97
97
 
98
98
  [Fact(Skip = "Remove to run test")]
@@ -108,7 +108,7 @@ public void Verse_nine_the_priest_all_shaven_and_shorn()
108
108
  "that killed the rat\n" +
109
109
  "that ate the malt\n" +
110
110
  "that lay in the house that Jack built.";
111
- Assert.Equal(expected, House.Verse(9));
111
+ Assert.Equal(expected, House.Recite(9, 9));
112
112
  }
113
113
 
114
114
  [Fact(Skip = "Remove to run test")]
@@ -125,7 +125,7 @@ public void Verse_10_the_rooster_that_crowed_in_the_morn()
125
125
  "that killed the rat\n" +
126
126
  "that ate the malt\n" +
127
127
  "that lay in the house that Jack built.";
128
- Assert.Equal(expected, House.Verse(10));
128
+ Assert.Equal(expected, House.Recite(10, 10));
129
129
  }
130
130
 
131
131
  [Fact(Skip = "Remove to run test")]
@@ -143,7 +143,7 @@ public void Verse_11_the_farmer_sowing_his_corn()
143
143
  "that killed the rat\n" +
144
144
  "that ate the malt\n" +
145
145
  "that lay in the house that Jack built.";
146
- Assert.Equal(expected, House.Verse(11));
146
+ Assert.Equal(expected, House.Recite(11, 11));
147
147
  }
148
148
 
149
149
  [Fact(Skip = "Remove to run test")]
@@ -162,7 +162,7 @@ public void Verse_12_the_horse_and_the_hound_and_the_horn()
162
162
  "that killed the rat\n" +
163
163
  "that ate the malt\n" +
164
164
  "that lay in the house that Jack built.";
165
- Assert.Equal(expected, House.Verse(12));
165
+ Assert.Equal(expected, House.Recite(12, 12));
166
166
  }
167
167
 
168
168
  [Fact(Skip = "Remove to run test")]
@@ -203,7 +203,7 @@ public void Multiple_verses()
203
203
  "that killed the rat\n" +
204
204
  "that ate the malt\n" +
205
205
  "that lay in the house that Jack built.";
206
- Assert.Equal(expected, House.Verses(4, 8));
206
+ Assert.Equal(expected, House.Recite(4, 8));
207
207
  }
208
208
 
209
209
  [Fact(Skip = "Remove to run test")]
@@ -299,6 +299,6 @@ public void Full_rhyme()
299
299
  "that killed the rat\n" +
300
300
  "that ate the malt\n" +
301
301
  "that lay in the house that Jack built.";
302
- Assert.Equal(expected, House.Verses(1, 12));
302
+ Assert.Equal(expected, House.Recite(1, 12));
303
303
  }
304
304
  }
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.1.0 of the canonical data.
1
+ // This file was auto-generated based on version 2.0.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.1.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.2.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -41,9 +41,9 @@ public void Hypothetical_isogrammic_word_with_hyphen()
41
41
  }
42
42
 
43
43
  [Fact(Skip = "Remove to run test")]
44
- public void Isogram_with_duplicated_non_letter_character()
44
+ public void Isogram_with_duplicated_hyphen()
45
45
  {
46
- Assert.True(Isogram.IsIsogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"));
46
+ Assert.True(Isogram.IsIsogram("six-year-old"));
47
47
  }
48
48
 
49
49
  [Fact(Skip = "Remove to run test")]
@@ -66,32 +66,4 @@ public void Full_garden_last_students_garden()
66
66
  var sut = new KindergartenGarden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV");
67
67
  Assert.Equal(new[] { Plant.Grass, Plant.Violets, Plant.Clover, Plant.Violets }, sut.Plants("Larry"));
68
68
  }
69
-
70
- [Fact(Skip = "Remove to run test")]
71
- public void Non_alphabetical_student_list_first_students_garden()
72
- {
73
- var sut = new KindergartenGarden("VCRRGVRG\nRVGCCGCV", new[] { "Samantha", "Patricia", "Xander", "Roger" });
74
- Assert.Equal(new[] { Plant.Violets, Plant.Clover, Plant.Radishes, Plant.Violets }, sut.Plants("Patricia"));
75
- }
76
-
77
- [Fact(Skip = "Remove to run test")]
78
- public void Non_alphabetical_student_list_second_students_garden()
79
- {
80
- var sut = new KindergartenGarden("VCRRGVRG\nRVGCCGCV", new[] { "Samantha", "Patricia", "Xander", "Roger" });
81
- Assert.Equal(new[] { Plant.Radishes, Plant.Radishes, Plant.Grass, Plant.Clover }, sut.Plants("Roger"));
82
- }
83
-
84
- [Fact(Skip = "Remove to run test")]
85
- public void Non_alphabetical_student_list_third_students_garden()
86
- {
87
- var sut = new KindergartenGarden("VCRRGVRG\nRVGCCGCV", new[] { "Samantha", "Patricia", "Xander", "Roger" });
88
- Assert.Equal(new[] { Plant.Grass, Plant.Violets, Plant.Clover, Plant.Grass }, sut.Plants("Samantha"));
89
- }
90
-
91
- [Fact(Skip = "Remove to run test")]
92
- public void Non_alphabetical_student_list_fourth_last_students_garden()
93
- {
94
- var sut = new KindergartenGarden("VCRRGVRG\nRVGCCGCV", new[] { "Samantha", "Patricia", "Xander", "Roger" });
95
- Assert.Equal(new[] { Plant.Radishes, Plant.Grass, Plant.Clover, Plant.Violets }, sut.Plants("Xander"));
96
- }
97
69
  }
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.2.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -13,7 +13,7 @@ public void Year_not_divisible_by_4_is_common_year()
13
13
  [Fact(Skip = "Remove to run test")]
14
14
  public void Year_divisible_by_4_not_divisible_by_100_is_leap_year()
15
15
  {
16
- Assert.True(Leap.IsLeapYear(2016));
16
+ Assert.True(Leap.IsLeapYear(1996));
17
17
  }
18
18
 
19
19
  [Fact(Skip = "Remove to run test")]
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.2.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
  using System.Collections.Generic;
@@ -19,6 +19,20 @@ public void Empty_strand()
19
19
  Assert.Equal(expected, sut.NucleotideCounts);
20
20
  }
21
21
 
22
+ [Fact(Skip = "Remove to run test")]
23
+ public void Can_count_one_nucleotide_in_single_character_input()
24
+ {
25
+ var sut = new NucleotideCount("G");
26
+ var expected = new Dictionary<char, int>
27
+ {
28
+ ['A'] = 0,
29
+ ['C'] = 0,
30
+ ['G'] = 1,
31
+ ['T'] = 0
32
+ };
33
+ Assert.Equal(expected, sut.NucleotideCounts);
34
+ }
35
+
22
36
  [Fact(Skip = "Remove to run test")]
23
37
  public void Strand_with_repeated_nucleotide()
24
38
  {
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.1.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.3.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -10,6 +10,12 @@ public void Sentence_empty()
10
10
  Assert.False(Pangram.IsPangram(""));
11
11
  }
12
12
 
13
+ [Fact(Skip = "Remove to run test")]
14
+ public void Recognizes_a_perfect_lower_case_pangram()
15
+ {
16
+ Assert.True(Pangram.IsPangram("abcdefghijklmnopqrstuvwxyz"));
17
+ }
18
+
13
19
  [Fact(Skip = "Remove to run test")]
14
20
  public void Pangram_with_only_lower_case()
15
21
  {
@@ -23,9 +29,9 @@ public void Missing_character_x()
23
29
  }
24
30
 
25
31
  [Fact(Skip = "Remove to run test")]
26
- public void Another_missing_character_x()
32
+ public void Another_missing_character_e_g_h()
27
33
  {
28
- Assert.False(Pangram.IsPangram("the quick brown fish jumps over the lazy dog"));
34
+ Assert.False(Pangram.IsPangram("five boxing wizards jump quickly at it"));
29
35
  }
30
36
 
31
37
  [Fact(Skip = "Remove to run test")]
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.2.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
  using System;
@@ -39,6 +39,27 @@ public void Four_rows()
39
39
  Assert.Equal(expected, PascalsTriangle.Calculate(4));
40
40
  }
41
41
 
42
+ [Fact(Skip = "Remove to run test")]
43
+ public void Five_rows()
44
+ {
45
+ var expected = new[] { new[] { 1 }, new[] { 1, 1 }, new[] { 1, 2, 1 }, new[] { 1, 3, 3, 1 }, new[] { 1, 4, 6, 4, 1 } };
46
+ Assert.Equal(expected, PascalsTriangle.Calculate(5));
47
+ }
48
+
49
+ [Fact(Skip = "Remove to run test")]
50
+ public void Six_rows()
51
+ {
52
+ var expected = new[] { new[] { 1 }, new[] { 1, 1 }, new[] { 1, 2, 1 }, new[] { 1, 3, 3, 1 }, new[] { 1, 4, 6, 4, 1 }, new[] { 1, 5, 10, 10, 5, 1 } };
53
+ Assert.Equal(expected, PascalsTriangle.Calculate(6));
54
+ }
55
+
56
+ [Fact(Skip = "Remove to run test")]
57
+ public void Ten_rows()
58
+ {
59
+ var expected = new[] { new[] { 1 }, new[] { 1, 1 }, new[] { 1, 2, 1 }, new[] { 1, 3, 3, 1 }, new[] { 1, 4, 6, 4, 1 }, new[] { 1, 5, 10, 10, 5, 1 }, new[] { 1, 6, 15, 20, 15, 6, 1 }, new[] { 1, 7, 21, 35, 35, 21, 7, 1 }, new[] { 1, 8, 28, 56, 70, 56, 28, 8, 1 }, new[] { 1, 9, 36, 84, 126, 126, 84, 36, 9, 1 } };
60
+ Assert.Equal(expected, PascalsTriangle.Calculate(10));
61
+ }
62
+
42
63
  [Fact(Skip = "Remove to run test")]
43
64
  public void Negative_rows()
44
65
  {
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 2.0.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
  using System;
@@ -12,25 +12,25 @@ public void Queen_with_a_valid_position_does_not_throw_exception()
12
12
  }
13
13
 
14
14
  [Fact(Skip = "Remove to run test")]
15
- public void Queen_must_have_positive_rank()
15
+ public void Queen_must_have_positive_row()
16
16
  {
17
17
  Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(-2, 2));
18
18
  }
19
19
 
20
20
  [Fact(Skip = "Remove to run test")]
21
- public void Queen_must_have_rank_on_board()
21
+ public void Queen_must_have_row_on_board()
22
22
  {
23
23
  Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(8, 4));
24
24
  }
25
25
 
26
26
  [Fact(Skip = "Remove to run test")]
27
- public void Queen_must_have_positive_file()
27
+ public void Queen_must_have_positive_column()
28
28
  {
29
29
  Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(2, -2));
30
30
  }
31
31
 
32
32
  [Fact(Skip = "Remove to run test")]
33
- public void Queen_must_have_file_on_board()
33
+ public void Queen_must_have_column_on_board()
34
34
  {
35
35
  Assert.Throws<ArgumentOutOfRangeException>(() => QueenAttack.Create(4, 8));
36
36
  }
@@ -44,7 +44,7 @@ public void Can_not_attack()
44
44
  }
45
45
 
46
46
  [Fact(Skip = "Remove to run test")]
47
- public void Can_attack_on_same_rank()
47
+ public void Can_attack_on_same_row()
48
48
  {
49
49
  var whiteQueen = QueenAttack.Create(2,4);
50
50
  var blackQueen = QueenAttack.Create(2,6);
@@ -52,7 +52,7 @@ public void Can_attack_on_same_rank()
52
52
  }
53
53
 
54
54
  [Fact(Skip = "Remove to run test")]
55
- public void Can_attack_on_same_file()
55
+ public void Can_attack_on_same_column()
56
56
  {
57
57
  var whiteQueen = QueenAttack.Create(4,5);
58
58
  var blackQueen = QueenAttack.Create(2,5);
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.1.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.2.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -4,12 +4,5 @@ namespace Generators.Exercises
4
4
  {
5
5
  public class IsbnVerifier : Exercise
6
6
  {
7
- protected override void UpdateCanonicalData(CanonicalData canonicalData)
8
- {
9
- foreach (var canonicalDataCase in canonicalData.Cases)
10
- {
11
- canonicalDataCase.Property = "IsValid";
12
- }
13
- }
14
7
  }
15
8
  }
@@ -5,3 +5,33 @@ analyzer:
5
5
  unused_import: error
6
6
  unused_local_variable: error
7
7
  dead_code: error
8
+
9
+ linter:
10
+ rules:
11
+ # Error Rules
12
+ - avoid_empty_else
13
+ - empty_statements
14
+ - literal_only_boolean_expressions
15
+ - no_duplicate_case_values
16
+ - unnecessary_statements
17
+ - valid_regexps
18
+
19
+ # Style Rules
20
+ - always_declare_return_types
21
+ - always_put_required_named_parameters_first
22
+ - always_require_non_null_named_parameters
23
+ - annotate_overrides
24
+ - avoid_init_to_null
25
+ - avoid_return_types_on_setters
26
+ - camel_case_types
27
+ - constant_identifier_names
28
+ - empty_catches
29
+ - empty_constructor_bodies
30
+ - one_member_abstracts
31
+ - slash_for_doc_comments
32
+ - sort_constructors_first
33
+ - unnecessary_brace_in_string_interp
34
+ - use_setters_to_change_properties
35
+
36
+ # Package Rules
37
+ - package_names
@@ -0,0 +1,90 @@
1
+ package main
2
+
3
+ import (
4
+ "encoding/json"
5
+ "log"
6
+ "text/template"
7
+
8
+ "../../../gen"
9
+ )
10
+
11
+ func main() {
12
+ t, err := template.New("").Parse(tmpl)
13
+ if err != nil {
14
+ log.Fatal(err)
15
+ }
16
+ var j js
17
+ if err := gen.Gen("run-length-encoding", &j, t); err != nil {
18
+ log.Fatal(err)
19
+ }
20
+ }
21
+
22
+ // The JSON structure we expect to be able to umarshal into
23
+ type js struct {
24
+ Groups []testGroup `json:"Cases"`
25
+ }
26
+
27
+ type testGroup struct {
28
+ Description string
29
+ Cases []json.RawMessage `property:"RAW"`
30
+ EncodeCases []struct {
31
+ Description string
32
+ Input string
33
+ Expected string
34
+ } `property:"encode"`
35
+ DecodeCases []struct {
36
+ Description string
37
+ Input string
38
+ Expected string
39
+ } `property:"decode"`
40
+ EncodeDecodeCases []struct {
41
+ Description string
42
+ Input string
43
+ Expected string
44
+ } `property:"consistency"`
45
+ }
46
+
47
+ var tmpl = `package encode
48
+
49
+ {{.Header}}
50
+
51
+ {{range .J.Groups}}
52
+ // {{ .Description }}
53
+
54
+ {{- if .EncodeCases }}
55
+ var encodeTests = []struct {
56
+ input string
57
+ expected string
58
+ description string
59
+ }{
60
+ {{- range .EncodeCases }}
61
+ { {{.Input | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
62
+ {{- end }}
63
+ }
64
+ {{- end }}
65
+
66
+ {{- if .DecodeCases }}
67
+ var decodeTests = []struct {
68
+ input string
69
+ expected string
70
+ description string
71
+ }{
72
+ {{- range .DecodeCases }}
73
+ { {{.Input | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
74
+ {{- end }}
75
+ }
76
+ {{- end }}
77
+
78
+ {{- if .EncodeDecodeCases }}
79
+ var encodeDecodeTests = []struct {
80
+ input string
81
+ expected string
82
+ description string
83
+ }{
84
+ {{- range .EncodeDecodeCases }}
85
+ { {{.Input | printf "%q"}}, {{.Expected | printf "%q"}}, {{.Description | printf "%q"}} },
86
+ {{- end }}
87
+ }
88
+ {{- end }}
89
+ {{end}}
90
+ `
@@ -0,0 +1,42 @@
1
+ package encode
2
+
3
+ // Source: exercism/problem-specifications
4
+ // Commit: 503a57a run-length-encoding: Fix canonical-data.json formatting
5
+ // Problem Specifications Version: 1.0.0
6
+
7
+ // run-length encode a string
8
+ var encodeTests = []struct {
9
+ input string
10
+ expected string
11
+ description string
12
+ }{
13
+ {"", "", "empty string"},
14
+ {"XYZ", "XYZ", "single characters only are encoded without count"},
15
+ {"AABBBCCCC", "2A3B4C", "string with no single characters"},
16
+ {"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB", "12WB12W3B24WB", "single characters mixed with repeated characters"},
17
+ {" hsqq qww ", "2 hs2q q2w2 ", "multiple whitespace mixed in string"},
18
+ {"aabbbcccc", "2a3b4c", "lowercase characters"},
19
+ }
20
+
21
+ // run-length decode a string
22
+ var decodeTests = []struct {
23
+ input string
24
+ expected string
25
+ description string
26
+ }{
27
+ {"", "", "empty string"},
28
+ {"XYZ", "XYZ", "single characters only"},
29
+ {"2A3B4C", "AABBBCCCC", "string with no single characters"},
30
+ {"12WB12W3B24WB", "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB", "single characters with repeated characters"},
31
+ {"2 hs2q q2w2 ", " hsqq qww ", "multiple whitespace mixed in string"},
32
+ {"2a3b4c", "aabbbcccc", "lower case string"},
33
+ }
34
+
35
+ // encode and then decode
36
+ var encodeDecodeTests = []struct {
37
+ input string
38
+ expected string
39
+ description string
40
+ }{
41
+ {"zzz ZZ zZ", "zzz ZZ zZ", "encode followed by decode gives original string"},
42
+ }
@@ -2,58 +2,30 @@ package encode
2
2
 
3
3
  import "testing"
4
4
 
5
- var encodeTests = []struct {
6
- input string
7
- expected string
8
- }{
9
- {"", ""},
10
- {"XYZ", "XYZ"},
11
- {"AABBBCCCC", "2A3B4C"},
12
- {"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB", "12WB12W3B24WB"},
13
- {" hsqq qww ", "2 hs2q q2w2 "},
14
- {"aabbbcccc", "2a3b4c"},
15
- }
16
-
17
- var decodeTests = []struct {
18
- input string
19
- expected string
20
- }{
21
- {"", ""},
22
- {"XYZ", "XYZ"},
23
- {"2A3B4C", "AABBBCCCC"},
24
- {"12WB12W3B24WB", "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"},
25
- {"2 hs2q q2w2 ", " hsqq qww "},
26
- {"2a3b4c", "aabbbcccc"},
27
- }
28
-
29
- var encodeDecodeTests = []struct {
30
- input string
31
- expected string
32
- }{
33
- {"zzz ZZ zZ", "zzz ZZ zZ"},
34
- }
35
-
36
5
  func TestRunLengthEncode(t *testing.T) {
37
6
  for _, test := range encodeTests {
38
7
  if actual := RunLengthEncode(test.input); actual != test.expected {
39
- t.Errorf("RunLengthEncode(%s) = %q, expected %q.",
40
- test.input, actual, test.expected)
8
+ t.Errorf("FAIL %s - RunLengthEncode(%s) = %q, expected %q.",
9
+ test.description, test.input, actual, test.expected)
41
10
  }
11
+ t.Logf("PASS RunLengthEncode - %s", test.description)
42
12
  }
43
13
  }
44
14
  func TestRunLengthDecode(t *testing.T) {
45
15
  for _, test := range decodeTests {
46
16
  if actual := RunLengthDecode(test.input); actual != test.expected {
47
- t.Errorf("RunLengthDecode(%s) = %q, expected %q.",
48
- test.input, actual, test.expected)
17
+ t.Errorf("FAIL %s - RunLengthDecode(%s) = %q, expected %q.",
18
+ test.description, test.input, actual, test.expected)
49
19
  }
20
+ t.Logf("PASS RunLengthDecode - %s", test.description)
50
21
  }
51
22
  }
52
23
  func TestRunLengthEncodeDecode(t *testing.T) {
53
24
  for _, test := range encodeDecodeTests {
54
25
  if actual := RunLengthDecode(RunLengthEncode(test.input)); actual != test.expected {
55
- t.Errorf("RunLengthDecode(RunLengthEncode(%s)) = %q, expected %q.",
56
- test.input, actual, test.expected)
26
+ t.Errorf("FAIL %s - RunLengthDecode(RunLengthEncode(%s)) = %q, expected %q.",
27
+ test.description, test.input, actual, test.expected)
57
28
  }
29
+ t.Logf("PASS %s", test.description)
58
30
  }
59
31
  }
@@ -932,9 +932,19 @@
932
932
  ],
933
933
  "unlocked_by": "difference-of-squares",
934
934
  "uuid": "bd4cd740-b78d-11e7-abc4-cec278b6b50a"
935
+ },
936
+ {
937
+ "core": false,
938
+ "difficulty": 3,
939
+ "slug": "queen-attack",
940
+ "topics": [
941
+ "mathematics"
942
+ ],
943
+ "unlocked_by": "list-ops",
944
+ "uuid": "09df8b87-c2cf-44a7-879c-96c9030cf27b"
935
945
  }
936
946
  ],
937
947
  "foregone": [],
938
948
  "language": "Lua",
939
949
  "test_pattern": ".*spec[.]lua$"
940
- }
950
+ }
@@ -0,0 +1,43 @@
1
+ # Collatz Conjecture
2
+
3
+ The Collatz Conjecture or 3x+1 problem can be summarized as follows:
4
+
5
+ Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is
6
+ odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely.
7
+ The conjecture states that no matter which number you start with, you will
8
+ always reach 1 eventually.
9
+
10
+ Given a number n, return the number of steps required to reach 1.
11
+
12
+ ## Examples
13
+
14
+ Starting with n = 12, the steps would be as follows:
15
+
16
+ 0. 12
17
+ 1. 6
18
+ 2. 3
19
+ 3. 10
20
+ 4. 5
21
+ 5. 16
22
+ 6. 8
23
+ 7. 4
24
+ 8. 2
25
+ 9. 1
26
+
27
+ Resulting in 9 steps. So for input n = 12, the return value would be 9.
28
+
29
+ ## Running the tests
30
+
31
+ To run the tests, run the command `busted .` from within the exercise directory.
32
+
33
+ ## Further information
34
+
35
+ For more detailed information about the Lua track, including how to get help if
36
+ you're having trouble, please visit the exercism.io [Lua language page](http://exercism.io/languages/lua/about).
37
+
38
+ ## Source
39
+
40
+ An unsolved problem in mathematics named after mathematician Lothar Collatz [https://en.wikipedia.org/wiki/3x_%2B_1_problem](https://en.wikipedia.org/wiki/3x_%2B_1_problem)
41
+
42
+ ## Submitting Incomplete Solutions
43
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,21 @@
1
+ return function(pos)
2
+ assert(pos.row >= 0, 'row must be positive')
3
+ assert(pos.row < 8, 'row must be on the board')
4
+ assert(pos.column >= 0, 'column must be positive')
5
+ assert(pos.column < 8, 'column must be on the board')
6
+
7
+ return {
8
+ row = pos.row,
9
+ column = pos.column,
10
+ can_attack = function(other)
11
+ local row_difference = math.abs(pos.row - other.row)
12
+ local column_difference = math.abs(pos.column - other.column)
13
+
14
+ local same_row = row_difference == 0
15
+ local same_column = column_difference == 0
16
+ local diagonal = row_difference == column_difference
17
+
18
+ return same_row or same_column or diagonal
19
+ end
20
+ }
21
+ end
@@ -0,0 +1,75 @@
1
+ local Queen = require('queen-attack')
2
+
3
+ describe('collatz-conjecture', function()
4
+ it('queen with a valid position', function()
5
+ assert.has_no_error(function()
6
+ Queen({ row = 2, column = 2 })
7
+ end)
8
+ end)
9
+
10
+ it('queen must have a positive row', function()
11
+ assert.has_error(function()
12
+ Queen({ row = -2, column = 2 })
13
+ end)
14
+ end)
15
+
16
+ it('queen must have row on board', function()
17
+ assert.has_error(function()
18
+ Queen({ row = 8, column = 4 })
19
+ end)
20
+ end)
21
+
22
+ it('queen must have positive column', function()
23
+ assert.has_error(function()
24
+ Queen({ row = 2, column = -2 })
25
+ end)
26
+ end)
27
+
28
+ it('queen must have column on board', function()
29
+ assert.has_error(function()
30
+ Queen({ row = 4, column = 8 })
31
+ end)
32
+ end)
33
+
34
+ it('can not attack', function()
35
+ local q1 = Queen({ row = 2, column = 4 })
36
+ local q2 = Queen({ row = 6, column = 6 })
37
+ assert.is_false(q1.can_attack(q2))
38
+ end)
39
+
40
+ it('can attack on same row', function()
41
+ local q1 = Queen({ row = 2, column = 4 })
42
+ local q2 = Queen({ row = 2, column = 6 })
43
+ assert.is_true(q1.can_attack(q2))
44
+ end)
45
+
46
+ it('can attack on same column', function()
47
+ local q1 = Queen({ row = 4, column = 5 })
48
+ local q2 = Queen({ row = 2, column = 5 })
49
+ assert.is_true(q1.can_attack(q2))
50
+ end)
51
+
52
+ it('can attack on first diagonal', function()
53
+ local q1 = Queen({ row = 2, column = 2 })
54
+ local q2 = Queen({ row = 0, column = 4 })
55
+ assert.is_true(q1.can_attack(q2))
56
+ end)
57
+
58
+ it('can attack on second diagonal', function()
59
+ local q1 = Queen({ row = 2, column = 2 })
60
+ local q2 = Queen({ row = 3, column = 1 })
61
+ assert.is_true(q1.can_attack(q2))
62
+ end)
63
+
64
+ it('can attack on third diagonal', function()
65
+ local q1 = Queen({ row = 2, column = 2 })
66
+ local q2 = Queen({ row = 1, column = 1 })
67
+ assert.is_true(q1.can_attack(q2))
68
+ end)
69
+
70
+ it('can attack on fourth diagonal', function()
71
+ local q1 = Queen({ row = 2, column = 2 })
72
+ local q2 = Queen({ row = 5, column = 5 })
73
+ assert.is_true(q1.can_attack(q2))
74
+ end)
75
+ end)
@@ -480,7 +480,7 @@
480
480
  "integers"
481
481
  ],
482
482
  "unlocked_by": null,
483
- "uuid": "f64b5655-0256-0580-a1dc-5b114910f0f36f0c255"
483
+ "uuid": "1d841c21-f251-42ff-9fbd-cc88330eb1c3"
484
484
  },
485
485
  {
486
486
  "core": false,
@@ -492,7 +492,7 @@
492
492
  "mathematics"
493
493
  ],
494
494
  "unlocked_by": null,
495
- "uuid": "8e3d974c-0020-3880-e92e-af4fedd478e00ce788a"
495
+ "uuid": "924a7103-040c-4b49-a11d-16c9e811d84b"
496
496
  }
497
497
  ],
498
498
  "foregone": [],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.63
4
+ version: 2.2.1.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-11 00:00:00.000000000 Z
11
+ date: 2017-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -5923,7 +5923,9 @@ files:
5923
5923
  - tracks/go/exercises/rotational-cipher/README.md
5924
5924
  - tracks/go/exercises/rotational-cipher/example.go
5925
5925
  - tracks/go/exercises/rotational-cipher/rotational_cipher_test.go
5926
+ - tracks/go/exercises/run-length-encoding/.meta/gen.go
5926
5927
  - tracks/go/exercises/run-length-encoding/README.md
5928
+ - tracks/go/exercises/run-length-encoding/cases_test.go
5927
5929
  - tracks/go/exercises/run-length-encoding/example.go
5928
5930
  - tracks/go/exercises/run-length-encoding/run_length_encoding_test.go
5929
5931
  - tracks/go/exercises/saddle-points/README.md
@@ -8783,6 +8785,9 @@ files:
8783
8785
  - tracks/lua/exercises/pythagorean-triplet/README.md
8784
8786
  - tracks/lua/exercises/pythagorean-triplet/example.lua
8785
8787
  - tracks/lua/exercises/pythagorean-triplet/pythagorean-triplet_spec.lua
8788
+ - tracks/lua/exercises/queen-attack/README.md
8789
+ - tracks/lua/exercises/queen-attack/example.lua
8790
+ - tracks/lua/exercises/queen-attack/queen-attack_spec.lua
8786
8791
  - tracks/lua/exercises/rail-fence-cipher/README.md
8787
8792
  - tracks/lua/exercises/rail-fence-cipher/example.lua
8788
8793
  - tracks/lua/exercises/rail-fence-cipher/rail-fence-cipher_spec.lua