trackler 2.0.6.36 → 2.0.6.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b98826af252625c0ee25312e8d6e7d0559d62ce
4
- data.tar.gz: 1033d0f0d124ed5a5b5be7be0f905294a10fafe9
3
+ metadata.gz: 0851a1075b06ef0bcf3a59ba9ffa6072f1df8b44
4
+ data.tar.gz: f890063e05af38c4a48d0d0fd1d9c8e2632418d3
5
5
  SHA512:
6
- metadata.gz: 1cc546d150c52d181ebd3a13e20fcbe0ed2b01c9477d21f43fbd0686af787feead08794076a42f63cb3fb4dcffc8cc0075f83a71a577d64234c3667f7324629d
7
- data.tar.gz: 97481fdacba33c88b1910c287ee081abe040e546aa1bf3dee676b8449f9d1e5345ad057c89eba5428ccfd04c923d8a2e9ea35e41cde95cba7b7ce82bf14f7f9b
6
+ metadata.gz: e6462d9ecac9f0af0664b798ee4dc9b65f0da97eeac0d8cf4a64e854a381909931cd150dd7605d1b80091ef249656e05598e32eed9f45bfdad7ac80d8bf90717
7
+ data.tar.gz: bf00c473405dfb45099e1d259a1687cd93f0f9d01eb473e62d292ef8bb2c3068a3a744a92bedb759d42ae21db2822632ad4b5053bccdf6de72828f8aa3b842a2
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.6.36"
2
+ VERSION = "2.0.6.37"
3
3
  end
@@ -4,15 +4,73 @@ open NUnit.Framework
4
4
 
5
5
  open Isogram
6
6
 
7
- [<TestCase("duplicates", ExpectedResult = true)>]
8
- [<TestCase("eleven", ExpectedResult = false, Ignore = "Remove to run test case")>]
9
- [<TestCase("subdermatoglyphic", ExpectedResult = true, Ignore = "Remove to run test case")>]
10
- [<TestCase("Alphabet", ExpectedResult = false, Ignore = "Remove to run test case")>]
11
- [<TestCase("thumbscrew-japingly", ExpectedResult = true, Ignore = "Remove to run test case")>]
12
- [<TestCase("Hjelmqvist-Gryb-Zock-Pfund-Wax", ExpectedResult = true, Ignore = "Remove to run test case")>]
13
- [<TestCase("Heizölrückstoßabdämpfung", ExpectedResult = true, Ignore = "Remove to run test case")>]
14
- [<TestCase("the quick brown fox", ExpectedResult = false, Ignore = "Remove to run test case")>]
15
- [<TestCase("Emily Jung Schwartzkopf", ExpectedResult = true, Ignore = "Remove to run test case")>]
16
- [<TestCase("éléphant", ExpectedResult = false, Ignore = "Remove to run test case")>]
17
- let ``Isogram correctly detects isograms`` (actual: string) =
18
- isogram actual
7
+ [<Test>]
8
+ let ``Empty string`` () =
9
+ let input = ""
10
+ let expected = true
11
+ let actual = isogram input
12
+ Assert.That(actual, Is.EqualTo(expected))
13
+
14
+ [<Test>]
15
+ [<Ignore("Remove to run test")>]
16
+ let ``Isogram with only lower case characters`` () =
17
+ let input = "isogram"
18
+ let expected = true
19
+ let actual = isogram input
20
+ Assert.That(actual, Is.EqualTo(expected))
21
+
22
+ [<Test>]
23
+ [<Ignore("Remove to run test")>]
24
+ let ``Word with one duplicated character`` () =
25
+ let input = "eleven"
26
+ let expected = false
27
+ let actual = isogram input
28
+ Assert.That(actual, Is.EqualTo(expected))
29
+
30
+ [<Test>]
31
+ [<Ignore("Remove to run test")>]
32
+ let ``Longest reported english isogram`` () =
33
+ let input = "subdermatoglyphic"
34
+ let expected = true
35
+ let actual = isogram input
36
+ Assert.That(actual, Is.EqualTo(expected))
37
+
38
+ [<Test>]
39
+ [<Ignore("Remove to run test")>]
40
+ let ``Word with duplicated character in mixed case`` () =
41
+ let input = "Alphabet"
42
+ let expected = false
43
+ let actual = isogram input
44
+ Assert.That(actual, Is.EqualTo(expected))
45
+
46
+ [<Test>]
47
+ [<Ignore("Remove to run test")>]
48
+ let ``Hypothetical isogrammic word with hyphen`` () =
49
+ let input = "thumbscrew-japingly"
50
+ let expected = true
51
+ let actual = isogram input
52
+ Assert.That(actual, Is.EqualTo(expected))
53
+
54
+ [<Test>]
55
+ [<Ignore("Remove to run test")>]
56
+ let ``Isogram with duplicated non letter character`` () =
57
+ let input = "Hjelmqvist-Gryb-Zock-Pfund-Wax"
58
+ let expected = true
59
+ let actual = isogram input
60
+ Assert.That(actual, Is.EqualTo(expected))
61
+
62
+ [<Test>]
63
+ [<Ignore("Remove to run test")>]
64
+ let ``Made-up name that is an isogram`` () =
65
+ let input = "Emily Jung Schwartzkopf"
66
+ let expected = true
67
+ let actual = isogram input
68
+ Assert.That(actual, Is.EqualTo(expected))
69
+
70
+ [<Test>]
71
+ [<Ignore("Remove to run test")>]
72
+ let ``Word with duplicated accented character`` () =
73
+ let input = "éléphant"
74
+ let expected = false
75
+ let actual = isogram input
76
+ Assert.That(actual, Is.EqualTo(expected))
@@ -2,12 +2,106 @@ module LuhnTest
2
2
 
3
3
  open NUnit.Framework
4
4
  open Luhn
5
-
6
- [<TestCase("1", ExpectedResult = false)>] // single digit strings can not be valid
7
- [<TestCase("0", ExpectedResult = false, Ignore = "Remove to run test case")>] // a single zero is invalid
8
- [<TestCase("046 454 286", ExpectedResult = true, Ignore = "Remove to run test case")>] // valid Canadian SIN
9
- [<TestCase("046 454 287", ExpectedResult = false, Ignore = "Remove to run test case")>] // invalid Canadian SIN
10
- [<TestCase("8273 1232 7352 0569", ExpectedResult = false, Ignore = "Remove to run test case")>] // invalid credit card
11
- [<TestCase("827a 1232 7352 0569", ExpectedResult = false, Ignore = "Remove to run test case")>] // strings that contain non-digits are not valid
12
- let ``Validate checksum`` number =
13
- valid number
5
+
6
+ [<Test>]
7
+ let ``Single digit strings cannot be valid`` () =
8
+ let input = "1"
9
+ let expected = false
10
+ let actual = valid input
11
+ Assert.That(actual, Is.EqualTo(expected))
12
+
13
+ [<Test>]
14
+ [<Ignore("Remove to run test")>]
15
+ let ``A single zero is invalid`` () =
16
+ let input = "0"
17
+ let expected = false
18
+ let actual = valid input
19
+ Assert.That(actual, Is.EqualTo(expected))
20
+
21
+ [<Test>]
22
+ [<Ignore("Remove to run test")>]
23
+ let ``Single zero with space is invalid`` () =
24
+ let input = "0 "
25
+ let expected = false
26
+ let actual = valid input
27
+ Assert.That(actual, Is.EqualTo(expected))
28
+
29
+ [<Test>]
30
+ [<Ignore("Remove to run test")>]
31
+ let ``Lots of zeros are valid`` () =
32
+ let input = "00000"
33
+ let expected = true
34
+ let actual = valid input
35
+ Assert.That(actual, Is.EqualTo(expected))
36
+
37
+ [<Test>]
38
+ [<Ignore("Remove to run test")>]
39
+ let ``Nine doubled is nine`` () =
40
+ let input = "091"
41
+ let expected = true
42
+ let actual = valid input
43
+ Assert.That(actual, Is.EqualTo(expected))
44
+
45
+ [<Test>]
46
+ [<Ignore("Remove to run test")>]
47
+ let ``Simple valid number`` () =
48
+ let input = " 5 9 "
49
+ let expected = true
50
+ let actual = valid input
51
+ Assert.That(actual, Is.EqualTo(expected))
52
+
53
+ [<Test>]
54
+ [<Ignore("Remove to run test")>]
55
+ let ``Valid Canadian SIN`` () =
56
+ let input = "046 454 286"
57
+ let expected = true
58
+ let actual = valid input
59
+ Assert.That(actual, Is.EqualTo(expected))
60
+
61
+ [<Test>]
62
+ [<Ignore("Remove to run test")>]
63
+ let ``Another valid SIN`` () =
64
+ let input = "055 444 285"
65
+ let expected = true
66
+ let actual = valid input
67
+ Assert.That(actual, Is.EqualTo(expected))
68
+
69
+ [<Test>]
70
+ [<Ignore("Remove to run test")>]
71
+ let ``Invalid Canadian SIN`` () =
72
+ let input = "046 454 287"
73
+ let expected = false
74
+ let actual = valid input
75
+ Assert.That(actual, Is.EqualTo(expected))
76
+
77
+ [<Test>]
78
+ [<Ignore("Remove to run test")>]
79
+ let ``Invalid credit card`` () =
80
+ let input = "8273 1232 7352 0569"
81
+ let expected = false
82
+ let actual = valid input
83
+ Assert.That(actual, Is.EqualTo(expected))
84
+
85
+ [<Test>]
86
+ [<Ignore("Remove to run test")>]
87
+ let ``Strings that contain non-digits are not valid`` () =
88
+ let input = "827a 1232 7352 0569"
89
+ let expected = false
90
+ let actual = valid input
91
+ Assert.That(actual, Is.EqualTo(expected))
92
+
93
+ [<Test>]
94
+ [<Ignore("Remove to run test")>]
95
+ let ``Punctuation is not allowed`` () =
96
+ let input = "055-444-285"
97
+ let expected = false
98
+ let actual = valid input
99
+ Assert.That(actual, Is.EqualTo(expected))
100
+
101
+ [<Test>]
102
+ [<Ignore("Remove to run test")>]
103
+ let ``Symbols are not allowed`` () =
104
+ let input = "055£ 444$ 285"
105
+ let expected = false
106
+ let actual = valid input
107
+ Assert.That(actual, Is.EqualTo(expected))
@@ -1,19 +1,58 @@
1
1
  module NthPrimeTest
2
2
 
3
3
  open NUnit.Framework
4
-
5
4
  open NthPrime
6
5
 
7
- [<TestCase(1, ExpectedResult = 2)>]
8
- [<TestCase(2, ExpectedResult = 3, Ignore = "Remove to run test case")>]
9
- [<TestCase(3, ExpectedResult = 5, Ignore = "Remove to run test case")>]
10
- [<TestCase(4, ExpectedResult = 7, Ignore = "Remove to run test case")>]
11
- [<TestCase(5, ExpectedResult = 11, Ignore = "Remove to run test case")>]
12
- [<TestCase(6, ExpectedResult = 13, Ignore = "Remove to run test case")>]
13
- [<TestCase(7, ExpectedResult = 17, Ignore = "Remove to run test case")>]
14
- [<TestCase(8, ExpectedResult = 19, Ignore = "Remove to run test case")>]
15
- [<TestCase(1000, ExpectedResult = 7919, Ignore = "Remove to run test case")>]
16
- [<TestCase(10000, ExpectedResult = 104729, Ignore = "Remove to run test case")>]
17
- [<TestCase(10001, ExpectedResult = 104743, Ignore = "Remove to run test case")>]
18
- let ``Nth prime calculated`` (nth: int ) =
19
- nthPrime nth
6
+ [<Test>]
7
+ let ``First prime`` () =
8
+ Assert.That(nthPrime 1, Is.EqualTo(2))
9
+
10
+ [<Test>]
11
+ [<Ignore("Remove to run test")>]
12
+ let ``Second prime`` () =
13
+ Assert.That(nthPrime 2, Is.EqualTo(3))
14
+
15
+ [<Test>]
16
+ [<Ignore("Remove to run test")>]
17
+ let ``Third prime`` () =
18
+ Assert.That(nthPrime 3, Is.EqualTo(5))
19
+
20
+ [<Test>]
21
+ [<Ignore("Remove to run test")>]
22
+ let ``4th prime`` () =
23
+ Assert.That(nthPrime 4, Is.EqualTo(7))
24
+
25
+ [<Test>]
26
+ [<Ignore("Remove to run test")>]
27
+ let ``5th prime`` () =
28
+ Assert.That(nthPrime 5, Is.EqualTo(11))
29
+
30
+ [<Test>]
31
+ [<Ignore("Remove to run test")>]
32
+ let ``6th prime`` () =
33
+ Assert.That(nthPrime 6, Is.EqualTo(13))
34
+
35
+ [<Test>]
36
+ [<Ignore("Remove to run test")>]
37
+ let ``7th prime`` () =
38
+ Assert.That(nthPrime 7, Is.EqualTo(17))
39
+
40
+ [<Test>]
41
+ [<Ignore("Remove to run test")>]
42
+ let ``8th prime`` () =
43
+ Assert.That(nthPrime 8, Is.EqualTo(19))
44
+
45
+ [<Test>]
46
+ [<Ignore("Remove to run test")>]
47
+ let ``1000th prime`` () =
48
+ Assert.That(nthPrime 1000, Is.EqualTo(7919))
49
+
50
+ [<Test>]
51
+ [<Ignore("Remove to run test")>]
52
+ let ``10000th prime`` () =
53
+ Assert.That(nthPrime 10000, Is.EqualTo(104729))
54
+
55
+ [<Test>]
56
+ [<Ignore("Remove to run test")>]
57
+ let ``10001th prime`` () =
58
+ Assert.That(nthPrime 10001, Is.EqualTo(104743))
@@ -474,6 +474,11 @@
474
474
  "difficulty": 1,
475
475
  "slug": "variable-length-quantity",
476
476
  "topics": []
477
+ },
478
+ {
479
+ "difficulty": 1,
480
+ "slug": "forth",
481
+ "topics": []
477
482
  }
478
483
  ]
479
484
  }
@@ -0,0 +1,246 @@
1
+ package forth
2
+
3
+ // Source: exercism/x-common
4
+ // Commit: 8804a76 Remove non-ASCII characters tests from forth exercise
5
+
6
+ var parsingGroup = []testCase{
7
+ {
8
+ "empty input results in empty stack",
9
+ []string{},
10
+ []int{},
11
+ },
12
+ {
13
+ "numbers just get pushed onto the stack",
14
+ []string{"1 2 3 4 5"},
15
+ []int{1, 2, 3, 4, 5},
16
+ },
17
+ {
18
+ "all non-word characters are separators",
19
+ []string{"1\x002\x133\n4\r5 6\t7"},
20
+ []int{1, 2, 3, 4, 5, 6, 7},
21
+ },
22
+ }
23
+
24
+ var additionGroup = []testCase{
25
+ {
26
+ "can add two numbers",
27
+ []string{"1 2 +"},
28
+ []int{3},
29
+ },
30
+ {
31
+ "errors if there is nothing on the stack",
32
+ []string{"+"},
33
+ []int(nil),
34
+ },
35
+ {
36
+ "errors if there is only one value on the stack",
37
+ []string{"1 +"},
38
+ []int(nil),
39
+ },
40
+ }
41
+
42
+ var subtractionGroup = []testCase{
43
+ {
44
+ "can subtract two numbers",
45
+ []string{"3 4 -"},
46
+ []int{-1},
47
+ },
48
+ {
49
+ "errors if there is nothing on the stack",
50
+ []string{"-"},
51
+ []int(nil),
52
+ },
53
+ {
54
+ "errors if there is only one value on the stack",
55
+ []string{"1 -"},
56
+ []int(nil),
57
+ },
58
+ }
59
+
60
+ var multiplicationGroup = []testCase{
61
+ {
62
+ "can multiply two numbers",
63
+ []string{"2 4 *"},
64
+ []int{8},
65
+ },
66
+ {
67
+ "errors if there is nothing on the stack",
68
+ []string{"*"},
69
+ []int(nil),
70
+ },
71
+ {
72
+ "errors if there is only one value on the stack",
73
+ []string{"1 *"},
74
+ []int(nil),
75
+ },
76
+ }
77
+
78
+ var divisionGroup = []testCase{
79
+ {
80
+ "can divide two numbers",
81
+ []string{"12 3 /"},
82
+ []int{4},
83
+ },
84
+ {
85
+ "performs integer division",
86
+ []string{"8 3 /"},
87
+ []int{2},
88
+ },
89
+ {
90
+ "errors if dividing by zero",
91
+ []string{"4 0 /"},
92
+ []int(nil),
93
+ },
94
+ {
95
+ "errors if there is nothing on the stack",
96
+ []string{"/"},
97
+ []int(nil),
98
+ },
99
+ {
100
+ "errors if there is only one value on the stack",
101
+ []string{"1 /"},
102
+ []int(nil),
103
+ },
104
+ }
105
+
106
+ var arithmeticGroup = []testCase{
107
+ {
108
+ "addition and subtraction",
109
+ []string{"1 2 + 4 -"},
110
+ []int{-1},
111
+ },
112
+ {
113
+ "multiplication and division",
114
+ []string{"2 4 * 3 /"},
115
+ []int{2},
116
+ },
117
+ }
118
+
119
+ var dupGroup = []testCase{
120
+ {
121
+ "copies the top value on the stack",
122
+ []string{"1 DUP"},
123
+ []int{1, 1},
124
+ },
125
+ {
126
+ "is case-insensitive",
127
+ []string{"1 2 Dup"},
128
+ []int{1, 2, 2},
129
+ },
130
+ {
131
+ "errors if there is nothing on the stack",
132
+ []string{"dup"},
133
+ []int(nil),
134
+ },
135
+ }
136
+
137
+ var dropGroup = []testCase{
138
+ {
139
+ "removes the top value on the stack if it is the only one",
140
+ []string{"1 drop"},
141
+ []int{},
142
+ },
143
+ {
144
+ "removes the top value on the stack if it is not the only one",
145
+ []string{"1 2 drop"},
146
+ []int{1},
147
+ },
148
+ {
149
+ "errors if there is nothing on the stack",
150
+ []string{"drop"},
151
+ []int(nil),
152
+ },
153
+ }
154
+
155
+ var swapGroup = []testCase{
156
+ {
157
+ "swaps the top two values on the stack if they are the only ones",
158
+ []string{"1 2 swap"},
159
+ []int{2, 1},
160
+ },
161
+ {
162
+ "swaps the top two values on the stack if they are not the only ones",
163
+ []string{"1 2 3 swap"},
164
+ []int{1, 3, 2},
165
+ },
166
+ {
167
+ "errors if there is nothing on the stack",
168
+ []string{"swap"},
169
+ []int(nil),
170
+ },
171
+ {
172
+ "errors if there is only one value on the stack",
173
+ []string{"1 swap"},
174
+ []int(nil),
175
+ },
176
+ }
177
+
178
+ var overGroup = []testCase{
179
+ {
180
+ "copies the second element if there are only two",
181
+ []string{"1 2 over"},
182
+ []int{1, 2, 1},
183
+ },
184
+ {
185
+ "copies the second element if there are more than two",
186
+ []string{"1 2 3 over"},
187
+ []int{1, 2, 3, 2},
188
+ },
189
+ {
190
+ "errors if there is nothing on the stack",
191
+ []string{"over"},
192
+ []int(nil),
193
+ },
194
+ {
195
+ "errors if there is only one value on the stack",
196
+ []string{"1 over"},
197
+ []int(nil),
198
+ },
199
+ }
200
+
201
+ var userdefinedGroup = []testCase{
202
+ {
203
+ "can consist of built-in words",
204
+ []string{": dup-twice dup dup ;", "1 dup-twice"},
205
+ []int{1, 1, 1},
206
+ },
207
+ {
208
+ "execute in the right order",
209
+ []string{": countup 1 2 3 ;", "countup"},
210
+ []int{1, 2, 3},
211
+ },
212
+ {
213
+ "can override other user-defined words",
214
+ []string{": foo dup ;", ": foo dup dup ;", "1 foo"},
215
+ []int{1, 1, 1},
216
+ },
217
+ {
218
+ "can override built-in words",
219
+ []string{": swap dup ;", "1 swap"},
220
+ []int{1, 1},
221
+ },
222
+ {
223
+ "cannot redefine numbers",
224
+ []string{": 1 2 ;"},
225
+ []int(nil),
226
+ },
227
+ {
228
+ "errors if executing a non-existent word",
229
+ []string{"foo"},
230
+ []int(nil),
231
+ },
232
+ }
233
+
234
+ var testSections = []testcaseSection{
235
+ {"parsing", parsingGroup},
236
+ {"addition(+)", additionGroup},
237
+ {"subtraction(-)", subtractionGroup},
238
+ {"multiplication(*)", multiplicationGroup},
239
+ {"division(/)", divisionGroup},
240
+ {"arithmetic", arithmeticGroup},
241
+ {"dup", dupGroup},
242
+ {"drop", dropGroup},
243
+ {"swap", swapGroup},
244
+ {"over", overGroup},
245
+ {"user-defined", userdefinedGroup},
246
+ }