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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/pov/canonical-data.json +33 -1
- data/tracks/c/exercises/acronym/test/test_acronym.c +25 -17
- data/tracks/csharp/exercises/binary-search-tree/BinarySearchTreeTest.cs +37 -28
- data/tracks/csharp/generators/Exercises/BinarySearchTree.cs +69 -0
- data/tracks/haskell/config.json +1 -0
- data/tracks/haskell/exercises/accumulate/package.yaml +1 -1
- data/tracks/haskell/exercises/acronym/package.yaml +1 -1
- data/tracks/haskell/exercises/all-your-base/package.yaml +1 -1
- data/tracks/haskell/exercises/allergies/package.yaml +1 -1
- data/tracks/haskell/exercises/alphametics/package.yaml +1 -1
- data/tracks/haskell/exercises/anagram/package.yaml +1 -1
- data/tracks/haskell/exercises/atbash-cipher/package.yaml +1 -1
- data/tracks/haskell/exercises/bank-account/package.yaml +1 -1
- data/tracks/haskell/exercises/beer-song/package.yaml +1 -1
- data/tracks/haskell/exercises/binary-search-tree/package.yaml +1 -1
- data/tracks/haskell/exercises/binary/package.yaml +1 -1
- data/tracks/haskell/exercises/bob/package.yaml +1 -1
- data/tracks/haskell/exercises/bowling/package.yaml +1 -1
- data/tracks/haskell/exercises/bracket-push/package.yaml +1 -1
- data/tracks/haskell/exercises/change/package.yaml +1 -1
- data/tracks/haskell/exercises/clock/package.yaml +1 -1
- data/tracks/haskell/exercises/collatz-conjecture/package.yaml +1 -1
- data/tracks/haskell/exercises/complex-numbers/package.yaml +1 -1
- data/tracks/haskell/exercises/connect/package.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
- data/tracks/haskell/exercises/custom-set/package.yaml +1 -1
- data/tracks/haskell/exercises/diamond/package.yaml +1 -1
- data/tracks/haskell/exercises/difference-of-squares/package.yaml +1 -1
- data/tracks/haskell/exercises/dominoes/package.yaml +1 -1
- data/tracks/haskell/exercises/etl/package.yaml +1 -1
- data/tracks/haskell/exercises/food-chain/package.yaml +1 -1
- data/tracks/haskell/exercises/forth/package.yaml +1 -1
- data/tracks/haskell/exercises/gigasecond/package.yaml +1 -1
- data/tracks/haskell/exercises/go-counting/package.yaml +1 -1
- data/tracks/haskell/exercises/grade-school/package.yaml +1 -1
- data/tracks/haskell/exercises/grains/package.yaml +1 -1
- data/tracks/haskell/exercises/hamming/package.yaml +1 -1
- data/tracks/haskell/exercises/hello-world/package.yaml +1 -1
- data/tracks/haskell/exercises/hexadecimal/package.yaml +1 -1
- data/tracks/haskell/exercises/house/package.yaml +1 -1
- data/tracks/haskell/exercises/isbn-verifier/package.yaml +1 -1
- data/tracks/haskell/exercises/isogram/package.yaml +1 -1
- data/tracks/haskell/exercises/kindergarten-garden/examples/success-standard/src/Garden.hs +1 -10
- data/tracks/haskell/exercises/kindergarten-garden/package.yaml +2 -3
- data/tracks/haskell/exercises/kindergarten-garden/src/Garden.hs +3 -7
- data/tracks/haskell/exercises/kindergarten-garden/test/Tests.hs +10 -16
- data/tracks/haskell/exercises/largest-series-product/package.yaml +1 -1
- data/tracks/haskell/exercises/leap/package.yaml +1 -1
- data/tracks/haskell/exercises/lens-person/examples/success-standard/package.yaml +0 -1
- data/tracks/haskell/exercises/lens-person/package.yaml +1 -1
- data/tracks/haskell/exercises/linked-list/package.yaml +1 -1
- data/tracks/haskell/exercises/list-ops/package.yaml +1 -1
- data/tracks/haskell/exercises/luhn/package.yaml +1 -1
- data/tracks/haskell/exercises/matrix/package.yaml +1 -1
- data/tracks/haskell/exercises/meetup/package.yaml +1 -1
- data/tracks/haskell/exercises/minesweeper/package.yaml +1 -1
- data/tracks/haskell/exercises/nth-prime/package.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/package.yaml +1 -1
- data/tracks/haskell/exercises/ocr-numbers/package.yaml +1 -1
- data/tracks/haskell/exercises/octal/package.yaml +1 -1
- data/tracks/haskell/exercises/palindrome-products/package.yaml +1 -1
- data/tracks/haskell/exercises/pangram/package.yaml +1 -1
- data/tracks/haskell/exercises/parallel-letter-frequency/package.yaml +1 -1
- data/tracks/haskell/exercises/pascals-triangle/package.yaml +1 -1
- data/tracks/haskell/exercises/perfect-numbers/package.yaml +1 -1
- data/tracks/haskell/exercises/phone-number/package.yaml +1 -1
- data/tracks/haskell/exercises/pig-latin/package.yaml +1 -1
- data/tracks/haskell/exercises/poker/package.yaml +1 -1
- data/tracks/haskell/exercises/pov/package.yaml +2 -2
- data/tracks/haskell/exercises/pov/test/Tests.hs +15 -0
- data/tracks/haskell/exercises/prime-factors/package.yaml +1 -1
- data/tracks/haskell/exercises/protein-translation/package.yaml +1 -1
- data/tracks/haskell/exercises/pythagorean-triplet/package.yaml +1 -1
- data/tracks/haskell/exercises/queen-attack/package.yaml +1 -1
- data/tracks/haskell/exercises/rail-fence-cipher/package.yaml +1 -1
- data/tracks/haskell/exercises/raindrops/package.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -1
- data/tracks/haskell/exercises/robot-name/package.yaml +1 -1
- data/tracks/haskell/exercises/robot-simulator/package.yaml +1 -1
- data/tracks/haskell/exercises/roman-numerals/package.yaml +1 -1
- data/tracks/haskell/exercises/rotational-cipher/package.yaml +1 -1
- data/tracks/haskell/exercises/run-length-encoding/package.yaml +1 -1
- data/tracks/haskell/exercises/saddle-points/package.yaml +1 -1
- data/tracks/haskell/exercises/say/package.yaml +1 -1
- data/tracks/haskell/exercises/scrabble-score/package.yaml +1 -1
- data/tracks/haskell/exercises/secret-handshake/package.yaml +1 -1
- data/tracks/haskell/exercises/series/package.yaml +1 -1
- data/tracks/haskell/exercises/sgf-parsing/package.yaml +1 -1
- data/tracks/haskell/exercises/sieve/package.yaml +1 -1
- data/tracks/haskell/exercises/simple-cipher/package.yaml +1 -1
- data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -1
- data/tracks/haskell/exercises/space-age/package.yaml +1 -1
- data/tracks/haskell/exercises/spiral-matrix/package.yaml +1 -1
- data/tracks/haskell/exercises/strain/package.yaml +1 -1
- data/tracks/haskell/exercises/sublist/package.yaml +1 -1
- data/tracks/haskell/exercises/sum-of-multiples/package.yaml +1 -1
- data/tracks/haskell/exercises/transpose/package.yaml +1 -1
- data/tracks/haskell/exercises/triangle/package.yaml +1 -1
- data/tracks/haskell/exercises/trinary/package.yaml +1 -1
- data/tracks/haskell/exercises/twelve-days/package.yaml +1 -1
- data/tracks/haskell/exercises/word-count/package.yaml +1 -1
- data/tracks/haskell/exercises/wordy/package.yaml +1 -1
- data/tracks/haskell/exercises/zebra-puzzle/package.yaml +1 -1
- data/tracks/haskell/exercises/zipper/package.yaml +1 -1
- data/tracks/java/CONTRIBUTING.md +39 -3
- data/tracks/java/POLICIES.md +68 -3
- data/tracks/java/exercises/crypto-square/README.md +4 -5
- data/tracks/java/exercises/error-handling/README.md +38 -0
- data/tracks/java/exercises/series/README.md +6 -6
- data/tracks/java/exercises/sieve/README.md +5 -3
- data/tracks/java/scripts/canonical_data_check.sh +1 -1
- data/tracks/python/exercises/react/example.py +54 -63
- data/tracks/python/exercises/react/react.py +10 -10
- data/tracks/python/exercises/react/react_test.py +197 -131
- data/tracks/python/exercises/sieve/README.md +5 -3
- data/tracks/rust/exercises/react/example.rs +103 -64
- data/tracks/rust/exercises/react/src/lib.rs +31 -17
- data/tracks/rust/exercises/react/tests/react.rs +52 -61
- data/tracks/swift/config.json +11 -0
- data/tracks/swift/exercises/circular-buffer/Sources/CircularBufferExample.swift +12 -12
- data/tracks/swift/exercises/circular-buffer/Tests/CircularBufferTests/CircularBufferTests.swift +1 -1
- data/tracks/swift/exercises/proverb/Package.swift +5 -0
- data/tracks/swift/exercises/proverb/README.md +25 -0
- data/tracks/swift/exercises/proverb/Sources/Proverb.swift +1 -0
- data/tracks/swift/exercises/proverb/Sources/ProverbExample.swift +28 -0
- data/tracks/swift/exercises/proverb/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/proverb/Tests/ProverbTests/ProverbTests.swift +61 -0
- data/tracks/typescript/config.json +14 -0
- data/tracks/typescript/exercises/palindrome-products/README.md +65 -0
- data/tracks/typescript/exercises/palindrome-products/package.json +36 -0
- data/tracks/typescript/exercises/palindrome-products/palindrome-products.example.ts +38 -0
- data/tracks/typescript/exercises/palindrome-products/palindrome-products.test.ts +69 -0
- data/tracks/typescript/exercises/palindrome-products/palindrome-products.ts +0 -0
- data/tracks/typescript/exercises/palindrome-products/tsconfig.json +22 -0
- data/tracks/typescript/exercises/palindrome-products/tslint.json +127 -0
- data/tracks/typescript/exercises/palindrome-products/yarn.lock +2624 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 699eec34e75cdaa468a3ce1c7a3886760cf01a6a
|
4
|
+
data.tar.gz: e4eba91c00477ab11723b6ab763fddc63a8d96e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f33e6a32dbb9cbde60a28160521ffe29f85855f0ccdc367576bf22167b2588dd267f38067773cec141423efe21314cb22ac6dea70e51b288df5d7ddef29d3468
|
7
|
+
data.tar.gz: a8edb8f1fac25c9f7fd9520803b22cbb6711d1741637c84fe0842e0544365610fdbc87d1d8e4a8a95eb81f0643b5a4534d057cdff14184cabf9a9f57c50635e0
|
data/lib/trackler/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"exercise": "pov",
|
3
|
-
"version": "1.
|
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
|
77
|
+
void test_empty_string(void)
|
70
78
|
{
|
71
79
|
TEST_IGNORE();
|
72
|
-
char *phrase = "
|
73
|
-
char *expected =
|
80
|
+
char *phrase = "";
|
81
|
+
char *expected = NULL;
|
74
82
|
test_abbreviation(phrase, expected);
|
75
83
|
}
|
76
84
|
|
77
|
-
void
|
85
|
+
void test_all_words_starting_with_lowercase(void)
|
78
86
|
{
|
79
87
|
TEST_IGNORE();
|
80
|
-
char *phrase = "
|
81
|
-
char *expected = "
|
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
|
-
|
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
|
16
|
+
public void Can_create_complex_tree()
|
15
17
|
{
|
16
|
-
var tree = new BinarySearchTree(4
|
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
|
29
|
+
public void Smaller_number_at_left_node()
|
23
30
|
{
|
24
|
-
var tree = new BinarySearchTree(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
|
45
|
+
public void Greater_number_at_right_node()
|
31
46
|
{
|
32
|
-
var tree = new BinarySearchTree(4
|
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
|
53
|
+
public void Can_sort_single_number()
|
39
54
|
{
|
40
|
-
var tree = new BinarySearchTree(
|
41
|
-
Assert.Equal(
|
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
|
60
|
+
public void Can_sort_if_second_number_is_smaller_than_first()
|
52
61
|
{
|
53
|
-
var
|
54
|
-
Assert.Equal(new
|
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
|
67
|
+
public void Can_sort_if_second_number_is_same_as_first()
|
59
68
|
{
|
60
|
-
var
|
61
|
-
Assert.Equal(new[] { 2,
|
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
|
74
|
+
public void Can_sort_if_second_number_is_greater_than_first()
|
66
75
|
{
|
67
|
-
var
|
68
|
-
Assert.Equal(new[] {
|
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
|
81
|
+
public void Can_sort_complex_tree()
|
73
82
|
{
|
74
|
-
var
|
75
|
-
Assert.Equal(new[] { 1, 2, 3,
|
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
|
+
|
data/tracks/haskell/config.json
CHANGED