trackler 2.2.1.144 → 2.2.1.145
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/armstrong-numbers/description.md +1 -1
- data/tracks/crystal/.gitignore +1 -0
- data/tracks/crystal/Makefile +23 -4
- data/tracks/crystal/README.md +13 -4
- data/tracks/elm/docs/RESOURCES.md +46 -4
- data/tracks/go/exercises/space-age/space_age_test.go +2 -1
- data/tracks/java/exercises/binary-search-tree/.meta/version +1 -0
- data/tracks/java/exercises/binary-search-tree/src/test/java/BinarySearchTreeTest.java +25 -10
- data/tracks/powershell/.gitignore +3 -1
- data/tracks/powershell/exercises/hamming/HammingDifference.example.ps1 +4 -0
- data/tracks/powershell/exercises/hamming/{hamming-example.ps1 → HammingDifference.ps1} +0 -0
- data/tracks/powershell/exercises/hamming/HammingDifference.tests.ps1 +65 -0
- data/tracks/powershell/exercises/hello-world/{hello-world-example.ps1 → HelloWorld.example.ps1} +5 -4
- data/tracks/powershell/exercises/hello-world/HelloWorld.ps1 +5 -0
- data/tracks/powershell/exercises/hello-world/{hello-world.tests.ps1 → HelloWorld.tests.ps1} +17 -17
- data/tracks/powershell/exercises/leap/LeapYear.example.ps1 +14 -0
- data/tracks/powershell/exercises/leap/LeapYear.ps1 +5 -0
- data/tracks/powershell/exercises/leap/LeapYear.tests.ps1 +33 -0
- data/tracks/powershell/exercises/two-fer/TwoFer.tests.ps1 +17 -17
- metadata +12 -9
- data/tracks/powershell/exercises/hamming/hamming.tests.ps1 +0 -64
- data/tracks/powershell/exercises/leap/.gitignore +0 -1
- data/tracks/powershell/exercises/leap/leap-example.ps1 +0 -14
- data/tracks/powershell/exercises/leap/leap.tests.ps1 +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d67e5c7c00f7f6776b7e1c4843b30da5f7601088
|
4
|
+
data.tar.gz: 1ea5d1e6fe8a943e76d309ddc17e34880fc367cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 272e5a9ee51e278e70ba7571d415a9309c1dcb793257d78bbe139929494a88b93e7df4611df3005866e2236c5c91b3e86d2015df9ea254af99b2992a76087052
|
7
|
+
data.tar.gz: 93956c4bfd558f6eefe88691a11b7f579412b66b5b359c41950bf6b7ff36c0a9f653373f6527a5a9a0ba5abad3e5a60d4e516f5f2e26074ac1777d7d757ccfb8
|
data/lib/trackler/version.rb
CHANGED
@@ -3,7 +3,7 @@ An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a nu
|
|
3
3
|
For example:
|
4
4
|
|
5
5
|
- 9 is an Armstrong number, because `9 = 9^1 = 9`
|
6
|
-
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 =
|
6
|
+
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
|
7
7
|
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
|
8
8
|
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
|
9
9
|
|
data/tracks/crystal/.gitignore
CHANGED
data/tracks/crystal/Makefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
EXERCISE ?= ""
|
2
1
|
IGNOREDIRS := "^(\.git|.crystal|docs|bin|img|script)$$"
|
3
2
|
EXERCISESDIR ?= "exercises"
|
4
3
|
EXERCISES = $(shell find exercises -maxdepth 1 -mindepth 1 -type d | cut -d'/' -f2 | sort | grep -Ev $(IGNOREDIRS))
|
@@ -11,10 +10,13 @@ SPECFILE := "$(EXERCISENAME)_spec.$(FILEEXT)"
|
|
11
10
|
SUPERSPECFILE := "$(SPECFILE).super"
|
12
11
|
TMPSPECFILE := "$(SPECFILE).tmp"
|
13
12
|
|
14
|
-
GENERATORDIR ?=
|
13
|
+
GENERATORDIR ?= generator
|
14
|
+
GENERATORBIN := $(GENERATORDIR)/bin
|
15
15
|
GENERATORSDIR := $(GENERATORDIR)/src/generators
|
16
16
|
GENERATORS = $(shell find $(GENERATORSDIR) -type f | cut -d '/' -f 4 | cut -d '.' -f 1 | sed 's/_/-/g')
|
17
17
|
|
18
|
+
G_SRCS := $(shell find $(GENERATORDIR) -name "*.cr" -or -name "*.tt" | grep -Ev '(/lib/|/spec/)')
|
19
|
+
|
18
20
|
test-exercise:
|
19
21
|
@echo "running formatting check for: $(EXERCISE)"
|
20
22
|
@crystal tool format --check $(EXERCISESDIR)/$(EXERCISE)
|
@@ -31,10 +33,15 @@ test-exercise:
|
|
31
33
|
test-exercises:
|
32
34
|
@for exercise in $(EXERCISES); do EXERCISE=$$exercise $(MAKE) -s test-exercise || exit 1; done
|
33
35
|
|
34
|
-
|
36
|
+
$(GENERATORBIN):
|
37
|
+
@mkdir -p $@
|
38
|
+
|
39
|
+
$(GENERATORBIN)/generator: $(G_SRCS) | $(GENERATORBIN)
|
35
40
|
@crystal build $(GENERATORDIR)/generator.$(FILEEXT) -o generator/bin/generator
|
36
41
|
|
37
|
-
|
42
|
+
build-generator: $(GENERATORBIN)/generator
|
43
|
+
|
44
|
+
generate-exercise: $(GENERATORBIN)/generator
|
38
45
|
@echo "generating spec file for generator: $(GENERATOR)"
|
39
46
|
@generator/bin/generator $(GENERATOR)
|
40
47
|
|
@@ -49,3 +56,15 @@ test:
|
|
49
56
|
@echo "running all the tests"
|
50
57
|
@$(MAKE) -s test-exercises
|
51
58
|
@$(MAKE) -s test-generator
|
59
|
+
|
60
|
+
bin/configlet: bin/fetch-configlet
|
61
|
+
./bin/fetch-configlet
|
62
|
+
|
63
|
+
ci: bin/configlet
|
64
|
+
./bin/configlet lint . --track-id=crystal
|
65
|
+
$(MAKE) -s test
|
66
|
+
|
67
|
+
clean:
|
68
|
+
rm -rf bin/configlet $(addprefix $(GENERATORDIR)/,.shards bin cache lib)
|
69
|
+
|
70
|
+
.PHONY: clean ci test test-generator build-generator test-exercise test-exercises generate-exercise generate-exercises
|
data/tracks/crystal/README.md
CHANGED
@@ -6,14 +6,14 @@ Exercism problems in Crystal.
|
|
6
6
|
|
7
7
|
### All Exercises
|
8
8
|
|
9
|
-
|
9
|
+
Test all exercises with:
|
10
10
|
```bash
|
11
11
|
$ make test-exercises
|
12
12
|
```
|
13
13
|
|
14
14
|
### Single Exercises
|
15
15
|
|
16
|
-
|
16
|
+
Test single exercises with:
|
17
17
|
```bash
|
18
18
|
$ make test-exercise EXERCISE=exercise-name
|
19
19
|
```
|
@@ -45,13 +45,14 @@ $ crystal generator/generator.cr hello-world
|
|
45
45
|
|
46
46
|
Or build a binary and use that:
|
47
47
|
```bash
|
48
|
-
$ make build-generator
|
49
48
|
$ make generate-exercise GENERATOR=hello-world
|
50
49
|
```
|
51
50
|
|
51
|
+
NOTE: A binary version of the generator is built automatically when needed for a given make target, but you may build it manually at any time by running `make build-generator` (or rebuild it with `make clean build-generator`).
|
52
|
+
|
52
53
|
### Running (or Re-running) the Generator for All Exercises
|
53
54
|
|
54
|
-
This can be used for refreshing the tests when changes are made to the
|
55
|
+
This can be used for refreshing the tests when changes are made to the [problem-specifications](https://github.com/exercism/problem-specifications) repo. Or for testing the full functionality of the test generator.
|
55
56
|
|
56
57
|
```bash
|
57
58
|
$ make generate-exercises
|
@@ -63,6 +64,14 @@ $ make generate-exercises
|
|
63
64
|
$ make test-generator
|
64
65
|
```
|
65
66
|
|
67
|
+
### Cleaning up
|
68
|
+
|
69
|
+
```bash
|
70
|
+
$ make clean
|
71
|
+
```
|
72
|
+
|
73
|
+
Use this command to delete any transient files and build artifacts. This is potentially useful for troubleshooting purposes as it will purge any stale cached files, rebuild the generator when needed and can be combined with other make targets (e.g. `make clean test`).
|
74
|
+
|
66
75
|
## Contributing Guide
|
67
76
|
|
68
77
|
Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
|
@@ -1,10 +1,52 @@
|
|
1
|
-
##
|
1
|
+
## Documentation
|
2
|
+
|
3
|
+
- [Introduction](https://guide.elm-lang.org)
|
4
|
+
- [Installation and Getting Started](https://guide.elm-lang.org/install.html)
|
5
|
+
- [Syntax](https://guide.elm-lang.org/core_language.html)
|
6
|
+
- [Comparison to JavaScript](http://elm-lang.org/docs/from-javascript)
|
7
|
+
- [Core Library API](http://package.elm-lang.org/packages/elm-lang/core/latest/)
|
8
|
+
- [The Elm Architecture](https://guide.elm-lang.org/architecture/)
|
9
|
+
|
10
|
+
|
11
|
+
## Examples
|
12
|
+
|
13
|
+
[Try Elm](http://elm-lang.org/try) provides a number of interactive Elm examples you can edit live in your browser:
|
14
|
+
|
15
|
+
- [Math](http://elm-lang.org/examples/math)
|
16
|
+
- [Strings]()
|
17
|
+
- [Functions](http://elm-lang.org/examples/define-functions)
|
18
|
+
- [Types](http://elm-lang.org/examples/types)
|
19
|
+
- [List length](http://elm-lang.org/examples/length)
|
20
|
+
- [Zip](http://elm-lang.org/examples/zip)
|
21
|
+
- [Quick sort](http://elm-lang.org/examples/quick-sort)
|
22
|
+
- [Boolean expressions](http://elm-lang.org/examples/boolean-expressions)
|
23
|
+
|
24
|
+
More at the [official language site](elm-lang.org/examples).
|
25
|
+
|
26
|
+
|
27
|
+
## Tools
|
28
|
+
|
29
|
+
- [Ellie](https://ellie-app.com/new) is a tool for creating and
|
30
|
+
sharing snippets of Elm-code. For example, if you've got some code
|
31
|
+
that's not working the way you expect, you could put it in Ellie to
|
32
|
+
post to the StackOverflow or the [Elm Slack
|
33
|
+
channel](https://elmlang.herokuapp.com/).
|
34
|
+
|
35
|
+
- [Awesome Elm](https://github.com/isRuslan/awesome-elm) is a long
|
36
|
+
list of articles, videos, editor plugins, packages, and other
|
37
|
+
resources.
|
2
38
|
|
3
|
-
[Try Elm](http://elm-lang.org/try) provides a number of interactive Elm examples you can edit live in your browser.
|
4
39
|
|
5
40
|
## Videos
|
6
41
|
|
7
|
-
|
8
|
-
|
42
|
+
About using Elm:
|
43
|
+
|
9
44
|
- [Effects as Data](https://www.youtube.com/watch?v=6EdXaWfoslc) *Richard Feldman*
|
10
45
|
- [Elm: Building Reactive Web Apps](https://pragmaticstudio.com/elm) *The Pragmatic Studio*
|
46
|
+
- [Making Impossible States Impossible](https://www.youtube.com/watch?v=IcgmSRJHu_8) *Richard Feldman*
|
47
|
+
|
48
|
+
About how Elm is developed, and why it is the way it is:
|
49
|
+
|
50
|
+
- [Controlling Time and Space: understanding the many formulations of FRP](https://www.youtube.com/watch?v=Agu6jipKfYw) *Evan Czaplicki*
|
51
|
+
- [Let's be mainstream! User focused design in Elm](https://www.youtube.com/watch?v=oYk8CKH7OhE) ([transcript](http://www.elmbark.com/2016/03/16/mainstream-elm-user-focused-design)) *Evan Czaplicki*
|
52
|
+
- [The life of a file](https://www.youtube.com/watch?v=XpDsk374LDE) *Evan Czaplicki*
|
@@ -8,7 +8,8 @@ import (
|
|
8
8
|
func TestAge(t *testing.T) {
|
9
9
|
const precision = 0.01
|
10
10
|
for _, tc := range testCases {
|
11
|
-
|
11
|
+
actual := Age(tc.seconds, tc.planet)
|
12
|
+
if math.IsNaN(actual) || math.Abs(actual-tc.expected) > precision {
|
12
13
|
t.Fatalf("FAIL: %s\nExpected: %#v\nActual: %#v", tc.description, tc.expected, actual)
|
13
14
|
}
|
14
15
|
t.Logf("PASS: %s", tc.description)
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -95,7 +95,7 @@ public class BinarySearchTreeTest {
|
|
95
95
|
);
|
96
96
|
|
97
97
|
List<Character> treeData = Collections.unmodifiableList(
|
98
|
-
Arrays.asList('4', '2', '6', '1', '3', '
|
98
|
+
Arrays.asList('4', '2', '6', '1', '3', '5', '7')
|
99
99
|
);
|
100
100
|
treeData.forEach(binarySearchTree::insert);
|
101
101
|
|
@@ -108,10 +108,10 @@ public class BinarySearchTreeTest {
|
|
108
108
|
public void sortsSingleElement() {
|
109
109
|
BinarySearchTree<String> binarySearchTree = new BinarySearchTree<>();
|
110
110
|
List<String> expected = Collections.unmodifiableList(
|
111
|
-
Collections.singletonList("
|
111
|
+
Collections.singletonList("2")
|
112
112
|
);
|
113
113
|
|
114
|
-
binarySearchTree.insert("
|
114
|
+
binarySearchTree.insert("2");
|
115
115
|
|
116
116
|
List<String> actual = binarySearchTree.getAsSortedList();
|
117
117
|
assertEquals(expected, actual);
|
@@ -122,26 +122,41 @@ public class BinarySearchTreeTest {
|
|
122
122
|
public void sortsCollectionOfTwoIfSecondInsertedIsSmallerThanFirst() {
|
123
123
|
BinarySearchTree<Integer> binarySearchTree = new BinarySearchTree<>();
|
124
124
|
List<Integer> expected = Collections.unmodifiableList(
|
125
|
-
Arrays.asList(
|
125
|
+
Arrays.asList(1, 2)
|
126
126
|
);
|
127
127
|
|
128
|
-
binarySearchTree.insert(4);
|
129
128
|
binarySearchTree.insert(2);
|
129
|
+
binarySearchTree.insert(1);
|
130
130
|
|
131
131
|
List<Integer> actual = binarySearchTree.getAsSortedList();
|
132
132
|
assertEquals(expected, actual);
|
133
133
|
}
|
134
|
+
|
135
|
+
@Ignore("Remove to run test")
|
136
|
+
@Test
|
137
|
+
public void sortsCollectionOfTwoIfSecondNumberisSameAsFirst() {
|
138
|
+
BinarySearchTree<Character> binarySearchTree = new BinarySearchTree<>();
|
139
|
+
List<Character> expected = Collections.unmodifiableList(
|
140
|
+
Arrays.asList('2', '2')
|
141
|
+
);
|
142
|
+
|
143
|
+
binarySearchTree.insert('2');
|
144
|
+
binarySearchTree.insert('2');
|
145
|
+
|
146
|
+
List<Character> actual = binarySearchTree.getAsSortedList();
|
147
|
+
assertEquals(expected, actual);
|
148
|
+
}
|
134
149
|
|
135
150
|
@Ignore("Remove to run test")
|
136
151
|
@Test
|
137
152
|
public void sortsCollectionOfTwoIfSecondInsertedIsBiggerThanFirst() {
|
138
153
|
BinarySearchTree<Character> binarySearchTree = new BinarySearchTree<>();
|
139
154
|
List<Character> expected = Collections.unmodifiableList(
|
140
|
-
Arrays.asList('
|
155
|
+
Arrays.asList('2', '3')
|
141
156
|
);
|
142
157
|
|
143
|
-
binarySearchTree.insert('
|
144
|
-
binarySearchTree.insert('
|
158
|
+
binarySearchTree.insert('2');
|
159
|
+
binarySearchTree.insert('3');
|
145
160
|
|
146
161
|
List<Character> actual = binarySearchTree.getAsSortedList();
|
147
162
|
assertEquals(expected, actual);
|
@@ -152,11 +167,11 @@ public class BinarySearchTreeTest {
|
|
152
167
|
public void iteratesOverComplexTree() {
|
153
168
|
BinarySearchTree<String> binarySearchTree = new BinarySearchTree<>();
|
154
169
|
List<String> expected = Collections.unmodifiableList(
|
155
|
-
Arrays.asList("1", "2", "3", "
|
170
|
+
Arrays.asList("1", "2", "3", "5", "6", "7")
|
156
171
|
);
|
157
172
|
|
158
173
|
List<String> treeData = Collections.unmodifiableList(
|
159
|
-
Arrays.asList("
|
174
|
+
Arrays.asList("2", "1", "3", "6", "7", "5")
|
160
175
|
);
|
161
176
|
treeData.forEach(binarySearchTree::insert);
|
162
177
|
|
File without changes
|
@@ -0,0 +1,65 @@
|
|
1
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
+
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
+
. "$here\$sut"
|
4
|
+
|
5
|
+
Describe "HammingTest" {
|
6
|
+
It "tests identical strands" {
|
7
|
+
Get-HammingDifference 'A' 'A' | Should be 0
|
8
|
+
}
|
9
|
+
|
10
|
+
It "tests log identical strands" {
|
11
|
+
Get-HammingDifference "GGACTGA" "GGACTGA" | Should be 0
|
12
|
+
}
|
13
|
+
|
14
|
+
It "tests complete distance in single nucleotide strands" {
|
15
|
+
Get-HammingDifference "A" "G" | Should be 1
|
16
|
+
}
|
17
|
+
|
18
|
+
It "tests complete distance in small strands" {
|
19
|
+
Get-HammingDifference "AG" "CT" | Should be 2
|
20
|
+
}
|
21
|
+
|
22
|
+
It "tests small distance in small strands" {
|
23
|
+
Get-HammingDifference "AT" "CT" | Should be 1
|
24
|
+
}
|
25
|
+
|
26
|
+
It "tests small distance" {
|
27
|
+
Get-HammingDifference "GGACG" "GGTCG" | Should be 1
|
28
|
+
}
|
29
|
+
|
30
|
+
It "tests small distance in long strands" {
|
31
|
+
Get-HammingDifference "ACCAGGG" "ACTATGG" | Should be 2
|
32
|
+
}
|
33
|
+
|
34
|
+
It "tests non unique character in first strand" {
|
35
|
+
Get-HammingDifference "AGA" "AGG" | Should be 1
|
36
|
+
}
|
37
|
+
|
38
|
+
It "tests non unique character in second strand" {
|
39
|
+
Get-HammingDifference "AGG" "AGA" | Should be 1
|
40
|
+
}
|
41
|
+
|
42
|
+
It "tests same nucleotides in different position" {
|
43
|
+
Get-HammingDifference "TAG" "GAT" | Should be 2
|
44
|
+
}
|
45
|
+
|
46
|
+
It "tests large distance" {
|
47
|
+
Get-HammingDifference "GATACA" "GCATAA" | Should be 4
|
48
|
+
}
|
49
|
+
|
50
|
+
It "tests large distance in off by one strand" {
|
51
|
+
Get-HammingDifference "GGACGGATTCTG" "AGGACGGATTCT" | Should be 9
|
52
|
+
}
|
53
|
+
|
54
|
+
It "tests empty strands" {
|
55
|
+
Get-HammingDifference "" "" | Should be 0
|
56
|
+
}
|
57
|
+
|
58
|
+
It "tests disallow first strand longer" {
|
59
|
+
{ Get-HammingDifference "AATG" "AAA" } | Should Throw "Mismatching string lengths"
|
60
|
+
}
|
61
|
+
|
62
|
+
It "tests disallow second strand longer" {
|
63
|
+
{ Get-HammingDifference "ATA" "AGTG" } | Should Throw "Mismatching string lengths"
|
64
|
+
}
|
65
|
+
}
|
data/tracks/powershell/exercises/hello-world/{hello-world-example.ps1 → HelloWorld.example.ps1}
RENAMED
@@ -1,4 +1,5 @@
|
|
1
|
-
function Get-HelloWorld {
|
2
|
-
param( [string]$person = "World")
|
3
|
-
|
4
|
-
|
1
|
+
function Get-HelloWorld {
|
2
|
+
param( [string]$person = "World")
|
3
|
+
|
4
|
+
return "Hello, $person!"
|
5
|
+
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
-
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
|
3
|
-
. "$here\$sut"
|
4
|
-
|
5
|
-
Describe "HelloWorldTest" {
|
6
|
-
It "
|
7
|
-
Get-HelloWorld | Should be 'Hello, World!'
|
8
|
-
}
|
9
|
-
|
10
|
-
It "
|
11
|
-
Get-HelloWorld('Alice') | Should be 'Hello, Alice!'
|
12
|
-
}
|
13
|
-
|
14
|
-
It "
|
15
|
-
Get-HelloWorld('Bob') | Should be 'Hello, Bob!'
|
16
|
-
}
|
17
|
-
}
|
1
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
+
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
|
3
|
+
. "$here\$sut"
|
4
|
+
|
5
|
+
Describe "HelloWorldTest" {
|
6
|
+
It "Outputs: 'Hello, World!'" {
|
7
|
+
Get-HelloWorld | Should be 'Hello, World!'
|
8
|
+
}
|
9
|
+
|
10
|
+
It "Outputs: Hello, Alice!" {
|
11
|
+
Get-HelloWorld('Alice') | Should be 'Hello, Alice!'
|
12
|
+
}
|
13
|
+
|
14
|
+
It "Outpus: Hello, Bob!" {
|
15
|
+
Get-HelloWorld('Bob') | Should be 'Hello, Bob!'
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
function Test-LeapYear {
|
2
|
+
param( [int]$year )
|
3
|
+
# This could be solved using the native system.datetime object
|
4
|
+
# but that isn't in the spirit of exercism.
|
5
|
+
#[system.datetime]::isleapyear($year)
|
6
|
+
|
7
|
+
# Instead solve using math
|
8
|
+
if ( $year % 4 -eq 0 -and $year % 100 -ne 0 -or $year % 400 -eq 0) {
|
9
|
+
return $True
|
10
|
+
}
|
11
|
+
else {
|
12
|
+
return $False
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
+
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
+
. "$here\$sut"
|
4
|
+
|
5
|
+
Describe "LeapYear Tests" {
|
6
|
+
It "tests leap year" {
|
7
|
+
Test-LeapYear(1996) | Should be $true
|
8
|
+
}
|
9
|
+
|
10
|
+
It "tests standard and odd year" {
|
11
|
+
Test-LeapYear(1997) | Should be $false
|
12
|
+
}
|
13
|
+
|
14
|
+
It "tests standard even year" {
|
15
|
+
Test-LeapYear(1998) | Should be $false
|
16
|
+
}
|
17
|
+
|
18
|
+
It "tests standard ninteenth century" {
|
19
|
+
Test-LeapYear(1900) | Should be $false
|
20
|
+
}
|
21
|
+
|
22
|
+
It "tests standard eighteenth year" {
|
23
|
+
Test-LeapYear(1800) | Should be $false
|
24
|
+
}
|
25
|
+
|
26
|
+
It "tests leap twenty fourth century" {
|
27
|
+
Test-LeapYear(2400) | Should be $true
|
28
|
+
}
|
29
|
+
|
30
|
+
It "tests leap year 2000" {
|
31
|
+
Test-LeapYear(2000) | Should be $true
|
32
|
+
}
|
33
|
+
}
|
@@ -5,32 +5,32 @@ $CommandName = "Get-TwoFer"
|
|
5
5
|
|
6
6
|
# Remove the function if its already found
|
7
7
|
If (Get-Command $CommandName -ErrorAction SilentlyContinue){
|
8
|
-
|
9
|
-
|
8
|
+
Write-Verbose "Removing the existing $CommandName function as it exists"
|
9
|
+
Remove-Item -Path "Function:\$CommandName"
|
10
10
|
}
|
11
11
|
|
12
12
|
# Load the script file
|
13
13
|
If (Test-Path "$ExercisePath\$ScriptFile"){
|
14
|
-
|
15
|
-
|
14
|
+
Write-Output ("Loading: {0}" -f "$ExercisePath\$ScriptFile")
|
15
|
+
. ("$ExercisePath\$ScriptFile")
|
16
16
|
}
|
17
17
|
Else {
|
18
|
-
|
19
|
-
|
18
|
+
# Display an error and stop the tests
|
19
|
+
Write-Error "The file $ScriptFile was not found. You need to create your answer in a file named $ScriptFile" -ErrorAction Stop
|
20
20
|
}
|
21
21
|
|
22
22
|
|
23
23
|
Describe "Get-TwoFer" {
|
24
|
-
|
25
|
-
It "Given <Name> expects <Expected>" -TestCases @(
|
26
|
-
@{ Name = $null; Expected = "One for you, one for me" },
|
27
|
-
@{ Name = ""; Expected = "One for you, one for me" },
|
28
|
-
@{ Name = "Alice"; Expected = "One for Alice, one for me" }
|
29
|
-
) {
|
30
|
-
Param(
|
31
|
-
$Name, $Expected
|
32
|
-
)
|
33
24
|
|
34
|
-
|
35
|
-
|
25
|
+
It "Given <Name> expects <Expected>" -TestCases @(
|
26
|
+
@{ Name = $null; Expected = "One for you, one for me" },
|
27
|
+
@{ Name = ""; Expected = "One for you, one for me" },
|
28
|
+
@{ Name = "Alice"; Expected = "One for Alice, one for me" }
|
29
|
+
) {
|
30
|
+
Param(
|
31
|
+
$Name, $Expected
|
32
|
+
)
|
33
|
+
|
34
|
+
Get-TwoFer -Name $Name | Should -Be $Expected
|
35
|
+
}
|
36
36
|
}
|
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.
|
4
|
+
version: 2.2.1.145
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -7614,6 +7614,7 @@ files:
|
|
7614
7614
|
- tracks/java/exercises/beer-song/src/main/java/.keep
|
7615
7615
|
- tracks/java/exercises/beer-song/src/test/java/BeerSongTest.java
|
7616
7616
|
- tracks/java/exercises/binary-search-tree/.meta/src/reference/java/BinarySearchTree.java
|
7617
|
+
- tracks/java/exercises/binary-search-tree/.meta/version
|
7617
7618
|
- tracks/java/exercises/binary-search-tree/README.md
|
7618
7619
|
- tracks/java/exercises/binary-search-tree/build.gradle
|
7619
7620
|
- tracks/java/exercises/binary-search-tree/src/main/java/BinarySearchTree.java
|
@@ -11359,19 +11360,21 @@ files:
|
|
11359
11360
|
- tracks/powershell/docs/TESTS.md
|
11360
11361
|
- tracks/powershell/docs/img
|
11361
11362
|
- tracks/powershell/exercises/hamming/.version
|
11363
|
+
- tracks/powershell/exercises/hamming/HammingDifference.example.ps1
|
11364
|
+
- tracks/powershell/exercises/hamming/HammingDifference.ps1
|
11365
|
+
- tracks/powershell/exercises/hamming/HammingDifference.tests.ps1
|
11362
11366
|
- tracks/powershell/exercises/hamming/README.md
|
11363
|
-
- tracks/powershell/exercises/hamming/hamming-example.ps1
|
11364
|
-
- tracks/powershell/exercises/hamming/hamming.tests.ps1
|
11365
11367
|
- tracks/powershell/exercises/hello-world/.version
|
11366
11368
|
- tracks/powershell/exercises/hello-world/GETTING_STARTED.md
|
11369
|
+
- tracks/powershell/exercises/hello-world/HelloWorld.example.ps1
|
11370
|
+
- tracks/powershell/exercises/hello-world/HelloWorld.ps1
|
11371
|
+
- tracks/powershell/exercises/hello-world/HelloWorld.tests.ps1
|
11367
11372
|
- tracks/powershell/exercises/hello-world/README.md
|
11368
|
-
- tracks/powershell/exercises/hello-world/hello-world-example.ps1
|
11369
|
-
- tracks/powershell/exercises/hello-world/hello-world.tests.ps1
|
11370
|
-
- tracks/powershell/exercises/leap/.gitignore
|
11371
11373
|
- tracks/powershell/exercises/leap/.version
|
11374
|
+
- tracks/powershell/exercises/leap/LeapYear.example.ps1
|
11375
|
+
- tracks/powershell/exercises/leap/LeapYear.ps1
|
11376
|
+
- tracks/powershell/exercises/leap/LeapYear.tests.ps1
|
11372
11377
|
- tracks/powershell/exercises/leap/README.md
|
11373
|
-
- tracks/powershell/exercises/leap/leap-example.ps1
|
11374
|
-
- tracks/powershell/exercises/leap/leap.tests.ps1
|
11375
11378
|
- tracks/powershell/exercises/two-fer/.version
|
11376
11379
|
- tracks/powershell/exercises/two-fer/README.md
|
11377
11380
|
- tracks/powershell/exercises/two-fer/TwoFer.example.ps1
|
@@ -1,64 +0,0 @@
|
|
1
|
-
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
-
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
-
. "$here\$sut"
|
4
|
-
|
5
|
-
Describe "HammingTest" {
|
6
|
-
It "tests identical strands" {
|
7
|
-
Get-HammingDifference 'A' 'A' | Should be 0
|
8
|
-
}
|
9
|
-
It "tests log identical strands" {
|
10
|
-
Get-HammingDifference "GGACTGA" "GGACTGA" | Should be 0
|
11
|
-
}
|
12
|
-
|
13
|
-
It "tests complete distance in single nucleotide strands" {
|
14
|
-
Get-HammingDifference "A" "G" | Should be 1
|
15
|
-
}
|
16
|
-
|
17
|
-
It "tests complete distance in small strands" {
|
18
|
-
Get-HammingDifference "AG" "CT" | Should be 2
|
19
|
-
}
|
20
|
-
|
21
|
-
It "tests small distance in small strands" {
|
22
|
-
Get-HammingDifference "AT" "CT" | Should be 1
|
23
|
-
}
|
24
|
-
|
25
|
-
It "tests small distance" {
|
26
|
-
Get-HammingDifference "GGACG" "GGTCG" | Should be 1
|
27
|
-
}
|
28
|
-
|
29
|
-
It "tests small distance in long strands" {
|
30
|
-
Get-HammingDifference "ACCAGGG" "ACTATGG" | Should be 2
|
31
|
-
}
|
32
|
-
|
33
|
-
It "tests non unique character in first strand" {
|
34
|
-
Get-HammingDifference "AGA" "AGG" | Should be 1
|
35
|
-
}
|
36
|
-
|
37
|
-
It "tests non unique character in second strand" {
|
38
|
-
Get-HammingDifference "AGG" "AGA" | Should be 1
|
39
|
-
}
|
40
|
-
|
41
|
-
It "tests same nucleotides in different position" {
|
42
|
-
Get-HammingDifference "TAG" "GAT" | Should be 2
|
43
|
-
}
|
44
|
-
|
45
|
-
It "tests large distance" {
|
46
|
-
Get-HammingDifference "GATACA" "GCATAA" | Should be 4
|
47
|
-
}
|
48
|
-
|
49
|
-
It "tests large distance in off by one strand" {
|
50
|
-
Get-HammingDifference "GGACGGATTCTG" "AGGACGGATTCT" | Should be 9
|
51
|
-
}
|
52
|
-
|
53
|
-
It "tests empty strands" {
|
54
|
-
Get-HammingDifference "" "" | Should be 0
|
55
|
-
}
|
56
|
-
|
57
|
-
It "tests disallow first strand longer" {
|
58
|
-
{ Get-HammingDifference "AATG" "AAA" } | Should Throw "Mismatching string lengths"
|
59
|
-
}
|
60
|
-
|
61
|
-
It "tests disallow second strand longer" {
|
62
|
-
{ Get-HammingDifference "ATA" "AGTG" } | Should Throw "Mismatching string lengths"
|
63
|
-
}
|
64
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
leap.ps1
|
@@ -1,14 +0,0 @@
|
|
1
|
-
function Test-LeapYear {
|
2
|
-
param( [int]$year )
|
3
|
-
# This could be solved using the native system.datetime object
|
4
|
-
# but that isn't in the spirit of exercism.
|
5
|
-
#[system.datetime]::isleapyear($year)
|
6
|
-
|
7
|
-
# Instead solve using math
|
8
|
-
if ( $year % 4 -eq 0 -and $year % 100 -ne 0 -or $year % 400 -eq 0) {
|
9
|
-
return $True
|
10
|
-
}
|
11
|
-
else {
|
12
|
-
return $False
|
13
|
-
}
|
14
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
-
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
-
. "$here\$sut"
|
4
|
-
|
5
|
-
Describe "LeapYear Tests" {
|
6
|
-
It "tests leap year" {
|
7
|
-
Test-LeapYear(1996) | Should be $True
|
8
|
-
}
|
9
|
-
|
10
|
-
It "tests standard and odd year" {
|
11
|
-
Test-LeapYear(1997) | Should be $False
|
12
|
-
}
|
13
|
-
|
14
|
-
It "tests standard even year" {
|
15
|
-
Test-LeapYear(1998) | Should be $False
|
16
|
-
}
|
17
|
-
|
18
|
-
It "tests standard ninteenth century" {
|
19
|
-
Test-LeapYear(1900) | Should be $False
|
20
|
-
}
|
21
|
-
|
22
|
-
It "tests standard eighteenth year" {
|
23
|
-
Test-LeapYear(1800) | Should be $False
|
24
|
-
}
|
25
|
-
|
26
|
-
It "tests leap twenty fourth century" {
|
27
|
-
Test-LeapYear(2400) | Should be $True
|
28
|
-
}
|
29
|
-
|
30
|
-
It "tests leap year 2000" {
|
31
|
-
Test-LeapYear(2000) | Should be $True
|
32
|
-
}
|
33
|
-
}
|