trackler 2.2.1.135 → 2.2.1.136

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/pov/canonical-data.json +33 -1
  4. data/tracks/c/exercises/acronym/test/test_acronym.c +25 -17
  5. data/tracks/csharp/exercises/binary-search-tree/BinarySearchTreeTest.cs +37 -28
  6. data/tracks/csharp/generators/Exercises/BinarySearchTree.cs +69 -0
  7. data/tracks/haskell/config.json +1 -0
  8. data/tracks/haskell/exercises/accumulate/package.yaml +1 -1
  9. data/tracks/haskell/exercises/acronym/package.yaml +1 -1
  10. data/tracks/haskell/exercises/all-your-base/package.yaml +1 -1
  11. data/tracks/haskell/exercises/allergies/package.yaml +1 -1
  12. data/tracks/haskell/exercises/alphametics/package.yaml +1 -1
  13. data/tracks/haskell/exercises/anagram/package.yaml +1 -1
  14. data/tracks/haskell/exercises/atbash-cipher/package.yaml +1 -1
  15. data/tracks/haskell/exercises/bank-account/package.yaml +1 -1
  16. data/tracks/haskell/exercises/beer-song/package.yaml +1 -1
  17. data/tracks/haskell/exercises/binary-search-tree/package.yaml +1 -1
  18. data/tracks/haskell/exercises/binary/package.yaml +1 -1
  19. data/tracks/haskell/exercises/bob/package.yaml +1 -1
  20. data/tracks/haskell/exercises/bowling/package.yaml +1 -1
  21. data/tracks/haskell/exercises/bracket-push/package.yaml +1 -1
  22. data/tracks/haskell/exercises/change/package.yaml +1 -1
  23. data/tracks/haskell/exercises/clock/package.yaml +1 -1
  24. data/tracks/haskell/exercises/collatz-conjecture/package.yaml +1 -1
  25. data/tracks/haskell/exercises/complex-numbers/package.yaml +1 -1
  26. data/tracks/haskell/exercises/connect/package.yaml +1 -1
  27. data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
  28. data/tracks/haskell/exercises/custom-set/package.yaml +1 -1
  29. data/tracks/haskell/exercises/diamond/package.yaml +1 -1
  30. data/tracks/haskell/exercises/difference-of-squares/package.yaml +1 -1
  31. data/tracks/haskell/exercises/dominoes/package.yaml +1 -1
  32. data/tracks/haskell/exercises/etl/package.yaml +1 -1
  33. data/tracks/haskell/exercises/food-chain/package.yaml +1 -1
  34. data/tracks/haskell/exercises/forth/package.yaml +1 -1
  35. data/tracks/haskell/exercises/gigasecond/package.yaml +1 -1
  36. data/tracks/haskell/exercises/go-counting/package.yaml +1 -1
  37. data/tracks/haskell/exercises/grade-school/package.yaml +1 -1
  38. data/tracks/haskell/exercises/grains/package.yaml +1 -1
  39. data/tracks/haskell/exercises/hamming/package.yaml +1 -1
  40. data/tracks/haskell/exercises/hello-world/package.yaml +1 -1
  41. data/tracks/haskell/exercises/hexadecimal/package.yaml +1 -1
  42. data/tracks/haskell/exercises/house/package.yaml +1 -1
  43. data/tracks/haskell/exercises/isbn-verifier/package.yaml +1 -1
  44. data/tracks/haskell/exercises/isogram/package.yaml +1 -1
  45. data/tracks/haskell/exercises/kindergarten-garden/examples/success-standard/src/Garden.hs +1 -10
  46. data/tracks/haskell/exercises/kindergarten-garden/package.yaml +2 -3
  47. data/tracks/haskell/exercises/kindergarten-garden/src/Garden.hs +3 -7
  48. data/tracks/haskell/exercises/kindergarten-garden/test/Tests.hs +10 -16
  49. data/tracks/haskell/exercises/largest-series-product/package.yaml +1 -1
  50. data/tracks/haskell/exercises/leap/package.yaml +1 -1
  51. data/tracks/haskell/exercises/lens-person/examples/success-standard/package.yaml +0 -1
  52. data/tracks/haskell/exercises/lens-person/package.yaml +1 -1
  53. data/tracks/haskell/exercises/linked-list/package.yaml +1 -1
  54. data/tracks/haskell/exercises/list-ops/package.yaml +1 -1
  55. data/tracks/haskell/exercises/luhn/package.yaml +1 -1
  56. data/tracks/haskell/exercises/matrix/package.yaml +1 -1
  57. data/tracks/haskell/exercises/meetup/package.yaml +1 -1
  58. data/tracks/haskell/exercises/minesweeper/package.yaml +1 -1
  59. data/tracks/haskell/exercises/nth-prime/package.yaml +1 -1
  60. data/tracks/haskell/exercises/nucleotide-count/package.yaml +1 -1
  61. data/tracks/haskell/exercises/ocr-numbers/package.yaml +1 -1
  62. data/tracks/haskell/exercises/octal/package.yaml +1 -1
  63. data/tracks/haskell/exercises/palindrome-products/package.yaml +1 -1
  64. data/tracks/haskell/exercises/pangram/package.yaml +1 -1
  65. data/tracks/haskell/exercises/parallel-letter-frequency/package.yaml +1 -1
  66. data/tracks/haskell/exercises/pascals-triangle/package.yaml +1 -1
  67. data/tracks/haskell/exercises/perfect-numbers/package.yaml +1 -1
  68. data/tracks/haskell/exercises/phone-number/package.yaml +1 -1
  69. data/tracks/haskell/exercises/pig-latin/package.yaml +1 -1
  70. data/tracks/haskell/exercises/poker/package.yaml +1 -1
  71. data/tracks/haskell/exercises/pov/package.yaml +2 -2
  72. data/tracks/haskell/exercises/pov/test/Tests.hs +15 -0
  73. data/tracks/haskell/exercises/prime-factors/package.yaml +1 -1
  74. data/tracks/haskell/exercises/protein-translation/package.yaml +1 -1
  75. data/tracks/haskell/exercises/pythagorean-triplet/package.yaml +1 -1
  76. data/tracks/haskell/exercises/queen-attack/package.yaml +1 -1
  77. data/tracks/haskell/exercises/rail-fence-cipher/package.yaml +1 -1
  78. data/tracks/haskell/exercises/raindrops/package.yaml +1 -1
  79. data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -1
  80. data/tracks/haskell/exercises/robot-name/package.yaml +1 -1
  81. data/tracks/haskell/exercises/robot-simulator/package.yaml +1 -1
  82. data/tracks/haskell/exercises/roman-numerals/package.yaml +1 -1
  83. data/tracks/haskell/exercises/rotational-cipher/package.yaml +1 -1
  84. data/tracks/haskell/exercises/run-length-encoding/package.yaml +1 -1
  85. data/tracks/haskell/exercises/saddle-points/package.yaml +1 -1
  86. data/tracks/haskell/exercises/say/package.yaml +1 -1
  87. data/tracks/haskell/exercises/scrabble-score/package.yaml +1 -1
  88. data/tracks/haskell/exercises/secret-handshake/package.yaml +1 -1
  89. data/tracks/haskell/exercises/series/package.yaml +1 -1
  90. data/tracks/haskell/exercises/sgf-parsing/package.yaml +1 -1
  91. data/tracks/haskell/exercises/sieve/package.yaml +1 -1
  92. data/tracks/haskell/exercises/simple-cipher/package.yaml +1 -1
  93. data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -1
  94. data/tracks/haskell/exercises/space-age/package.yaml +1 -1
  95. data/tracks/haskell/exercises/spiral-matrix/package.yaml +1 -1
  96. data/tracks/haskell/exercises/strain/package.yaml +1 -1
  97. data/tracks/haskell/exercises/sublist/package.yaml +1 -1
  98. data/tracks/haskell/exercises/sum-of-multiples/package.yaml +1 -1
  99. data/tracks/haskell/exercises/transpose/package.yaml +1 -1
  100. data/tracks/haskell/exercises/triangle/package.yaml +1 -1
  101. data/tracks/haskell/exercises/trinary/package.yaml +1 -1
  102. data/tracks/haskell/exercises/twelve-days/package.yaml +1 -1
  103. data/tracks/haskell/exercises/word-count/package.yaml +1 -1
  104. data/tracks/haskell/exercises/wordy/package.yaml +1 -1
  105. data/tracks/haskell/exercises/zebra-puzzle/package.yaml +1 -1
  106. data/tracks/haskell/exercises/zipper/package.yaml +1 -1
  107. data/tracks/java/CONTRIBUTING.md +39 -3
  108. data/tracks/java/POLICIES.md +68 -3
  109. data/tracks/java/exercises/crypto-square/README.md +4 -5
  110. data/tracks/java/exercises/error-handling/README.md +38 -0
  111. data/tracks/java/exercises/series/README.md +6 -6
  112. data/tracks/java/exercises/sieve/README.md +5 -3
  113. data/tracks/java/scripts/canonical_data_check.sh +1 -1
  114. data/tracks/python/exercises/react/example.py +54 -63
  115. data/tracks/python/exercises/react/react.py +10 -10
  116. data/tracks/python/exercises/react/react_test.py +197 -131
  117. data/tracks/python/exercises/sieve/README.md +5 -3
  118. data/tracks/rust/exercises/react/example.rs +103 -64
  119. data/tracks/rust/exercises/react/src/lib.rs +31 -17
  120. data/tracks/rust/exercises/react/tests/react.rs +52 -61
  121. data/tracks/swift/config.json +11 -0
  122. data/tracks/swift/exercises/circular-buffer/Sources/CircularBufferExample.swift +12 -12
  123. data/tracks/swift/exercises/circular-buffer/Tests/CircularBufferTests/CircularBufferTests.swift +1 -1
  124. data/tracks/swift/exercises/proverb/Package.swift +5 -0
  125. data/tracks/swift/exercises/proverb/README.md +25 -0
  126. data/tracks/swift/exercises/proverb/Sources/Proverb.swift +1 -0
  127. data/tracks/swift/exercises/proverb/Sources/ProverbExample.swift +28 -0
  128. data/tracks/swift/exercises/proverb/Tests/LinuxMain.swift +6 -0
  129. data/tracks/swift/exercises/proverb/Tests/ProverbTests/ProverbTests.swift +61 -0
  130. data/tracks/typescript/config.json +14 -0
  131. data/tracks/typescript/exercises/palindrome-products/README.md +65 -0
  132. data/tracks/typescript/exercises/palindrome-products/package.json +36 -0
  133. data/tracks/typescript/exercises/palindrome-products/palindrome-products.example.ts +38 -0
  134. data/tracks/typescript/exercises/palindrome-products/palindrome-products.test.ts +69 -0
  135. data/tracks/typescript/exercises/palindrome-products/palindrome-products.ts +0 -0
  136. data/tracks/typescript/exercises/palindrome-products/tsconfig.json +22 -0
  137. data/tracks/typescript/exercises/palindrome-products/tslint.json +127 -0
  138. data/tracks/typescript/exercises/palindrome-products/yarn.lock +2624 -0
  139. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e668f282132d63c1231f79fddb5137f51faf314e
4
- data.tar.gz: 127deef6f4aa01b28b4b74330f9826aed28fa24c
3
+ metadata.gz: 699eec34e75cdaa468a3ce1c7a3886760cf01a6a
4
+ data.tar.gz: e4eba91c00477ab11723b6ab763fddc63a8d96e5
5
5
  SHA512:
6
- metadata.gz: 04c5e56a00719b737739a8490682bafee1888a1879a26a4a6b008ad301e5df2811d223bcf5f6cf819b834366863087b92dd77b78dd4ab524c7fe83e6dc31f3ca
7
- data.tar.gz: d5dfc98f5a4349fa1c383b66f954eaeed399eb836f40fac6bde8a57531572c3b05513e2b59ab33e4b91761d5c5592f4f827d80532fdb684d9e84524e56151d15
6
+ metadata.gz: f33e6a32dbb9cbde60a28160521ffe29f85855f0ccdc367576bf22167b2588dd267f38067773cec141423efe21314cb22ac6dea70e51b288df5d7ddef29d3468
7
+ data.tar.gz: a8edb8f1fac25c9f7fd9520803b22cbb6711d1741637c84fe0842e0544365610fdbc87d1d8e4a8a95eb81f0643b5a4534d057cdff14184cabf9a9f57c50635e0
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.135"
2
+ VERSION = "2.2.1.136"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "pov",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "cases": [
5
5
  {
6
6
  "description": "Reroot a tree so that its root is the specified node.",
@@ -434,6 +434,38 @@
434
434
  "cousin-1"
435
435
  ]
436
436
  },
437
+ {
438
+ "description": "Can find path not involving root",
439
+ "property": "pathTo",
440
+ "input": {
441
+ "from": "x",
442
+ "to": "sibling-1",
443
+ "tree": {
444
+ "label": "grandparent",
445
+ "children": [
446
+ {
447
+ "label": "parent",
448
+ "children": [
449
+ {
450
+ "label": "x"
451
+ },
452
+ {
453
+ "label": "sibling-0"
454
+ },
455
+ {
456
+ "label": "sibling-1"
457
+ }
458
+ ]
459
+ }
460
+ ]
461
+ }
462
+ },
463
+ "expected": [
464
+ "x",
465
+ "parent",
466
+ "sibling-1"
467
+ ]
468
+ },
437
469
  {
438
470
  "description": "Can find path from nodes other than x",
439
471
  "property": "pathTo",
@@ -26,14 +26,6 @@ void test_null_string(void)
26
26
  test_abbreviation(phrase, expected);
27
27
  }
28
28
 
29
- void test_empty_string(void)
30
- {
31
- TEST_IGNORE();
32
- char *phrase = "";
33
- char *expected = NULL;
34
- test_abbreviation(phrase, expected);
35
- }
36
-
37
29
  void test_basic_abbreviation(void)
38
30
  {
39
31
  TEST_IGNORE();
@@ -58,6 +50,22 @@ void test_punctuation(void)
58
50
  test_abbreviation(phrase, expected);
59
51
  }
60
52
 
53
+ void test_non_acronym_all_caps_words(void)
54
+ {
55
+ TEST_IGNORE();
56
+ char *phrase = "GNU Image Manipulation Program";
57
+ char *expected = "GIMP";
58
+ test_abbreviation(phrase, expected);
59
+ }
60
+
61
+ void test_hyphenated(void)
62
+ {
63
+ TEST_IGNORE();
64
+ char *phrase = "Complementary metal-oxide semiconductor";
65
+ char *expected = "CMOS";
66
+ test_abbreviation(phrase, expected);
67
+ }
68
+
61
69
  void test_all_caps_words(void)
62
70
  {
63
71
  TEST_IGNORE();
@@ -66,19 +74,19 @@ void test_all_caps_words(void)
66
74
  test_abbreviation(phrase, expected);
67
75
  }
68
76
 
69
- void test_non_acronym_all_caps_words(void)
77
+ void test_empty_string(void)
70
78
  {
71
79
  TEST_IGNORE();
72
- char *phrase = "GNU Image Manipulation Program";
73
- char *expected = "GIMP";
80
+ char *phrase = "";
81
+ char *expected = NULL;
74
82
  test_abbreviation(phrase, expected);
75
83
  }
76
84
 
77
- void test_hyphenated(void)
85
+ void test_all_words_starting_with_lowercase(void)
78
86
  {
79
87
  TEST_IGNORE();
80
- char *phrase = "Complementary metal-oxide semiconductor";
81
- char *expected = "CMOS";
88
+ char *phrase = "for what it's worth";
89
+ char *expected = "FWIW";
82
90
  test_abbreviation(phrase, expected);
83
91
  }
84
92
 
@@ -88,13 +96,13 @@ int main(void)
88
96
 
89
97
  RUN_TEST(test_basic_abbreviation);
90
98
  RUN_TEST(test_null_string);
91
- RUN_TEST(test_empty_string);
92
99
  RUN_TEST(test_lower_case_words);
93
100
  RUN_TEST(test_punctuation);
94
- RUN_TEST(test_all_caps_words);
95
101
  RUN_TEST(test_non_acronym_all_caps_words);
96
102
  RUN_TEST(test_hyphenated);
97
-
103
+ RUN_TEST(test_all_caps_words);
104
+ RUN_TEST(test_empty_string);
105
+ RUN_TEST(test_all_words_starting_with_lowercase);
98
106
  UnityEnd();
99
107
  return 0;
100
108
  }
@@ -1,5 +1,7 @@
1
- using System.Linq;
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
2
3
  using Xunit;
4
+ using System.Linq;
3
5
 
4
6
  public class BinarySearchTreeTest
5
7
  {
@@ -11,67 +13,74 @@ public void Data_is_retained()
11
13
  }
12
14
 
13
15
  [Fact(Skip = "Remove to run test")]
14
- public void Inserting_less()
16
+ public void Can_create_complex_tree()
15
17
  {
16
- var tree = new BinarySearchTree(4).Add(2);
18
+ var tree = new BinarySearchTree(new[] { 4, 2, 6, 1, 3, 5, 7 });
17
19
  Assert.Equal(4, tree.Value);
18
20
  Assert.Equal(2, tree.Left.Value);
21
+ Assert.Equal(1, tree.Left.Left.Value);
22
+ Assert.Equal(3, tree.Left.Right.Value);
23
+ Assert.Equal(6, tree.Right.Value);
24
+ Assert.Equal(5, tree.Right.Left.Value);
25
+ Assert.Equal(7, tree.Right.Right.Value);
19
26
  }
20
27
 
21
28
  [Fact(Skip = "Remove to run test")]
22
- public void Inserting_same()
29
+ public void Smaller_number_at_left_node()
23
30
  {
24
- var tree = new BinarySearchTree(4).Add(4);
31
+ var tree = new BinarySearchTree(new[] { 4, 2 });
32
+ Assert.Equal(4, tree.Value);
33
+ Assert.Equal(2, tree.Left.Value);
34
+ }
35
+
36
+ [Fact(Skip = "Remove to run test")]
37
+ public void Same_number_at_left_node()
38
+ {
39
+ var tree = new BinarySearchTree(new[] { 4, 4 });
25
40
  Assert.Equal(4, tree.Value);
26
41
  Assert.Equal(4, tree.Left.Value);
27
42
  }
28
43
 
29
44
  [Fact(Skip = "Remove to run test")]
30
- public void Inserting_greater()
45
+ public void Greater_number_at_right_node()
31
46
  {
32
- var tree = new BinarySearchTree(4).Add(5);
47
+ var tree = new BinarySearchTree(new[] { 4, 5 });
33
48
  Assert.Equal(4, tree.Value);
34
49
  Assert.Equal(5, tree.Right.Value);
35
50
  }
36
51
 
37
52
  [Fact(Skip = "Remove to run test")]
38
- public void Complex_tree()
53
+ public void Can_sort_single_number()
39
54
  {
40
- var tree = new BinarySearchTree(new [] { 4, 2, 6, 1, 3, 7, 5 });
41
- Assert.Equal(4, tree.Value);
42
- Assert.Equal(2, tree.Left.Value);
43
- Assert.Equal(1, tree.Left.Left.Value);
44
- Assert.Equal(3, tree.Left.Right.Value);
45
- Assert.Equal(6, tree.Right.Value);
46
- Assert.Equal(5, tree.Right.Left.Value);
47
- Assert.Equal(7, tree.Right.Right.Value);
55
+ var tree = new BinarySearchTree(2);
56
+ Assert.Equal(new[] { 2 }, tree.AsEnumerable());
48
57
  }
49
58
 
50
59
  [Fact(Skip = "Remove to run test")]
51
- public void Iterating_one_element()
60
+ public void Can_sort_if_second_number_is_smaller_than_first()
52
61
  {
53
- var elements = new BinarySearchTree(4).AsEnumerable();
54
- Assert.Equal(new [] { 4 }, elements);
62
+ var tree = new BinarySearchTree(new[] { 2, 1 });
63
+ Assert.Equal(new[] { 1, 2 }, tree.AsEnumerable());
55
64
  }
56
65
 
57
66
  [Fact(Skip = "Remove to run test")]
58
- public void Iterating_over_smaller_element()
67
+ public void Can_sort_if_second_number_is_same_as_first()
59
68
  {
60
- var elements = new BinarySearchTree(new[] { 4, 2 }).AsEnumerable();
61
- Assert.Equal(new[] { 2, 4 }, elements);
69
+ var tree = new BinarySearchTree(new[] { 2, 2 });
70
+ Assert.Equal(new[] { 2, 2 }, tree.AsEnumerable());
62
71
  }
63
72
 
64
73
  [Fact(Skip = "Remove to run test")]
65
- public void Iterating_over_larger_element()
74
+ public void Can_sort_if_second_number_is_greater_than_first()
66
75
  {
67
- var elements = new BinarySearchTree(new[] { 4, 5 }).AsEnumerable();
68
- Assert.Equal(new[] { 4, 5 }, elements);
76
+ var tree = new BinarySearchTree(new[] { 2, 3 });
77
+ Assert.Equal(new[] { 2, 3 }, tree.AsEnumerable());
69
78
  }
70
79
 
71
80
  [Fact(Skip = "Remove to run test")]
72
- public void Iterating_over_complex_element()
81
+ public void Can_sort_complex_tree()
73
82
  {
74
- var elements = new BinarySearchTree(new[] { 4, 2, 1, 3, 6, 7, 5 }).AsEnumerable();
75
- Assert.Equal(new[] { 1, 2, 3, 4, 5, 6, 7 }, elements);
83
+ var tree = new BinarySearchTree(new[] { 2, 1, 3, 6, 7, 5 });
84
+ Assert.Equal(new[] { 1, 2, 3, 5, 6, 7 }, tree.AsEnumerable());
76
85
  }
77
86
  }
@@ -0,0 +1,69 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Text;
4
+ using Generators.Output;
5
+
6
+ namespace Generators.Exercises
7
+ {
8
+ public class ExpectedDataBinaryTree
9
+ {
10
+ public ExpectedDataBinaryTree(System.Collections.Generic.Dictionary<string, object> treeNode)
11
+ {
12
+ Value = treeNode["data"] as string;
13
+ if (treeNode["left"] != null) this.Left = new ExpectedDataBinaryTree(treeNode["left"] as System.Collections.Generic.Dictionary<string, object>);
14
+ if (treeNode["right"] != null) this.Right = new ExpectedDataBinaryTree(treeNode["right"] as System.Collections.Generic.Dictionary<string, object>);
15
+ }
16
+
17
+ public int Level { get; }
18
+ public string Value { get; }
19
+ public ExpectedDataBinaryTree Left { get; private set; }
20
+ public ExpectedDataBinaryTree Right { get; private set; }
21
+
22
+ public IEnumerable<string> TestAsserts(string traverse = "")
23
+ {
24
+ yield return $"Assert.Equal({this.Value}, tree{traverse}.Value);";
25
+ if (this.Left != null) foreach (var assert in this.Left.TestAsserts(traverse + ".Left")) yield return assert;
26
+ if (this.Right != null) foreach (var assert in this.Right.TestAsserts(traverse + ".Right")) yield return assert;
27
+ }
28
+ }
29
+
30
+ public class BinarySearchTree : GeneratorExercise
31
+ {
32
+ protected override HashSet<string> AddAdditionalNamespaces() => new HashSet<string>() { typeof(System.Linq.IQueryable).Namespace };
33
+
34
+ private StringBuilder testFactCodeLines;
35
+ void addCodeLine(string line) => testFactCodeLines.Append(line + "\r\n");
36
+
37
+ protected override string RenderTestMethodBodyAssert(TestMethodBody testMethodBody)
38
+ {
39
+ testFactCodeLines = new StringBuilder();
40
+ var canonicalDataCase = testMethodBody.CanonicalDataCase;
41
+ var input = canonicalDataCase.Properties["input"] as System.Collections.Generic.Dictionary<string, object>;
42
+ var constructorData = input["treeData"] as string[];
43
+
44
+ if (constructorData.Length == 1) addCodeLine($"var tree = new BinarySearchTree({constructorData[0]});");
45
+ else
46
+ {
47
+ string constructorDataString = string.Join(", ", constructorData);
48
+ addCodeLine($"var tree = new BinarySearchTree(new[] {{ {constructorDataString} }});");
49
+ }
50
+
51
+ var expected = canonicalDataCase.Properties["expected"] as System.Collections.Generic.Dictionary<string, object>;
52
+ if (expected != null)
53
+ {
54
+ var tree = new ExpectedDataBinaryTree(expected as System.Collections.Generic.Dictionary<string, object>);
55
+ foreach (var assert in tree.TestAsserts()) addCodeLine(assert);
56
+ }
57
+ else
58
+ {
59
+ string expectedArrayString = string.Join(", ", canonicalDataCase.Properties["expected"] as string[]);
60
+ addCodeLine($"Assert.Equal(new[] {{ {expectedArrayString} }}, tree.AsEnumerable());");
61
+ }
62
+
63
+ return TemplateRenderer.RenderInline(testFactCodeLines.ToString(), testMethodBody.AssertTemplateParameters);
64
+ }
65
+
66
+ }
67
+ }
68
+
69
+
@@ -282,6 +282,7 @@
282
282
  "unlocked_by": null,
283
283
  "difficulty": 3,
284
284
  "topics": [
285
+ "Define type"
285
286
  ]
286
287
  },
287
288
  {
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Accumulate
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Acronym
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Base
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Allergies
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Alphametics
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Anagram
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Atbash
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: BankAccount
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Beer
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: BST
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Binary
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13
 
@@ -7,7 +7,7 @@ dependencies:
7
7
  library:
8
8
  exposed-modules: Bob
9
9
  source-dirs: src
10
- dependencies:
10
+ # dependencies:
11
11
  # - foo # List here the packages you
12
12
  # - bar # want to use in your solution.
13
13