trackler 2.2.1.51 → 2.2.1.52
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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/saddle-points/description.md +1 -1
- data/tracks/cfml/.gitattributes +19 -0
- data/tracks/cfml/config.json +180 -186
- data/tracks/cfml/tasks/FormatConfig.cfc +26 -0
- data/tracks/cfml/tasks/ScaffoldExercise.cfc +1 -1
- data/tracks/common-lisp/config.json +26 -9
- data/tracks/common-lisp/exercises/acronym/README.md +61 -0
- data/tracks/common-lisp/exercises/acronym/acronym-test.lisp +48 -0
- data/tracks/common-lisp/exercises/acronym/acronym.lisp +6 -0
- data/tracks/common-lisp/exercises/acronym/example.lisp +24 -0
- data/tracks/common-lisp/exercises/isogram/README.md +65 -0
- data/tracks/common-lisp/exercises/isogram/example.lisp +18 -0
- data/tracks/common-lisp/exercises/isogram/isogram-test.lisp +39 -0
- data/tracks/common-lisp/exercises/isogram/isogram.lisp +8 -0
- data/tracks/delphi/exercises/etl/README.md +1 -1
- data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
- data/tracks/delphi/exercises/saddle-points/README.md +1 -1
- data/tracks/fsharp/exercises/all-your-base/AllYourBaseTest.fs +21 -21
- data/tracks/fsharp/exercises/kindergarten-garden/Example.fs +13 -14
- data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGarden.fs +1 -3
- data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGardenTest.fs +9 -41
- data/tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs +12 -12
- data/tracks/fsharp/exercises/rna-transcription/RnaTranscriptionTest.fs +8 -8
- data/tracks/fsharp/exercises/robot-simulator/RobotSimulator.fs +3 -0
- data/tracks/fsharp/exercises/robot-simulator/RobotSimulatorTest.fs +129 -26
- data/tracks/fsharp/generators/Common.fs +10 -0
- data/tracks/fsharp/generators/Exercise.fs +5 -1
- data/tracks/fsharp/generators/Generators.fs +122 -33
- data/tracks/fsharp/generators/Output.fs +6 -1
- data/tracks/haskell/exercises/crypto-square/README.md +6 -4
- data/tracks/haskell/exercises/kindergarten-garden/README.md +10 -10
- data/tracks/haskell/exercises/saddle-points/README.md +1 -1
- data/tracks/haskell/exercises/space-age/README.md +1 -1
- data/tracks/java/config.json +8 -2
- data/tracks/java/exercises/queen-attack/.meta/src/reference/java/BoardCoordinate.java +12 -12
- data/tracks/java/exercises/queen-attack/.meta/src/reference/java/QueenAttackCalculator.java +14 -14
- data/tracks/java/exercises/queen-attack/.meta/version +1 -1
- data/tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java +11 -11
- data/tracks/javascript/exercises/prime-factors/example.js +10 -9
- data/tracks/julia/config.json +12 -0
- data/tracks/julia/exercises/run-length-encoding/README.md +31 -0
- data/tracks/julia/exercises/run-length-encoding/example.jl +22 -0
- data/tracks/julia/exercises/run-length-encoding/run-length-encoding.jl +7 -0
- data/tracks/julia/exercises/run-length-encoding/runtests.jl +29 -0
- data/tracks/objective-c/README.md +79 -1
- data/tracks/ocaml/config.json +430 -433
- data/tracks/ocaml/config/maintainers.json +11 -11
- data/tracks/php/config.json +16 -0
- data/tracks/php/exercises/all-your-base/README.md +31 -0
- data/tracks/php/exercises/all-your-base/all-your-base_test.php +135 -0
- data/tracks/php/exercises/all-your-base/example.php +27 -0
- data/tracks/php/exercises/series/README.md +21 -0
- data/tracks/php/exercises/series/example.php +15 -0
- data/tracks/php/exercises/series/series_test.php +64 -0
- data/tracks/python/README.md +1 -1
- data/tracks/python/config.json +4 -1
- data/tracks/python/exercises/forth/forth.py +4 -0
- data/tracks/python/exercises/forth/forth_test.py +1 -1
- data/tracks/python/exercises/markdown/example.py +1 -1
- data/tracks/python/exercises/markdown/markdown_test.py +3 -3
- data/tracks/ruby/exercises/two-bucket/.meta/.version +1 -1
- data/tracks/ruby/exercises/two-bucket/.meta/solutions/two_bucket.rb +23 -3
- data/tracks/ruby/exercises/two-bucket/two_bucket_test.rb +4 -4
- metadata +22 -2
|
@@ -5,16 +5,17 @@ type Plant = Violets | Radishes | Clover | Grass
|
|
|
5
5
|
let plantsPerChildPerRow = 2
|
|
6
6
|
let rowSeparator = '\n'
|
|
7
7
|
|
|
8
|
-
let private
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
let private children =
|
|
9
|
+
[ "Alice"; "Bob"; "Charlie"; "David";
|
|
10
|
+
"Eve"; "Fred"; "Ginny"; "Harriet";
|
|
11
|
+
"Ileana"; "Joseph"; "Kincaid"; "Larry"]
|
|
11
12
|
|
|
12
13
|
let private plantFromCode code =
|
|
13
14
|
match code with
|
|
14
|
-
| 'V' ->
|
|
15
|
-
| 'R' ->
|
|
16
|
-
| 'C' ->
|
|
17
|
-
| 'G' ->
|
|
15
|
+
| 'V' -> Violets
|
|
16
|
+
| 'R' -> Radishes
|
|
17
|
+
| 'C' -> Clover
|
|
18
|
+
| 'G' -> Grass
|
|
18
19
|
| x -> failwithf "%c is an invalid plant code" x
|
|
19
20
|
|
|
20
21
|
let private plantsInRow (row: string) =
|
|
@@ -22,16 +23,14 @@ let private plantsInRow (row: string) =
|
|
|
22
23
|
|> Seq.chunkBySize plantsPerChildPerRow
|
|
23
24
|
|> Seq.map List.ofArray
|
|
24
25
|
|
|
25
|
-
let toGarden
|
|
26
|
+
let toGarden (windowSills: string) =
|
|
26
27
|
let rows = windowSills.Split rowSeparator
|
|
27
28
|
let row1 = plantsInRow rows.[0]
|
|
28
29
|
let row2 = plantsInRow rows.[1]
|
|
29
|
-
Seq.zip3
|
|
30
|
+
Seq.zip3 children row1 row2
|
|
30
31
|
|> Seq.map (fun (child, plants1, plants2) -> (child, plants1 @ plants2))
|
|
31
32
|
|> Map.ofSeq
|
|
32
33
|
|
|
33
|
-
let
|
|
34
|
-
let garden = toGarden
|
|
35
|
-
defaultArg (Map.tryFind student garden) []
|
|
36
|
-
|
|
37
|
-
let plantsForDefaultStudents diagram student = plantsForCustomStudents diagram student defaultChildren
|
|
34
|
+
let plants diagram student =
|
|
35
|
+
let garden = toGarden diagram
|
|
36
|
+
defaultArg (Map.tryFind student garden) []
|
|
@@ -2,6 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
// TODO: define the Plant type
|
|
4
4
|
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
let plantsForCustomStudents diagram student students = failwith "You need to implement this function."
|
|
5
|
+
let plants diagram student = failwith "You need to implement this function."
|
|
@@ -12,93 +12,61 @@ let ``Partial garden - garden with single student`` () =
|
|
|
12
12
|
let student = "Alice"
|
|
13
13
|
let diagram = "RC\nGG"
|
|
14
14
|
let expected = [Plant.Radishes; Plant.Clover; Plant.Grass; Plant.Grass]
|
|
15
|
-
|
|
15
|
+
plants diagram student |> should equal expected
|
|
16
16
|
|
|
17
17
|
[<Fact(Skip = "Remove to run test")>]
|
|
18
18
|
let ``Partial garden - different garden with single student`` () =
|
|
19
19
|
let student = "Alice"
|
|
20
20
|
let diagram = "VC\nRC"
|
|
21
21
|
let expected = [Plant.Violets; Plant.Clover; Plant.Radishes; Plant.Clover]
|
|
22
|
-
|
|
22
|
+
plants diagram student |> should equal expected
|
|
23
23
|
|
|
24
24
|
[<Fact(Skip = "Remove to run test")>]
|
|
25
25
|
let ``Partial garden - garden with two students`` () =
|
|
26
26
|
let student = "Bob"
|
|
27
27
|
let diagram = "VVCG\nVVRC"
|
|
28
28
|
let expected = [Plant.Clover; Plant.Grass; Plant.Radishes; Plant.Clover]
|
|
29
|
-
|
|
29
|
+
plants diagram student |> should equal expected
|
|
30
30
|
|
|
31
31
|
[<Fact(Skip = "Remove to run test")>]
|
|
32
32
|
let ``Partial garden - multiple students for the same garden with three students - second student's garden`` () =
|
|
33
33
|
let student = "Bob"
|
|
34
34
|
let diagram = "VVCCGG\nVVCCGG"
|
|
35
35
|
let expected = [Plant.Clover; Plant.Clover; Plant.Clover; Plant.Clover]
|
|
36
|
-
|
|
36
|
+
plants diagram student |> should equal expected
|
|
37
37
|
|
|
38
38
|
[<Fact(Skip = "Remove to run test")>]
|
|
39
39
|
let ``Partial garden - multiple students for the same garden with three students - third student's garden`` () =
|
|
40
40
|
let student = "Charlie"
|
|
41
41
|
let diagram = "VVCCGG\nVVCCGG"
|
|
42
42
|
let expected = [Plant.Grass; Plant.Grass; Plant.Grass; Plant.Grass]
|
|
43
|
-
|
|
43
|
+
plants diagram student |> should equal expected
|
|
44
44
|
|
|
45
45
|
[<Fact(Skip = "Remove to run test")>]
|
|
46
46
|
let ``Full garden - first student's garden`` () =
|
|
47
47
|
let student = "Alice"
|
|
48
48
|
let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV"
|
|
49
49
|
let expected = [Plant.Violets; Plant.Radishes; Plant.Violets; Plant.Radishes]
|
|
50
|
-
|
|
50
|
+
plants diagram student |> should equal expected
|
|
51
51
|
|
|
52
52
|
[<Fact(Skip = "Remove to run test")>]
|
|
53
53
|
let ``Full garden - second student's garden`` () =
|
|
54
54
|
let student = "Bob"
|
|
55
55
|
let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV"
|
|
56
56
|
let expected = [Plant.Clover; Plant.Grass; Plant.Clover; Plant.Clover]
|
|
57
|
-
|
|
57
|
+
plants diagram student |> should equal expected
|
|
58
58
|
|
|
59
59
|
[<Fact(Skip = "Remove to run test")>]
|
|
60
60
|
let ``Full garden - second to last student's garden`` () =
|
|
61
61
|
let student = "Kincaid"
|
|
62
62
|
let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV"
|
|
63
63
|
let expected = [Plant.Grass; Plant.Clover; Plant.Clover; Plant.Grass]
|
|
64
|
-
|
|
64
|
+
plants diagram student |> should equal expected
|
|
65
65
|
|
|
66
66
|
[<Fact(Skip = "Remove to run test")>]
|
|
67
67
|
let ``Full garden - last student's garden`` () =
|
|
68
68
|
let student = "Larry"
|
|
69
69
|
let diagram = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV"
|
|
70
70
|
let expected = [Plant.Grass; Plant.Violets; Plant.Clover; Plant.Violets]
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
[<Fact(Skip = "Remove to run test")>]
|
|
74
|
-
let ``Non-alphabetical student list - first student's garden`` () =
|
|
75
|
-
let student = "Patricia"
|
|
76
|
-
let students = ["Samantha"; "Patricia"; "Xander"; "Roger"]
|
|
77
|
-
let diagram = "VCRRGVRG\nRVGCCGCV"
|
|
78
|
-
let expected = [Plant.Violets; Plant.Clover; Plant.Radishes; Plant.Violets]
|
|
79
|
-
plantsForCustomStudents diagram student students |> should equal expected
|
|
80
|
-
|
|
81
|
-
[<Fact(Skip = "Remove to run test")>]
|
|
82
|
-
let ``Non-alphabetical student list - second student's garden`` () =
|
|
83
|
-
let student = "Roger"
|
|
84
|
-
let students = ["Samantha"; "Patricia"; "Xander"; "Roger"]
|
|
85
|
-
let diagram = "VCRRGVRG\nRVGCCGCV"
|
|
86
|
-
let expected = [Plant.Radishes; Plant.Radishes; Plant.Grass; Plant.Clover]
|
|
87
|
-
plantsForCustomStudents diagram student students |> should equal expected
|
|
88
|
-
|
|
89
|
-
[<Fact(Skip = "Remove to run test")>]
|
|
90
|
-
let ``Non-alphabetical student list - third student's garden`` () =
|
|
91
|
-
let student = "Samantha"
|
|
92
|
-
let students = ["Samantha"; "Patricia"; "Xander"; "Roger"]
|
|
93
|
-
let diagram = "VCRRGVRG\nRVGCCGCV"
|
|
94
|
-
let expected = [Plant.Grass; Plant.Violets; Plant.Clover; Plant.Grass]
|
|
95
|
-
plantsForCustomStudents diagram student students |> should equal expected
|
|
96
|
-
|
|
97
|
-
[<Fact(Skip = "Remove to run test")>]
|
|
98
|
-
let ``Non-alphabetical student list - fourth (last) student's garden`` () =
|
|
99
|
-
let student = "Xander"
|
|
100
|
-
let students = ["Samantha"; "Patricia"; "Xander"; "Roger"]
|
|
101
|
-
let diagram = "VCRRGVRG\nRVGCCGCV"
|
|
102
|
-
let expected = [Plant.Radishes; Plant.Grass; Plant.Clover; Plant.Violets]
|
|
103
|
-
plantsForCustomStudents diagram student students |> should equal expected
|
|
71
|
+
plants diagram student |> should equal expected
|
|
104
72
|
|
|
@@ -9,49 +9,49 @@ open PhoneNumber
|
|
|
9
9
|
|
|
10
10
|
[<Fact>]
|
|
11
11
|
let ``Cleans the number`` () =
|
|
12
|
-
clean "(223) 456-7890" |> should equal
|
|
12
|
+
clean "(223) 456-7890" |> should equal (Some "2234567890")
|
|
13
13
|
|
|
14
14
|
[<Fact(Skip = "Remove to run test")>]
|
|
15
15
|
let ``Cleans numbers with dots`` () =
|
|
16
|
-
clean "223.456.7890" |> should equal
|
|
16
|
+
clean "223.456.7890" |> should equal (Some "2234567890")
|
|
17
17
|
|
|
18
18
|
[<Fact(Skip = "Remove to run test")>]
|
|
19
19
|
let ``Cleans numbers with multiple spaces`` () =
|
|
20
|
-
clean "223 456 7890 " |> should equal
|
|
20
|
+
clean "223 456 7890 " |> should equal (Some "2234567890")
|
|
21
21
|
|
|
22
22
|
[<Fact(Skip = "Remove to run test")>]
|
|
23
23
|
let ``Invalid when 9 digits`` () =
|
|
24
|
-
clean "123456789" |> should equal
|
|
24
|
+
clean "123456789" |> should equal None
|
|
25
25
|
|
|
26
26
|
[<Fact(Skip = "Remove to run test")>]
|
|
27
27
|
let ``Invalid when 11 digits does not start with a 1`` () =
|
|
28
|
-
clean "22234567890" |> should equal
|
|
28
|
+
clean "22234567890" |> should equal None
|
|
29
29
|
|
|
30
30
|
[<Fact(Skip = "Remove to run test")>]
|
|
31
31
|
let ``Valid when 11 digits and starting with 1`` () =
|
|
32
|
-
clean "12234567890" |> should equal
|
|
32
|
+
clean "12234567890" |> should equal (Some "2234567890")
|
|
33
33
|
|
|
34
34
|
[<Fact(Skip = "Remove to run test")>]
|
|
35
35
|
let ``Valid when 11 digits and starting with 1 even with punctuation`` () =
|
|
36
|
-
clean "+1 (223) 456-7890" |> should equal
|
|
36
|
+
clean "+1 (223) 456-7890" |> should equal (Some "2234567890")
|
|
37
37
|
|
|
38
38
|
[<Fact(Skip = "Remove to run test")>]
|
|
39
39
|
let ``Invalid when more than 11 digits`` () =
|
|
40
|
-
clean "321234567890" |> should equal
|
|
40
|
+
clean "321234567890" |> should equal None
|
|
41
41
|
|
|
42
42
|
[<Fact(Skip = "Remove to run test")>]
|
|
43
43
|
let ``Invalid with letters`` () =
|
|
44
|
-
clean "123-abc-7890" |> should equal
|
|
44
|
+
clean "123-abc-7890" |> should equal None
|
|
45
45
|
|
|
46
46
|
[<Fact(Skip = "Remove to run test")>]
|
|
47
47
|
let ``Invalid with punctuations`` () =
|
|
48
|
-
clean "123-@:!-7890" |> should equal
|
|
48
|
+
clean "123-@:!-7890" |> should equal None
|
|
49
49
|
|
|
50
50
|
[<Fact(Skip = "Remove to run test")>]
|
|
51
51
|
let ``Invalid if area code does not start with 2-9`` () =
|
|
52
|
-
clean "(123) 456-7890" |> should equal
|
|
52
|
+
clean "(123) 456-7890" |> should equal None
|
|
53
53
|
|
|
54
54
|
[<Fact(Skip = "Remove to run test")>]
|
|
55
55
|
let ``Invalid if exchange code does not start with 2-9`` () =
|
|
56
|
-
clean "(223) 056-7890" |> should equal
|
|
56
|
+
clean "(223) 056-7890" |> should equal None
|
|
57
57
|
|
|
@@ -9,33 +9,33 @@ open RnaTranscription
|
|
|
9
9
|
|
|
10
10
|
[<Fact>]
|
|
11
11
|
let ``RNA complement of cytosine is guanine`` () =
|
|
12
|
-
toRna "C" |> should equal
|
|
12
|
+
toRna "C" |> should equal (Some "G")
|
|
13
13
|
|
|
14
14
|
[<Fact(Skip = "Remove to run test")>]
|
|
15
15
|
let ``RNA complement of guanine is cytosine`` () =
|
|
16
|
-
toRna "G" |> should equal
|
|
16
|
+
toRna "G" |> should equal (Some "C")
|
|
17
17
|
|
|
18
18
|
[<Fact(Skip = "Remove to run test")>]
|
|
19
19
|
let ``RNA complement of thymine is adenine`` () =
|
|
20
|
-
toRna "T" |> should equal
|
|
20
|
+
toRna "T" |> should equal (Some "A")
|
|
21
21
|
|
|
22
22
|
[<Fact(Skip = "Remove to run test")>]
|
|
23
23
|
let ``RNA complement of adenine is uracil`` () =
|
|
24
|
-
toRna "A" |> should equal
|
|
24
|
+
toRna "A" |> should equal (Some "U")
|
|
25
25
|
|
|
26
26
|
[<Fact(Skip = "Remove to run test")>]
|
|
27
27
|
let ``RNA complement`` () =
|
|
28
|
-
toRna "ACGTGGTCTTAA" |> should equal
|
|
28
|
+
toRna "ACGTGGTCTTAA" |> should equal (Some "UGCACCAGAAUU")
|
|
29
29
|
|
|
30
30
|
[<Fact(Skip = "Remove to run test")>]
|
|
31
31
|
let ``Correctly handles invalid input (RNA instead of DNA)`` () =
|
|
32
|
-
toRna "U" |> should equal
|
|
32
|
+
toRna "U" |> should equal None
|
|
33
33
|
|
|
34
34
|
[<Fact(Skip = "Remove to run test")>]
|
|
35
35
|
let ``Correctly handles completely invalid DNA input`` () =
|
|
36
|
-
toRna "XXX" |> should equal
|
|
36
|
+
toRna "XXX" |> should equal None
|
|
37
37
|
|
|
38
38
|
[<Fact(Skip = "Remove to run test")>]
|
|
39
39
|
let ``Correctly handles partially invalid DNA input`` () =
|
|
40
|
-
toRna "ACGTXXXCTTAA" |> should equal
|
|
40
|
+
toRna "ACGTXXXCTTAA" |> should equal None
|
|
41
41
|
|
|
@@ -1,44 +1,147 @@
|
|
|
1
|
+
// This file was auto-generated based on version 2.0.0 of the canonical data.
|
|
2
|
+
|
|
1
3
|
module RobotSimulatorTest
|
|
2
4
|
|
|
3
|
-
open Xunit
|
|
4
5
|
open FsUnit.Xunit
|
|
6
|
+
open Xunit
|
|
5
7
|
|
|
6
8
|
open RobotSimulator
|
|
7
9
|
|
|
8
10
|
[<Fact>]
|
|
9
|
-
let ``
|
|
10
|
-
let robot = createRobot
|
|
11
|
-
let
|
|
12
|
-
|
|
11
|
+
let ``create - Robots are created with a position and direction`` () =
|
|
12
|
+
let robot = createRobot North (0, 0)
|
|
13
|
+
let expected = createRobot North (0, 0)
|
|
14
|
+
robot |> should equal expected
|
|
15
|
+
|
|
16
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
17
|
+
let ``create - Negative positions are allowed`` () =
|
|
18
|
+
let robot = createRobot South (-1, -1)
|
|
19
|
+
let expected = createRobot South (-1, -1)
|
|
20
|
+
robot |> should equal expected
|
|
21
|
+
|
|
22
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
23
|
+
let ``turnRight - Does not change the position`` () =
|
|
24
|
+
let robot = createRobot North (0, 0)
|
|
25
|
+
let actual = turnRight robot
|
|
26
|
+
let expected = (0, 0)
|
|
27
|
+
actual.coordinate |> should equal expected
|
|
28
|
+
|
|
29
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
30
|
+
let ``turnRight - Changes the direction from north to east`` () =
|
|
31
|
+
let robot = createRobot North (0, 0)
|
|
32
|
+
let actual = turnRight robot
|
|
33
|
+
let expected = East
|
|
34
|
+
actual.bearing |> should equal expected
|
|
35
|
+
|
|
36
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
37
|
+
let ``turnRight - Changes the direction from east to south`` () =
|
|
38
|
+
let robot = createRobot East (0, 0)
|
|
39
|
+
let actual = turnRight robot
|
|
40
|
+
let expected = South
|
|
41
|
+
actual.bearing |> should equal expected
|
|
42
|
+
|
|
43
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
44
|
+
let ``turnRight - Changes the direction from south to west`` () =
|
|
45
|
+
let robot = createRobot South (0, 0)
|
|
46
|
+
let actual = turnRight robot
|
|
47
|
+
let expected = West
|
|
48
|
+
actual.bearing |> should equal expected
|
|
49
|
+
|
|
50
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
51
|
+
let ``turnRight - Changes the direction from west to north`` () =
|
|
52
|
+
let robot = createRobot West (0, 0)
|
|
53
|
+
let actual = turnRight robot
|
|
54
|
+
let expected = North
|
|
55
|
+
actual.bearing |> should equal expected
|
|
13
56
|
|
|
14
57
|
[<Fact(Skip = "Remove to run test")>]
|
|
15
|
-
let ``
|
|
16
|
-
let robot = createRobot
|
|
17
|
-
let
|
|
18
|
-
|
|
58
|
+
let ``turnLeft - Does not change the position`` () =
|
|
59
|
+
let robot = createRobot North (0, 0)
|
|
60
|
+
let actual = turnLeft robot
|
|
61
|
+
let expected = (0, 0)
|
|
62
|
+
actual.coordinate |> should equal expected
|
|
19
63
|
|
|
20
64
|
[<Fact(Skip = "Remove to run test")>]
|
|
21
|
-
let ``
|
|
22
|
-
let
|
|
23
|
-
|
|
65
|
+
let ``turnLeft - Changes the direction from north to west`` () =
|
|
66
|
+
let robot = createRobot North (0, 0)
|
|
67
|
+
let actual = turnLeft robot
|
|
68
|
+
let expected = West
|
|
69
|
+
actual.bearing |> should equal expected
|
|
24
70
|
|
|
25
|
-
|
|
26
|
-
|
|
71
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
72
|
+
let ``turnLeft - Changes the direction from west to south`` () =
|
|
73
|
+
let robot = createRobot West (0, 0)
|
|
74
|
+
let actual = turnLeft robot
|
|
75
|
+
let expected = South
|
|
76
|
+
actual.bearing |> should equal expected
|
|
27
77
|
|
|
28
78
|
[<Fact(Skip = "Remove to run test")>]
|
|
29
|
-
let ``
|
|
30
|
-
let
|
|
31
|
-
let
|
|
32
|
-
|
|
79
|
+
let ``turnLeft - Changes the direction from south to east`` () =
|
|
80
|
+
let robot = createRobot South (0, 0)
|
|
81
|
+
let actual = turnLeft robot
|
|
82
|
+
let expected = East
|
|
83
|
+
actual.bearing |> should equal expected
|
|
33
84
|
|
|
34
85
|
[<Fact(Skip = "Remove to run test")>]
|
|
35
|
-
let ``
|
|
36
|
-
let
|
|
37
|
-
let
|
|
38
|
-
|
|
86
|
+
let ``turnLeft - Changes the direction from east to north`` () =
|
|
87
|
+
let robot = createRobot East (0, 0)
|
|
88
|
+
let actual = turnLeft robot
|
|
89
|
+
let expected = North
|
|
90
|
+
actual.bearing |> should equal expected
|
|
39
91
|
|
|
40
92
|
[<Fact(Skip = "Remove to run test")>]
|
|
41
|
-
let ``
|
|
42
|
-
let
|
|
43
|
-
let
|
|
44
|
-
|
|
93
|
+
let ``advance - Does not change the direction`` () =
|
|
94
|
+
let robot = createRobot North (0, 0)
|
|
95
|
+
let actual = advance robot
|
|
96
|
+
let expected = North
|
|
97
|
+
actual.bearing |> should equal expected
|
|
98
|
+
|
|
99
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
100
|
+
let ``advance - Increases the y coordinate one when facing north`` () =
|
|
101
|
+
let robot = createRobot North (0, 0)
|
|
102
|
+
let actual = advance robot
|
|
103
|
+
let expected = (0, 1)
|
|
104
|
+
actual.coordinate |> should equal expected
|
|
105
|
+
|
|
106
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
107
|
+
let ``advance - Decreases the y coordinate by one when facing south`` () =
|
|
108
|
+
let robot = createRobot South (0, 0)
|
|
109
|
+
let actual = advance robot
|
|
110
|
+
let expected = (0, -1)
|
|
111
|
+
actual.coordinate |> should equal expected
|
|
112
|
+
|
|
113
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
114
|
+
let ``advance - Increases the x coordinate by one when facing east`` () =
|
|
115
|
+
let robot = createRobot East (0, 0)
|
|
116
|
+
let actual = advance robot
|
|
117
|
+
let expected = (1, 0)
|
|
118
|
+
actual.coordinate |> should equal expected
|
|
119
|
+
|
|
120
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
121
|
+
let ``advance - Decreases the x coordinate by one when facing west`` () =
|
|
122
|
+
let robot = createRobot West (0, 0)
|
|
123
|
+
let actual = advance robot
|
|
124
|
+
let expected = (-1, 0)
|
|
125
|
+
actual.coordinate |> should equal expected
|
|
126
|
+
|
|
127
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
128
|
+
let ``instructions - Instructions to move west and north`` () =
|
|
129
|
+
let robot = createRobot North (0, 0)
|
|
130
|
+
let actual = simulate robot "LAAARALA"
|
|
131
|
+
let expected = createRobot West (-4, 1)
|
|
132
|
+
actual |> should equal expected
|
|
133
|
+
|
|
134
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
135
|
+
let ``instructions - Instructions to move west and south`` () =
|
|
136
|
+
let robot = createRobot East (2, -7)
|
|
137
|
+
let actual = simulate robot "RRAAAAALA"
|
|
138
|
+
let expected = createRobot South (-3, -8)
|
|
139
|
+
actual |> should equal expected
|
|
140
|
+
|
|
141
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
142
|
+
let ``instructions - Instructions to move east and north`` () =
|
|
143
|
+
let robot = createRobot South (8, 4)
|
|
144
|
+
let actual = simulate robot "LAAARRRALLLL"
|
|
145
|
+
let expected = createRobot North (11, 5)
|
|
146
|
+
actual |> should equal expected
|
|
147
|
+
|