trackler 2.2.1.155 → 2.2.1.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/lib/trackler/version.rb +1 -1
  4. data/problem-specifications/exercises/simple-cipher/canonical-data.json +147 -0
  5. data/tracks/clojure/exercises/hexadecimal/src/hexadecimal.clj +5 -0
  6. data/tracks/clojure/exercises/isogram/src/isogram.clj +5 -0
  7. data/tracks/clojure/exercises/kindergarten-garden/src/kindergarten-garden.clj +5 -0
  8. data/tracks/csharp/exercises/list-ops/Example.cs +14 -9
  9. data/tracks/csharp/exercises/list-ops/ListOps.cs +4 -4
  10. data/tracks/csharp/exercises/list-ops/ListOpsTest.cs +90 -88
  11. data/tracks/csharp/exercises/zipper/Example.cs +51 -43
  12. data/tracks/csharp/exercises/zipper/Zipper.cs +16 -19
  13. data/tracks/csharp/exercises/zipper/ZipperTest.cs +94 -45
  14. data/tracks/csharp/generators/Exercises/ListOps.cs +123 -0
  15. data/tracks/csharp/generators/Exercises/Zipper.cs +107 -0
  16. data/tracks/csharp/generators/Output/ValueFormatter.cs +14 -0
  17. data/tracks/delphi/config.json +10 -1
  18. data/tracks/delphi/config/maintainers.json +11 -11
  19. data/tracks/elisp/config.json +8 -0
  20. data/tracks/elisp/exercises/run-length-encoding/README.md +36 -0
  21. data/tracks/elisp/exercises/run-length-encoding/example.el +62 -0
  22. data/tracks/elisp/exercises/run-length-encoding/run-length-encoding-test.el +61 -0
  23. data/tracks/elisp/exercises/run-length-encoding/run-length-encoding.el +9 -0
  24. data/tracks/fsharp/docs/LEARNING.md +3 -0
  25. data/tracks/java/exercises/armstrong-numbers/.meta/hints.md +2 -0
  26. data/tracks/java/exercises/armstrong-numbers/README.md +6 -0
  27. data/tracks/java/exercises/bracket-push/.meta/version +1 -1
  28. data/tracks/java/exercises/bracket-push/src/test/java/BracketCheckerTest.java +7 -0
  29. data/tracks/java/exercises/isbn-verifier/.meta/version +1 -1
  30. data/tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java +12 -1
  31. data/tracks/java/exercises/kindergarten-garden/.meta/version +1 -1
  32. data/tracks/java/exercises/list-ops/.meta/version +1 -1
  33. data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +32 -1
  34. data/tracks/nim/config.json +13 -2
  35. data/tracks/nim/exercises/bob/bob_test.nim +1 -1
  36. data/tracks/nim/exercises/bob/example.nim +6 -3
  37. data/tracks/nim/exercises/bracket-push/README.md +11 -0
  38. data/tracks/nim/exercises/bracket-push/bracket_push_test.nim +52 -0
  39. data/tracks/nim/exercises/bracket-push/example.nim +22 -0
  40. data/tracks/ocaml/exercises/bracket-push/test.ml +3 -1
  41. data/tracks/ocaml/exercises/luhn/example.ml +8 -5
  42. data/tracks/ocaml/exercises/luhn/test.ml +3 -1
  43. data/tracks/powershell/.gitignore +2 -1
  44. data/tracks/powershell/config.json +46 -13
  45. data/tracks/powershell/exercises/bob/.version +1 -0
  46. data/tracks/powershell/exercises/bob/BobResponse.example.ps1 +28 -0
  47. data/tracks/powershell/exercises/bob/BobResponse.ps1 +8 -0
  48. data/tracks/powershell/exercises/bob/BobResponse.tests.ps1 +109 -0
  49. data/tracks/powershell/exercises/bob/README.md +20 -0
  50. data/tracks/powershell/exercises/nucleotide-count/.version +1 -0
  51. data/tracks/powershell/exercises/nucleotide-count/NucleotideCount.example.ps1 +36 -0
  52. data/tracks/powershell/exercises/nucleotide-count/NucleotideCount.ps1 +8 -0
  53. data/tracks/powershell/exercises/nucleotide-count/NucleotideCount.tests.ps1 +25 -0
  54. data/tracks/powershell/exercises/nucleotide-count/README.md +19 -0
  55. data/tracks/powershell/exercises/raindrops/.version +1 -0
  56. data/tracks/powershell/exercises/raindrops/README.md +24 -0
  57. data/tracks/powershell/exercises/raindrops/Raindrops.example.ps1 +32 -0
  58. data/tracks/powershell/exercises/raindrops/Raindrops.ps1 +8 -0
  59. data/tracks/powershell/exercises/raindrops/Raindrops.tests.ps1 +34 -0
  60. data/tracks/prolog/exercises/complex-numbers/complex_numbers_tests.plt +28 -29
  61. data/tracks/reasonml/.gitignore +4 -0
  62. data/tracks/reasonml/.travis.yml +5 -0
  63. data/tracks/reasonml/LICENSE +21 -0
  64. data/tracks/reasonml/README.md +67 -0
  65. data/tracks/reasonml/bin/fetch-configlet +32 -0
  66. data/tracks/reasonml/config.json +11 -0
  67. data/tracks/reasonml/config/exercise-readme-insert.md +0 -0
  68. data/tracks/reasonml/config/exercise_readme.go.tmpl +16 -0
  69. data/tracks/reasonml/config/maintainers.json +4 -0
  70. data/tracks/reasonml/docs/ABOUT.md +0 -0
  71. data/tracks/reasonml/docs/INSTALLATION.md +0 -0
  72. data/tracks/reasonml/docs/LEARNING.md +0 -0
  73. data/tracks/reasonml/docs/RESOURCES.md +0 -0
  74. data/tracks/reasonml/docs/TESTS.md +0 -0
  75. data/tracks/reasonml/img/.keep +0 -0
  76. data/tracks/scala/config.json +11 -0
  77. data/tracks/scala/exercises/armstrong-numbers/README.md +29 -0
  78. data/tracks/scala/exercises/armstrong-numbers/build.sbt +3 -0
  79. data/tracks/scala/exercises/armstrong-numbers/example.scala +7 -0
  80. data/tracks/scala/exercises/armstrong-numbers/src/main/scala/.keep +0 -0
  81. data/tracks/scala/exercises/armstrong-numbers/src/test/scala/ArmstrongNumbersTest.scala +44 -0
  82. data/tracks/scala/testgen/src/main/scala/ArmstrongNumbersTestGenerator.scala +33 -0
  83. data/tracks/scheme/config.json +8 -0
  84. data/tracks/scheme/exercises/atbash-cipher/README.md +36 -0
  85. data/tracks/scheme/exercises/atbash-cipher/atbash-cipher-test.scm +67 -0
  86. data/tracks/scheme/exercises/atbash-cipher/atbash-cipher.scm +8 -0
  87. data/tracks/scheme/exercises/atbash-cipher/example.scm +40 -0
  88. metadata +57 -3
  89. data/tracks/python/exercises/rna-transcription/.meta/hints.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13a1a8a03a329b636cf83ebd78d896e2756b1281
4
- data.tar.gz: 9a361980610d8be7d89a029ac726db23790694ee
3
+ metadata.gz: 9be9297151cb81a1a1f348f7fecda5fb043f0cba
4
+ data.tar.gz: b71394646b1a1ff43954c04fa98f94843b04f7bb
5
5
  SHA512:
6
- metadata.gz: '058d36c01fb55f20184bc1b494f35965b889a662ba630be8e3cea926ec1a730c43359c1d7a66c67f7b8f9d87f49d48bc2f23b0f3494acbf41da8e3d97619efd0'
7
- data.tar.gz: e2b61bc234a7c607d8f4336fdfb2754035a07e1f0f8c3735940a11d1876734d0a2fea984108d6e618a01f45cd4298b88aa9e934ff5c2aab493d5e30e0e722cfa
6
+ metadata.gz: 62f2aa2dee62bac25a506f182562ef2615953f20ac0c333d666909d773a10da3ab2c00a2dd6458e872d2d457fb699eb612ba95ee25ae2fe59c879e0f8862d5ed
7
+ data.tar.gz: 322eeb246ff474e163fedcdcb1d9903ac974a62a7cacbb6d97b440af044d3c845167aa4fefbd240fc3b90c57f5676fe4a2419524d6b210843487b3bbf05d52c7
@@ -175,3 +175,6 @@
175
175
  [submodule "tracks/cfml"]
176
176
  path = tracks/cfml
177
177
  url = https://github.com/exercism/cfml
178
+ [submodule "tracks/reasonml"]
179
+ path = tracks/reasonml
180
+ url = https://github.com/exercism/reasonml
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.155"
2
+ VERSION = "2.2.1.156"
3
3
  end
@@ -0,0 +1,147 @@
1
+ {
2
+ "exercise": "simple-cipher",
3
+ "version": "1.0.0",
4
+ "comments":
5
+ ["Some of the strings used in this file are symbolic and do not represent their literal value. They are:",
6
+ "cipher.key - Represents the Cipher key",
7
+ "cipher.encode - Represents the output of the Cipher encode method",
8
+ "new - Represents the Cipher initialization"],
9
+ "cases": [
10
+ {
11
+ "description": "Random key cipher",
12
+ "cases": [
13
+ {
14
+ "description": "Can encode",
15
+ "property": "encode",
16
+ "input": {
17
+ "plaintext": "aaaaaaaaaa"
18
+ },
19
+ "expected": "cipher.key"
20
+ },
21
+ {
22
+ "description": "Can decode",
23
+ "property": "decode",
24
+ "input": {
25
+ "ciphertext": "cipher.key"
26
+ },
27
+ "expected": "aaaaaaaaaa"
28
+ },
29
+ {
30
+ "description": "Is reversible. I.e., if you apply decode in a encoded result, you must see the same plaintext encode parameter as a result of the decode method",
31
+ "property": "decode",
32
+ "input": {
33
+ "plaintext": "abcdefghij",
34
+ "ciphertext": "cipher.encode"
35
+ },
36
+ "expected": "abcdefghij"
37
+ },
38
+ {
39
+ "description": "Key is made only of lowercase letters",
40
+ "property": "key",
41
+ "input": {},
42
+ "expected": {
43
+ "match": "^[a-z]+$"
44
+ }
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "description": "Substitution cipher",
50
+ "cases": [
51
+ {
52
+ "description": "Can encode",
53
+ "property": "encode",
54
+ "input": {
55
+ "key": "abcdefghij",
56
+ "plaintext": "aaaaaaaaaa"
57
+ },
58
+ "expected": "abcdefghij"
59
+ },
60
+ {
61
+ "description": "Can decode",
62
+ "property": "decode",
63
+ "input": {
64
+ "key": "abcdefghij",
65
+ "ciphertext": "abcdefghij"
66
+ },
67
+ "expected": "aaaaaaaaaa"
68
+ },
69
+ {
70
+ "description": "Is reversible. I.e., if you apply decode in a encoded result, you must see the same plaintext encode parameter as a result of the decode method",
71
+ "property": "decode",
72
+ "input": {
73
+ "key": "abcdefghij",
74
+ "plaintext": "abcdefghij",
75
+ "ciphertext": "cipher.encode"
76
+ },
77
+ "expected": "abcdefghij"
78
+ },
79
+ {
80
+ "description": "Can double shift encode",
81
+ "property": "encode",
82
+ "input": {
83
+ "key": "iamapandabear",
84
+ "plaintext": "iamapandabear"
85
+ },
86
+ "expected": "qayaeaagaciai"
87
+ },
88
+ {
89
+ "description": "Can wrap on encode",
90
+ "property": "encode",
91
+ "input": {
92
+ "key": "abcdefghij",
93
+ "plaintext": "zzzzzzzzzz"
94
+ },
95
+ "expected": "zabcdefghi"
96
+ },
97
+ {
98
+ "description": "Can wrap on decode",
99
+ "property": "decode",
100
+ "input": {
101
+ "key": "abcdefghij",
102
+ "ciphertext": "zabcdefghi"
103
+ },
104
+ "expected": "zzzzzzzzzz"
105
+ },
106
+ {
107
+ "description": "Can handle messages longer than the key",
108
+ "property": "encode",
109
+ "input": {
110
+ "key": "abc",
111
+ "plaintext": "iamapandabear"
112
+ },
113
+ "expected": "iboaqcnecbfcr"
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "description": "Incorrect key cipher",
119
+ "cases": [
120
+ {
121
+ "description": "Throws an error with an all uppercase key",
122
+ "property": "new",
123
+ "input": {
124
+ "key": "ABCDEF"
125
+ },
126
+ "expected": { "error": "Bad key" }
127
+ },
128
+ {
129
+ "description": "Throws an error with a numeric key",
130
+ "property": "new",
131
+ "input": {
132
+ "key": "12345"
133
+ },
134
+ "expected": { "error": "Bad key" }
135
+ },
136
+ {
137
+ "description": "Throws an error with empty key",
138
+ "property": "new",
139
+ "input": {
140
+ "key": ""
141
+ },
142
+ "expected": { "error": "Bad key" }
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ }
@@ -0,0 +1,5 @@
1
+ (ns hexadecimal)
2
+
3
+ (defn hex-to-int [] ;; <- arglist goes here
4
+ ;; your code goes here
5
+ )
@@ -0,0 +1,5 @@
1
+ (ns isogram)
2
+
3
+ (defn isogram? [] ;; <- arglist goes here
4
+ ;; your code goes here
5
+ )
@@ -0,0 +1,5 @@
1
+ (ns kindergarten-garden)
2
+
3
+ (defn garden [] ;; <- arglist goes here
4
+ ;; your code goes here
5
+ )
@@ -1,4 +1,5 @@
1
1
  using System;
2
+ using System.Collections;
2
3
  using System.Collections.Generic;
3
4
  using System.Linq;
4
5
 
@@ -14,25 +15,25 @@ private static List<T> Cons<T>(T x, List<T> input)
14
15
 
15
16
  public static int Length<T>(List<T> input)
16
17
  {
17
- return Foldl((acc, x) => acc + 1, 0, input);
18
+ return Foldl(input, 0, (acc, x) => acc + 1);
18
19
  }
19
20
 
20
21
  public static List<T> Reverse<T>(List<T> input)
21
22
  {
22
- return Foldl((acc, x) => Cons(x, acc), new List<T>(), input);
23
+ return Foldl(input, new List<T>(), (acc, x) => Cons(x, acc));
23
24
  }
24
25
 
25
- public static List<TOut> Map<TIn, TOut>(Func<TIn, TOut> map, List<TIn> input)
26
+ public static List<TOut> Map<TIn, TOut>(List<TIn> input, Func<TIn, TOut> map)
26
27
  {
27
- return Foldr((x, acc) => Cons(map(x), acc), new List<TOut>(), input);
28
+ return Foldr(input, new List<TOut>(), (x, acc) => Cons(map(x), acc));
28
29
  }
29
30
 
30
- public static List<T> Filter<T>(Func<T, bool> predicate, List<T> input)
31
+ public static List<T> Filter<T>(List<T> input, Func<T, bool> predicate)
31
32
  {
32
- return Foldr((x, acc) => predicate(x) ? Cons(x, acc) : acc, new List<T>(), input);
33
+ return Foldr(input, new List<T>(), (x, acc) => predicate(x) ? Cons(x, acc) : acc);
33
34
  }
34
35
 
35
- public static TOut Foldl<TIn, TOut>(Func<TOut, TIn, TOut> func, TOut start, List<TIn> input)
36
+ public static TOut Foldl<TIn, TOut>(List<TIn> input, TOut start, Func<TOut, TIn, TOut> func)
36
37
  {
37
38
  var acc = start;
38
39
 
@@ -42,7 +43,7 @@ public static List<T> Filter<T>(Func<T, bool> predicate, List<T> input)
42
43
  return acc;
43
44
  }
44
45
 
45
- public static TOut Foldr<TIn, TOut>(Func<TIn, TOut, TOut> func, TOut start, List<TIn> input)
46
+ public static TOut Foldr<TIn, TOut>(List<TIn> input, TOut start, Func<TIn, TOut, TOut> func)
46
47
  {
47
48
  var acc = start;
48
49
 
@@ -57,7 +58,11 @@ public static List<T> Concat<T>(List<List<T>> input)
57
58
  var concatenated = new List<T>();
58
59
 
59
60
  foreach (var list in input)
60
- concatenated = Append(concatenated, list);
61
+ {
62
+ if (list is List<T> sublist)
63
+ concatenated = Append(concatenated, sublist);
64
+ }
65
+
61
66
 
62
67
  return concatenated;
63
68
  }
@@ -14,22 +14,22 @@ public static List<T> Reverse<T>(List<T> input)
14
14
  throw new NotImplementedException("You need to implement this function.");
15
15
  }
16
16
 
17
- public static List<TOut> Map<TIn, TOut>(Func<TIn, TOut> map, List<TIn> input)
17
+ public static List<TOut> Map<TIn, TOut>(List<TIn> input, Func<TIn, TOut> map)
18
18
  {
19
19
  throw new NotImplementedException("You need to implement this function.");
20
20
  }
21
21
 
22
- public static List<T> Filter<T>(Func<T, bool> predicate, List<T> input)
22
+ public static List<T> Filter<T>(List<T> input, Func<T, bool> predicate)
23
23
  {
24
24
  throw new NotImplementedException("You need to implement this function.");
25
25
  }
26
26
 
27
- public static TOut Foldl<TIn, TOut>(Func<TOut, TIn, TOut> func, TOut start, List<TIn> input)
27
+ public static TOut Foldl<TIn, TOut>(List<TIn> input, TOut start, Func<TOut, TIn, TOut> func)
28
28
  {
29
29
  throw new NotImplementedException("You need to implement this function.");
30
30
  }
31
31
 
32
- public static TOut Foldr<TIn, TOut>(Func<TIn, TOut, TOut> func, TOut start, List<TIn> input)
32
+ public static TOut Foldr<TIn, TOut>(List<TIn> input, TOut start, Func<TIn, TOut, TOut> func)
33
33
  {
34
34
  throw new NotImplementedException("You need to implement this function.");
35
35
  }
@@ -1,172 +1,174 @@
1
- using System.Collections.Generic;
2
- using System.Linq;
1
+ // This file was auto-generated based on version 2.3.0 of the canonical data.
2
+
3
3
  using Xunit;
4
+ using System;
5
+ using System.Collections.Generic;
4
6
 
5
7
  public class ListOpsTest
6
8
  {
7
- private const int Big = 10000;
8
- private static readonly List<int> BigList = Range(1, Big);
9
- private static readonly List<int> EmptyList = new List<int>();
10
-
11
- private static List<int> Range(int from, int until) => new List<int>(Enumerable.Range(from, (until - from) + 1));
12
- private static bool Odd(int x) => x % 2 == 1;
13
-
14
- private static List<T> Cons<T>(T x, List<T> input)
15
- {
16
- var list = new List<T>(input);
17
- list.Insert(0, x);
18
-
19
- return list;
20
- }
21
-
22
9
  [Fact]
23
- public void LengthOfEmptyList()
24
- {
25
- Assert.Equal(0, ListOps.Length(EmptyList));
26
- }
27
-
28
- [Fact(Skip = "Remove to run test")]
29
- public void LengthOfNonEmptyList()
30
- {
31
- Assert.Equal(4, ListOps.Length(Range(1, 4)));
32
- }
33
-
34
- [Fact(Skip = "Remove to run test")]
35
- public void LengthOfLargeList()
36
- {
37
- Assert.Equal(Big, ListOps.Length(Range(1, Big)));
38
- }
39
-
40
- [Fact(Skip = "Remove to run test")]
41
- public void ReverseOfEmptylist()
42
- {
43
- Assert.Equal(EmptyList, ListOps.Reverse(EmptyList));
44
- }
45
-
46
- [Fact(Skip = "Remove to run test")]
47
- public void ReverseOfNonEmptyList()
10
+ public void Append_entries_to_a_list_and_return_the_new_list_empty_lists()
48
11
  {
49
- Assert.Equal(Range(1, 100).OrderByDescending(x => x).ToList(), ListOps.Reverse(Range(1, 100)));
12
+ var list1 = new List<int>();
13
+ var list2 = new List<int>();
14
+ Assert.Empty(ListOps.Append(list1, list2));
50
15
  }
51
16
 
52
17
  [Fact(Skip = "Remove to run test")]
53
- public void MapOfEmptylist()
18
+ public void Append_entries_to_a_list_and_return_the_new_list_empty_list_to_list()
54
19
  {
55
- Assert.Equal(EmptyList, ListOps.Map(x => x + 1, EmptyList));
20
+ var list1 = new List<int>();
21
+ var list2 = new List<int> { 1, 2, 3, 4 };
22
+ var expected = new List<int> { 1, 2, 3, 4 };
23
+ Assert.Equal(expected, ListOps.Append(list1, list2));
56
24
  }
57
25
 
58
26
  [Fact(Skip = "Remove to run test")]
59
- public void MapOfNonEmptyList()
27
+ public void Append_entries_to_a_list_and_return_the_new_list_non_empty_lists()
60
28
  {
61
- Assert.Equal(new List<int> {2, 4, 6, 8}, ListOps.Map(x => x + 1, new List<int> {1, 3, 5, 7}));
29
+ var list1 = new List<int> { 1, 2 };
30
+ var list2 = new List<int> { 2, 3, 4, 5 };
31
+ var expected = new List<int> { 1, 2, 2, 3, 4, 5 };
32
+ Assert.Equal(expected, ListOps.Append(list1, list2));
62
33
  }
63
34
 
64
35
  [Fact(Skip = "Remove to run test")]
65
- public void FilterOfEmptylist()
36
+ public void Concatenate_a_list_of_lists_empty_list()
66
37
  {
67
- Assert.Equal(EmptyList, ListOps.Filter(x => true, EmptyList));
38
+ var lists = new List<List<int>>();
39
+ Assert.Empty(ListOps.Concat(lists));
68
40
  }
69
41
 
70
42
  [Fact(Skip = "Remove to run test")]
71
- public void FilterOfNormalList()
43
+ public void Concatenate_a_list_of_lists_list_of_lists()
72
44
  {
73
- Assert.Equal(new List<int> {1, 3}, ListOps.Filter(Odd, Range(1, 4)));
45
+ var lists = new List<List<int>> { new List<int> { 1, 2 }, new List<int> { 3 }, new List<int>(), new List<int> { 4, 5, 6 } };
46
+ var expected = new List<int> { 1, 2, 3, 4, 5, 6 };
47
+ Assert.Equal(expected, ListOps.Concat(lists));
74
48
  }
75
49
 
76
50
  [Fact(Skip = "Remove to run test")]
77
- public void FoldlOfEmptylist()
51
+ public void Concatenate_a_list_of_lists_list_of_nested_lists()
78
52
  {
79
- Assert.Equal(0, ListOps.Foldl((acc, x) => acc + x, 0, EmptyList));
53
+ var lists = new List<List<List<int>>> { new List<List<int>> { new List<int> { 1 }, new List<int> { 2 } }, new List<List<int>> { new List<int> { 3 } }, new List<List<int>> { new List<int>() }, new List<List<int>> { new List<int> { 4, 5, 6 } } };
54
+ var expected = new List<List<int>> { new List<int> { 1 }, new List<int> { 2 }, new List<int> { 3 }, new List<int>(), new List<int> { 4, 5, 6 } };
55
+ Assert.Equal(expected, ListOps.Concat(lists));
80
56
  }
81
57
 
82
58
  [Fact(Skip = "Remove to run test")]
83
- public void FoldlOfNonEmptyList()
59
+ public void Filter_list_returning_only_values_that_satisfy_the_filter_function_empty_list()
84
60
  {
85
- Assert.Equal(7, ListOps.Foldl((acc, x) => acc + x, -3, Range(1, 4)));
61
+ var list = new List<int>();
62
+ var function = new Func<int, bool>((x) => x % 2 == 1);
63
+ Assert.Empty(ListOps.Filter(list, function));
86
64
  }
87
65
 
88
66
  [Fact(Skip = "Remove to run test")]
89
- public void FoldlOfHugeList()
67
+ public void Filter_list_returning_only_values_that_satisfy_the_filter_function_non_empty_list()
90
68
  {
91
- Assert.Equal(Big * (Big + 1L) / 2L, ListOps.Foldl((acc, x) => acc + x, 0L, Range(1, Big)));
69
+ var list = new List<int> { 1, 2, 3, 5 };
70
+ var function = new Func<int, bool>((x) => x % 2 == 1);
71
+ var expected = new List<int> { 1, 3, 5 };
72
+ Assert.Equal(expected, ListOps.Filter(list, function));
92
73
  }
93
74
 
94
75
  [Fact(Skip = "Remove to run test")]
95
- public void FoldlWithNonCommutativeFunction()
76
+ public void Returns_the_length_of_a_list_empty_list()
96
77
  {
97
- Assert.Equal(0, ListOps.Foldl((acc, x) => acc - x, 10, Range(1, 4)));
78
+ var list = new List<int>();
79
+ Assert.Equal(0, ListOps.Length(list));
98
80
  }
99
81
 
100
82
  [Fact(Skip = "Remove to run test")]
101
- public void FoldlIsNotJustFoldrFlip()
83
+ public void Returns_the_length_of_a_list_non_empty_list()
102
84
  {
103
- Assert.Equal("fdsa", new string(ListOps.Foldl((acc, x) => Cons(x, acc), new List<char>(), "asdf".ToList()).ToArray()));
85
+ var list = new List<int> { 1, 2, 3, 4 };
86
+ Assert.Equal(4, ListOps.Length(list));
104
87
  }
105
88
 
106
89
  [Fact(Skip = "Remove to run test")]
107
- public void FoldrAsId()
90
+ public void Return_a_list_of_elements_whose_values_equal_the_list_value_transformed_by_the_mapping_function_empty_list()
108
91
  {
109
- Assert.Equal(BigList, ListOps.Foldr((x, acc) => Cons(x, acc), EmptyList, Range(1, Big)));
92
+ var list = new List<int>();
93
+ var function = new Func<int, int>((x) => x + 1);
94
+ Assert.Empty(ListOps.Map(list, function));
110
95
  }
111
96
 
112
97
  [Fact(Skip = "Remove to run test")]
113
- public void FoldrAsAppend()
98
+ public void Return_a_list_of_elements_whose_values_equal_the_list_value_transformed_by_the_mapping_function_non_empty_list()
114
99
  {
115
- Assert.Equal(BigList, ListOps.Foldr((x, acc) => Cons(x, acc), Range(100, Big), Range(1, 99)));
100
+ var list = new List<int> { 1, 3, 5, 7 };
101
+ var function = new Func<int, int>((x) => x + 1);
102
+ var expected = new List<int> { 2, 4, 6, 8 };
103
+ Assert.Equal(expected, ListOps.Map(list, function));
116
104
  }
117
105
 
118
106
  [Fact(Skip = "Remove to run test")]
119
- public void AppendOfEmptylists()
107
+ public void Folds_reduces_the_given_list_from_the_left_with_a_function_empty_list()
120
108
  {
121
- Assert.Equal(EmptyList, ListOps.Append(EmptyList, EmptyList));
109
+ var list = new List<int>();
110
+ var initial = 2;
111
+ var function = new Func<int, int, int>((x, y) => x * y);
112
+ Assert.Equal(2, ListOps.Foldl(list, initial, function));
122
113
  }
123
114
 
124
115
  [Fact(Skip = "Remove to run test")]
125
- public void AppendOfEmptyAndNonEmptyLists()
116
+ public void Folds_reduces_the_given_list_from_the_left_with_a_function_direction_independent_function_applied_to_non_empty_list()
126
117
  {
127
- Assert.Equal(Range(1, 4), ListOps.Append(EmptyList, Range(1, 4)));
118
+ var list = new List<int> { 1, 2, 3, 4 };
119
+ var initial = 5;
120
+ var function = new Func<int, int, int>((x, y) => x + y);
121
+ Assert.Equal(15, ListOps.Foldl(list, initial, function));
128
122
  }
129
123
 
130
124
  [Fact(Skip = "Remove to run test")]
131
- public void AppendOfNonEmptyAndEmptyLists()
125
+ public void Folds_reduces_the_given_list_from_the_left_with_a_function_direction_dependent_function_applied_to_non_empty_list()
132
126
  {
133
- Assert.Equal(Range(1, 4), ListOps.Append(Range(1, 4), EmptyList));
127
+ var list = new List<int> { 2, 5 };
128
+ var initial = 5;
129
+ var function = new Func<int, int, int>((x, y) => x / y);
130
+ Assert.Equal(0, ListOps.Foldl(list, initial, function));
134
131
  }
135
132
 
136
133
  [Fact(Skip = "Remove to run test")]
137
- public void AppendOfNonEmptylists()
134
+ public void Folds_reduces_the_given_list_from_the_right_with_a_function_empty_list()
138
135
  {
139
- Assert.Equal(Range(1, 5), ListOps.Append(Range(1, 3), new List<int> {4, 5}));
136
+ var list = new List<int>();
137
+ var initial = 2;
138
+ var function = new Func<int, int, int>((x, y) => x * y);
139
+ Assert.Equal(2, ListOps.Foldr(list, initial, function));
140
140
  }
141
141
 
142
142
  [Fact(Skip = "Remove to run test")]
143
- public void AppendOfLargeLists()
143
+ public void Folds_reduces_the_given_list_from_the_right_with_a_function_direction_independent_function_applied_to_non_empty_list()
144
144
  {
145
- Assert.Equal(BigList, ListOps.Append(Range(1, Big / 2), Range(1 + Big / 2, Big)));
145
+ var list = new List<int> { 1, 2, 3, 4 };
146
+ var initial = 5;
147
+ var function = new Func<int, int, int>((x, y) => x + y);
148
+ Assert.Equal(15, ListOps.Foldr(list, initial, function));
146
149
  }
147
150
 
148
151
  [Fact(Skip = "Remove to run test")]
149
- public void ConcatOfNoLists()
152
+ public void Folds_reduces_the_given_list_from_the_right_with_a_function_direction_dependent_function_applied_to_non_empty_list()
150
153
  {
151
- Assert.Equal(EmptyList, ListOps.Concat(new List<List<int>>()));
154
+ var list = new List<int> { 2, 5 };
155
+ var initial = 5;
156
+ var function = new Func<int, int, int>((x, y) => x / y);
157
+ Assert.Equal(2, ListOps.Foldr(list, initial, function));
152
158
  }
153
159
 
154
160
  [Fact(Skip = "Remove to run test")]
155
- public void ConcatOfListOfLists()
161
+ public void Reverse_the_elements_of_the_list_empty_list()
156
162
  {
157
- Assert.Equal(Range(1, 6),
158
- ListOps.Concat(new List<List<int>>
159
- {
160
- new List<int> {1, 2},
161
- new List<int> {3},
162
- EmptyList,
163
- new List<int> {4, 5, 6}
164
- }));
163
+ var list = new List<int>();
164
+ Assert.Empty(ListOps.Reverse(list));
165
165
  }
166
166
 
167
167
  [Fact(Skip = "Remove to run test")]
168
- public void ConcatOfLargeListOfSmallLists()
168
+ public void Reverse_the_elements_of_the_list_non_empty_list()
169
169
  {
170
- Assert.Equal(BigList, ListOps.Concat(ListOps.Map(x => new List<int> {x}, Range(1, Big))));
170
+ var list = new List<int> { 1, 3, 5, 7 };
171
+ var expected = new List<int> { 7, 5, 3, 1 };
172
+ Assert.Equal(expected, ListOps.Reverse(list));
171
173
  }
172
174
  }