trackler 2.2.1.101 → 2.2.1.102
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/protein-translation/description.md +2 -2
- data/problem-specifications/exercises/robot-simulator/canonical-data.json +27 -27
- data/problem-specifications/exercises/run-length-encoding/canonical-data.json +40 -14
- data/problem-specifications/exercises/tournament/canonical-data.json +71 -49
- data/tracks/bash/CONTRIBUTING.md +5 -10
- data/tracks/bash/POLICIES.md +57 -0
- data/tracks/bash/_template/example.sh +20 -1
- data/tracks/bash/exercises/hello-world/hello_world.sh +22 -0
- data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +1 -9
- data/tracks/ceylon/exercises/rna-transcription/README.md +1 -1
- data/tracks/fsharp/exercises/matrix/Example.fs +16 -13
- data/tracks/fsharp/exercises/matrix/Matrix.fs +2 -4
- data/tracks/fsharp/exercises/matrix/MatrixTest.fs +26 -67
- data/tracks/fsharp/exercises/saddle-points/Example.fs +19 -15
- data/tracks/fsharp/exercises/saddle-points/SaddlePointsTest.fs +31 -31
- data/tracks/fsharp/exercises/sublist/SublistTest.fs +71 -41
- data/tracks/fsharp/exercises/tournament/TournamentTest.fs +115 -48
- data/tracks/fsharp/exercises/transpose/Example.fs +10 -13
- data/tracks/fsharp/exercises/transpose/TransposeTest.fs +150 -219
- data/tracks/fsharp/generators/Generators.fs +55 -0
- data/tracks/go/exercises/clock/clock_test.go +1 -1
- data/tracks/go/exercises/poker/.meta/gen.go +5 -3
- data/tracks/go/exercises/poker/cases_test.go +2 -2
- data/tracks/go/exercises/prime-factors/.meta/gen.go +5 -3
- data/tracks/go/exercises/prime-factors/cases_test.go +2 -2
- data/tracks/go/exercises/rail-fence-cipher/.meta/gen.go +9 -7
- data/tracks/go/exercises/rail-fence-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/raindrops/.meta/gen.go +4 -2
- data/tracks/go/exercises/raindrops/cases_test.go +2 -2
- data/tracks/go/exercises/reverse-string/.meta/gen.go +5 -3
- data/tracks/go/exercises/reverse-string/cases_test.go +2 -2
- data/tracks/go/exercises/rna-transcription/.meta/gen.go +11 -19
- data/tracks/go/exercises/rna-transcription/cases_test.go +20 -18
- data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +3 -2
- data/tracks/go/exercises/run-length-encoding/.meta/gen.go +15 -9
- data/tracks/go/exercises/run-length-encoding/cases_test.go +2 -2
- data/tracks/go/exercises/sieve/.meta/gen.go +5 -3
- data/tracks/go/exercises/sieve/cases_test.go +2 -2
- data/tracks/go/exercises/space-age/.meta/gen.go +7 -5
- data/tracks/go/exercises/space-age/cases_test.go +2 -2
- data/tracks/go/exercises/sublist/.meta/gen.go +7 -5
- data/tracks/go/exercises/sublist/cases_test.go +2 -2
- data/tracks/go/exercises/variable-length-quantity/.meta/gen.go +7 -5
- data/tracks/go/exercises/variable-length-quantity/cases_test.go +2 -2
- data/tracks/haskell/exercises/rna-transcription/README.md +1 -1
- data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/test/Tests.hs +12 -0
- data/tracks/javascript/.travis.yml +1 -1
- data/tracks/ruby/exercises/accumulate/.meta/hints.md +6 -3
- data/tracks/ruby/exercises/accumulate/README.md +6 -3
- metadata +4 -3
- data/tracks/fsharp/exercises/transpose/TrinaryTest.fs +0 -26
data/tracks/bash/CONTRIBUTING.md
CHANGED
@@ -6,6 +6,10 @@ general purpose instructions.
|
|
6
6
|
|
7
7
|
[docs]: (https://github.com/exercism/docs)
|
8
8
|
|
9
|
+
Make sure you read the [policies document] and follow the conventions we agreed upon.
|
10
|
+
|
11
|
+
[policies document]: (https://github.com/exercism/bash/blob/master/docs/POLICIES.md)
|
12
|
+
|
9
13
|
A great way to get started contributing is [porting an exercise] from another
|
10
14
|
track! It helps you get into the repository, learn your way around, and see
|
11
15
|
how things are structured.
|
@@ -146,15 +150,6 @@ You can check to see if your example script works by running `bats`.
|
|
146
150
|
$ bats hello_world_test.sh
|
147
151
|
```
|
148
152
|
|
149
|
-
#### Bash Style Guide
|
150
|
-
|
151
|
-
When creating the tests, the tests should follow the [bash style guide]
|
152
|
-
to avoid having an inconsistent style. The tests are delivered as a
|
153
|
-
product, and should be as idiomatic as possible, and this will help
|
154
|
-
maintain a certain level of consistency.
|
155
|
-
|
156
|
-
[bash style guide]: https://google.github.io/styleguide/shell.xml
|
157
|
-
|
158
153
|
### Implementing an Example Solution
|
159
154
|
|
160
155
|
If you've been following along so far, your tests should fail. Go ahead and
|
@@ -297,7 +292,7 @@ $ git rebase upstream/master
|
|
297
292
|
Now you're ready to sync up with Github and open your pull request!
|
298
293
|
|
299
294
|
```bash
|
300
|
-
$ git push
|
295
|
+
$ git push origin <your-branch-name>
|
301
296
|
```
|
302
297
|
|
303
298
|
![Create pull request](img/create-pr.png)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
# Track Policies
|
3
|
+
|
4
|
+
This document:
|
5
|
+
|
6
|
+
- describes all current track-wide policies; and
|
7
|
+
- lists all policies that should be reviewed in response to any given track event.
|
8
|
+
|
9
|
+
Maintainers should refer to this document each time they review a pull request.
|
10
|
+
|
11
|
+
Our policies are not set-in-stone. They represent directions chosen at a point in time with the information/context available at that time. We actively encourage contributors to review and critique them. If you have read through the references that informed an existing policy and still feel it should be improved or removed, please comment and describe:
|
12
|
+
|
13
|
+
1. your alternative perspective;
|
14
|
+
2. your proposed changes; and
|
15
|
+
3. how your proposal balances your own perspective with those already raised during prior discussions.
|
16
|
+
|
17
|
+
## Policy Descriptions
|
18
|
+
|
19
|
+
### Style Guide
|
20
|
+
|
21
|
+
When contributing code to this repository, it should follow the [bash style guide]
|
22
|
+
to avoid having an inconsistent style.
|
23
|
+
This is most import for the tests, since they are delivered as a product, and should be as idiomatic as possible, and this will help maintain a certain level of consistency.
|
24
|
+
|
25
|
+
[bash style guide]: https://google.github.io/styleguide/shell.xml
|
26
|
+
|
27
|
+
### Prefer standard Bash over POSIX compliance
|
28
|
+
|
29
|
+
When submitting or updated exercises, POSIX compliance is not required. This applies when discussing sumbissions for the exercises.
|
30
|
+
You can make POSIX compliance a stretch goal, and that could be a good start for a discussion with users.
|
31
|
+
|
32
|
+
References: [[1](https://github.com/exercism/bash/issues/88)]
|
33
|
+
|
34
|
+
### Exercise structure
|
35
|
+
|
36
|
+
For an exercise "exercise", you should provide the following files:
|
37
|
+
- `README.md`, which describes the exercise
|
38
|
+
- `exercise_test.sh`, which contains the tests for the implementation
|
39
|
+
- `example.sh`, an example implementation that passes the tests
|
40
|
+
- `.meta/version`, which contains the exercise version from `https://github.com/exercism/problem-specifications/exercises/exercise/canonical-data.json`
|
41
|
+
|
42
|
+
References: [[1](https://github.com/exercism/bash/issues/87#event-1446351332)]
|
43
|
+
|
44
|
+
### Exercise Test Structure
|
45
|
+
|
46
|
+
The tests will not enforce using a specific function, unless the problems are complex or requires it (ex: https://github.com/exercism/bash/blob/master/exercises/triangle/triangle_test.sh)
|
47
|
+
|
48
|
+
```
|
49
|
+
run bash exercise.sh "string"
|
50
|
+
```
|
51
|
+
|
52
|
+
instead of
|
53
|
+
```
|
54
|
+
run bash exercise.sh exercise "string"
|
55
|
+
```
|
56
|
+
|
57
|
+
References: [[1](https://github.com/exercism/bash/issues/150#event-1446340584)]
|
@@ -1,3 +1,22 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
#
|
3
|
+
# This is a bash script template in order to help you quick start any script.
|
4
|
+
# It contains some sensible defaults, you can learn more by visiting:
|
5
|
+
# https://google.github.io/styleguide/shell.xml
|
6
|
+
|
7
|
+
# This option will make the script exit when there is an error
|
8
|
+
set -o errexit
|
9
|
+
# This option will make the script exit when are unset variables
|
10
|
+
set -o nounset
|
11
|
+
|
12
|
+
main() {
|
13
|
+
# A string variable containing only the FIRST argument passed to the script,
|
14
|
+
# you can use input=$@ to get a string with ALL arguments
|
15
|
+
input=$1
|
16
|
+
|
17
|
+
# Add your code here
|
18
|
+
}
|
19
|
+
|
20
|
+
# Calls the main function passing all the arguments to it via '$@'
|
21
|
+
# The argument is in quotes to prevent whitespace issues
|
22
|
+
main "$@"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is a bash script template in order to help you quick start any script.
|
4
|
+
# It contains some sensible defaults, you can learn more by visiting:
|
5
|
+
# https://google.github.io/styleguide/shell.xml
|
6
|
+
|
7
|
+
# This option will make the script exit when there is an error
|
8
|
+
set -o errexit
|
9
|
+
# This option will make the script exit when are unset variables
|
10
|
+
set -o nounset
|
11
|
+
|
12
|
+
main() {
|
13
|
+
# A string variable containing only the FIRST argument passed to the script,
|
14
|
+
# you can use input=$@ to get a string with ALL arguments
|
15
|
+
input=$1
|
16
|
+
|
17
|
+
# Add your code here
|
18
|
+
}
|
19
|
+
|
20
|
+
# Calls the main function passing all the arguments to it via '$@'
|
21
|
+
# The argument is in quotes to prevent whitespace issues
|
22
|
+
main "$@"
|
@@ -1,13 +1,9 @@
|
|
1
1
|
import ceylon.test { ... }
|
2
2
|
|
3
|
-
// Tests adapted from problem-specifications version 1.
|
3
|
+
// Tests adapted from problem-specifications version 1.2.0
|
4
4
|
{[String, {String*}, {String*}]*} cases => {
|
5
5
|
// no matches
|
6
6
|
["diaper", {"hello", "world", "zombies", "pants"}, {}],
|
7
|
-
// detects simple anagram
|
8
|
-
["ant", {"tan", "stand", "at"}, {"tan"}],
|
9
|
-
// does not detect false positives
|
10
|
-
["galea", {"eagle"}, {}],
|
11
7
|
// detects two anagrams
|
12
8
|
["master", {"stream", "pigeon", "maters"}, {"stream", "maters"}],
|
13
9
|
// does not detect anagram subsets
|
@@ -20,8 +16,6 @@ import ceylon.test { ... }
|
|
20
16
|
{"gallery", "ballerina", "regally", "clergy", "largely", "leading"},
|
21
17
|
{"gallery", "regally", "largely"}
|
22
18
|
],
|
23
|
-
// does not detect identical words
|
24
|
-
["corn", {"corn", "dark", "Corn", "rank", "CORN", "cron", "park"}, {"cron"}],
|
25
19
|
// does not detect non-anagrams with identical checksum
|
26
20
|
["mass", {"last"}, {}],
|
27
21
|
// detects anagrams case-insensitively
|
@@ -30,8 +24,6 @@ import ceylon.test { ... }
|
|
30
24
|
["Orchestra", {"cashregister", "carthorse", "radishes"}, {"carthorse"}],
|
31
25
|
// detects anagrams using case-insensitive possible matches
|
32
26
|
["orchestra", {"cashregister", "Carthorse", "radishes"}, {"Carthorse"}],
|
33
|
-
// does not detect a word as its own anagram
|
34
|
-
["banana", {"Banana"}, {}],
|
35
27
|
// does not detect a anagram if the original word is repeated
|
36
28
|
["go", {"go Go GO"}, {}],
|
37
29
|
// anagrams must use all letters exactly once
|
@@ -35,7 +35,7 @@ ceylon compile && ceylon test $(basename source/*)
|
|
35
35
|
|
36
36
|
## Source
|
37
37
|
|
38
|
-
|
38
|
+
Hyperphysics [http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html](http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html)
|
39
39
|
|
40
40
|
## Submitting Incomplete Solutions
|
41
41
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -1,18 +1,21 @@
|
|
1
1
|
module Matrix
|
2
2
|
|
3
|
-
|
3
|
+
let private parseRow (row: string) =
|
4
|
+
row.Split(' ')
|
5
|
+
|> Seq.map int
|
6
|
+
|> List.ofSeq
|
4
7
|
|
5
|
-
let
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
let rows = str.Split('\n') |> Array.map parseRow
|
11
|
-
let numberOfCols = Array.item 0 rows |> Array.length
|
12
|
-
let cols = [| for col in 0..numberOfCols - 1 ->
|
13
|
-
[| for row in rows -> Array.item col row |] |]
|
8
|
+
let private parseRows (matrix: string) =
|
9
|
+
matrix.Split('\n')
|
10
|
+
|> Seq.map parseRow
|
11
|
+
|> List.ofSeq
|
14
12
|
|
15
|
-
|
13
|
+
let row index matrix =
|
14
|
+
matrix
|
15
|
+
|> parseRows
|
16
|
+
|> List.item index
|
16
17
|
|
17
|
-
let
|
18
|
-
|
18
|
+
let column index matrix =
|
19
|
+
matrix
|
20
|
+
|> parseRows
|
21
|
+
|> List.map (List.item index)
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Matrix
|
2
2
|
|
3
|
-
let
|
3
|
+
let row index matrix = failwith "You need to implement this function."
|
4
4
|
|
5
|
-
let
|
6
|
-
|
7
|
-
let cols matrix = failwith "You need to implement this function."
|
5
|
+
let col index matrix = failwith "You need to implement this function."
|
@@ -1,82 +1,41 @@
|
|
1
|
-
// This file was
|
1
|
+
// This file was auto-generated based on version 1.0.0 of the canonical data.
|
2
2
|
|
3
3
|
module MatrixTest
|
4
4
|
|
5
|
-
open Xunit
|
6
5
|
open FsUnit.Xunit
|
6
|
+
open Xunit
|
7
7
|
|
8
8
|
open Matrix
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
theoryData.Add("1", [| 1 |])
|
14
|
-
theoryData.Add("4 7", [| 4; 7 |])
|
15
|
-
theoryData.Add("1 2\n10 20", [| 1; 2 |])
|
16
|
-
theoryData.Add("9 7 6\n8 6 5\n5 3 2", [| 9; 7; 6 |])
|
17
|
-
theoryData
|
18
|
-
|
19
|
-
[<Theory>]
|
20
|
-
[<MemberData("ExtractFirstRowData")>]
|
21
|
-
member this.``Extract first row`` (input: string) expected =
|
22
|
-
let matrix = fromString input
|
23
|
-
rows matrix |> Array.head |> should equal expected
|
10
|
+
[<Fact>]
|
11
|
+
let ``Extract row from one number matrix`` () =
|
12
|
+
row 0 "1" |> should equal [1]
|
24
13
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
theoryData.Add("9 7", [| 9; 7 |])
|
29
|
-
theoryData.Add("9 8 7\n19 18 17", [| 19; 18; 17 |])
|
30
|
-
theoryData.Add("1 4 9\n16 25 36\n5 6 7", [| 5; 6; 7 |])
|
31
|
-
theoryData
|
14
|
+
[<Fact(Skip = "Remove to run test")>]
|
15
|
+
let ``Can extract row`` () =
|
16
|
+
row 1 "1 2\n3 4" |> should equal [3; 4]
|
32
17
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
let matrix = fromString input
|
37
|
-
rows matrix |> Array.last |> should equal expected
|
18
|
+
[<Fact(Skip = "Remove to run test")>]
|
19
|
+
let ``Extract row where numbers have different widths`` () =
|
20
|
+
row 1 "1 2\n10 20" |> should equal [10; 20]
|
38
21
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
theoryData.Add("89 1903\n18 3", [| 89; 18 |])
|
43
|
-
theoryData.Add("1 2 3\n4 5 6\n7 8 9\n8 7 6", [| 1; 4; 7; 8 |])
|
44
|
-
theoryData
|
22
|
+
[<Fact(Skip = "Remove to run test")>]
|
23
|
+
let ``Can extract row from non-square matrix`` () =
|
24
|
+
row 2 "1 2 3\n4 5 6\n7 8 9\n8 7 6" |> should equal [7; 8; 9]
|
45
25
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
let matrix = fromString input
|
50
|
-
cols matrix |> Array.head |> should equal expected
|
26
|
+
[<Fact(Skip = "Remove to run test")>]
|
27
|
+
let ``Extract column from one number matrix`` () =
|
28
|
+
column 0 "1" |> should equal [1]
|
51
29
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
theoryData.Add("13\n16\n19", [| 13; 16; 19 |])
|
56
|
-
theoryData.Add("289 21903 23\n218 23 21", [| 23; 21 |])
|
57
|
-
theoryData.Add("11 12 13\n14 15 16\n17 18 19\n18 17 16", [| 13; 16; 19; 16 |])
|
58
|
-
theoryData
|
30
|
+
[<Fact(Skip = "Remove to run test")>]
|
31
|
+
let ``Can extract column`` () =
|
32
|
+
column 2 "1 2 3\n4 5 6\n7 8 9" |> should equal [3; 6; 9]
|
59
33
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
let matrix = fromString input
|
64
|
-
cols matrix |> Array.last |> should equal expected
|
34
|
+
[<Fact(Skip = "Remove to run test")>]
|
35
|
+
let ``Can extract column from non-square matrix`` () =
|
36
|
+
column 2 "1 2 3\n4 5 6\n7 8 9\n8 7 6" |> should equal [3; 6; 9; 6]
|
65
37
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
[<InlineData("289 21903\n23 218\n23 21", 3)>]
|
70
|
-
[<InlineData("11 12 13\n14 15 16\n17 18 19\n18 17 16", 4)>]
|
71
|
-
member this.``Number of rows`` (input: string) expected =
|
72
|
-
let matrix = fromString input
|
73
|
-
rows matrix |> Array.length |> should equal expected
|
38
|
+
[<Fact(Skip = "Remove to run test")>]
|
39
|
+
let ``Extract column where numbers have different widths`` () =
|
40
|
+
column 1 "89 1903 3\n18 3 1\n9 4 800" |> should equal [1903; 3; 4]
|
74
41
|
|
75
|
-
[<Theory(Skip = "Remove to run test")>]
|
76
|
-
[<InlineData("28", 1)>]
|
77
|
-
[<InlineData("13 2\n16 3\n19 4", 2)>]
|
78
|
-
[<InlineData("289 21903\n23 218\n23 21", 2)>]
|
79
|
-
[<InlineData("11 12 13\n14 15 16\n17 18 19\n18 17 16", 3)>]
|
80
|
-
member this.``Number of columns`` (input: string) expected =
|
81
|
-
let matrix = fromString input
|
82
|
-
cols matrix |> Array.length |> should equal expected
|
@@ -1,23 +1,27 @@
|
|
1
1
|
module SaddlePoints
|
2
2
|
|
3
3
|
let saddlePoints (matrix: int list list) =
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
match matrix with
|
5
|
+
| [] -> []
|
6
|
+
| [[]] -> []
|
7
|
+
| _ ->
|
8
|
+
let rec transpose = function
|
9
|
+
| (_::_)::_ as m -> List.map List.head m :: transpose (List.map List.tail m)
|
10
|
+
| _ -> []
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
let rows = matrix |> List.length
|
13
|
+
let cols = matrix |> List.head |> List.length
|
10
14
|
|
11
|
-
|
12
|
-
|
15
|
+
let rowsMax = matrix |> List.map List.max
|
16
|
+
let colsMin = matrix |> transpose |> List.map List.min
|
13
17
|
|
14
|
-
|
15
|
-
|
18
|
+
let rowMax x = rowsMax |> List.item x
|
19
|
+
let colMin y = colsMin |> List.item y
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
let element x y = matrix |> List.item x |> List.item y
|
22
|
+
let isSaddlePoint x y = element x y = rowMax x && element x y = colMin y
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
[for x in 0 .. (rows - 1) do
|
25
|
+
for y in 0 .. (cols - 1) do
|
26
|
+
if isSaddlePoint x y then
|
27
|
+
yield (x, y)]
|
@@ -1,46 +1,46 @@
|
|
1
|
-
// This file was
|
1
|
+
// This file was auto-generated based on version 1.1.0 of the canonical data.
|
2
2
|
|
3
|
-
module
|
3
|
+
module SaddlePointsTest
|
4
4
|
|
5
|
-
open Xunit
|
6
5
|
open FsUnit.Xunit
|
6
|
+
open Xunit
|
7
7
|
|
8
8
|
open SaddlePoints
|
9
9
|
|
10
10
|
[<Fact>]
|
11
|
-
let ``
|
12
|
-
let
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
let ``Can identify single saddle point`` () =
|
12
|
+
let matrix =
|
13
|
+
[ [9; 8; 7];
|
14
|
+
[5; 3; 2];
|
15
|
+
[6; 6; 7] ]
|
16
|
+
saddlePoints matrix |> should equal [(1, 0)]
|
17
17
|
|
18
18
|
[<Fact(Skip = "Remove to run test")>]
|
19
|
-
let ``
|
20
|
-
let
|
21
|
-
|
22
|
-
let actual = saddlePoints values
|
23
|
-
actual |> should be Empty
|
19
|
+
let ``Can identify that empty matrix has no saddle points`` () =
|
20
|
+
let matrix = [[]]
|
21
|
+
saddlePoints matrix |> should be Empty
|
24
22
|
|
25
23
|
[<Fact(Skip = "Remove to run test")>]
|
26
|
-
let ``
|
27
|
-
let
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
let ``Can identify lack of saddle points when there are none`` () =
|
25
|
+
let matrix =
|
26
|
+
[ [1; 2; 3];
|
27
|
+
[3; 1; 2];
|
28
|
+
[2; 3; 1] ]
|
29
|
+
saddlePoints matrix |> should be Empty
|
31
30
|
|
32
31
|
[<Fact(Skip = "Remove to run test")>]
|
33
|
-
let ``
|
34
|
-
let
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
let ``Can identify multiple saddle points`` () =
|
33
|
+
let matrix =
|
34
|
+
[ [4; 5; 4];
|
35
|
+
[3; 5; 5];
|
36
|
+
[1; 5; 4] ]
|
37
|
+
saddlePoints matrix |> should equal [(0, 1); (1, 1); (2, 1)]
|
39
38
|
|
40
39
|
[<Fact(Skip = "Remove to run test")>]
|
41
|
-
let ``
|
42
|
-
let
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
let ``Can identify saddle point in bottom right corner`` () =
|
41
|
+
let matrix =
|
42
|
+
[ [8; 7; 9];
|
43
|
+
[6; 7; 6];
|
44
|
+
[3; 2; 5] ]
|
45
|
+
saddlePoints matrix |> should equal [(2, 2)]
|
46
|
+
|