trackler 2.0.0.1 → 2.0.0.2
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/bin/bump-content +3 -1
- data/bin/verify-metadata +2 -2
- data/common/exercises/alphametics/canonical-data.json +19 -9
- data/common/exercises/food-chain/canonical-data.json +7 -1
- data/common/exercises/grains/canonical-data.json +66 -0
- data/common/exercises/raindrops/description.md +4 -5
- data/common/exercises/triangle/canonical-data.json +81 -54
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/config.json +26 -19
- data/tracks/c/exercises/allergies/makefile +15 -0
- data/tracks/c/exercises/allergies/src/allergies.h +21 -0
- data/tracks/c/exercises/allergies/src/example.c +32 -0
- data/tracks/c/exercises/allergies/src/example.h +26 -0
- data/tracks/c/exercises/allergies/test/test_allergies.c +203 -0
- data/tracks/c/exercises/allergies/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/allergies/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/allergies/test/vendor/unity_internals.h +701 -0
- data/tracks/c/exercises/atbash-cipher/makefile +16 -0
- data/tracks/c/exercises/atbash-cipher/src/example.c +71 -0
- data/tracks/c/exercises/atbash-cipher/src/example.h +7 -0
- data/tracks/c/exercises/atbash-cipher/test/test_atbash_cipher.c +113 -0
- data/tracks/c/exercises/atbash-cipher/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/atbash-cipher/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/atbash-cipher/test/vendor/unity_internals.h +701 -0
- data/tracks/c/exercises/phone-number/makefile +16 -0
- data/tracks/c/exercises/phone-number/src/example.c +66 -0
- data/tracks/c/exercises/phone-number/src/example.h +8 -0
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +108 -0
- data/tracks/c/exercises/phone-number/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/phone-number/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/phone-number/test/vendor/unity_internals.h +701 -0
- data/tracks/csharp/config.json +8 -0
- data/tracks/csharp/exercises/bowling/BowlingTest.cs +188 -33
- data/tracks/csharp/exercises/bowling/Example.cs +38 -9
- data/tracks/csharp/exercises/rectangles/Example.cs +91 -0
- data/tracks/csharp/exercises/rectangles/RectanglesTest.cs +133 -0
- data/tracks/elisp/docs/INSTALLATION.org +1 -1
- data/tracks/elixir/config.json +8 -66
- data/tracks/elixir/docs/LEARNING.md +1 -1
- data/tracks/elixir/exercises/diamond/diamond_test.exs +12 -12
- data/tracks/elixir/exercises/grep/example.exs +92 -0
- data/tracks/elixir/exercises/grep/grep.exs +6 -0
- data/tracks/elixir/exercises/grep/grep_test.exs +259 -0
- data/tracks/elixir/exercises/markdown/markdown.exs +59 -2
- data/tracks/elixir/exercises/nucleotide-count/nucleotide_count_test.exs +4 -4
- data/tracks/elixir/exercises/phone-number/phone_number_test.exs +5 -0
- data/tracks/fsharp/exercises/bowling/BowlingTest.fs +158 -43
- data/tracks/fsharp/exercises/bowling/Example.fs +53 -24
- data/tracks/go/config.json +5 -0
- data/tracks/go/exercises/diamond/diamond_test.go +227 -0
- data/tracks/go/exercises/diamond/example.go +47 -0
- data/tracks/go/exercises/food-chain/example.go +1 -1
- data/tracks/go/exercises/food-chain/food_chain_test.go +30 -6
- data/tracks/go/exercises/nucleotide-count/example.go +21 -8
- data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +45 -37
- data/tracks/haskell/exercises/anagram/test/Tests.hs +1 -11
- data/tracks/java/bin/journey-test.sh +165 -128
- data/tracks/java/docs/ABOUT.md +5 -8
- data/tracks/java/exercises/hello-world/build.gradle +0 -6
- data/tracks/java/exercises/hello-world/src/test/java/HelloWorldTest.java +0 -1
- data/tracks/java/exercises/meetup/build.gradle +0 -1
- data/tracks/java/exercises/meetup/src/example/java/Meetup.java +9 -7
- data/tracks/java/exercises/meetup/src/test/java/MeetupTest.java +185 -188
- data/tracks/lua/config.json +0 -73
- data/tracks/lua/exercises/bowling/bowling_spec.lua +92 -48
- data/tracks/lua/exercises/bowling/example.lua +4 -1
- data/tracks/objective-c/config.json +9 -30
- data/tracks/objective-c/exercises/pangram/PangramExample.h +7 -0
- data/tracks/objective-c/exercises/pangram/PangramExample.m +21 -0
- data/tracks/objective-c/exercises/pangram/PangramTest.m +51 -0
- data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +18 -0
- data/tracks/ocaml/README.md +46 -1
- data/tracks/ocaml/SETUP.md +21 -2
- data/tracks/ocaml/config.json +48 -78
- data/tracks/perl5/README.md +15 -8
- data/tracks/perl5/testall.pl +5 -5
- data/tracks/php/config.json +26 -34
- data/tracks/php/docs/ABOUT.md +15 -0
- data/tracks/php/exercises/allergies/allergies_test.php +121 -0
- data/tracks/php/exercises/allergies/example.php +64 -0
- data/tracks/php/exercises/etl/etl_test.php +52 -0
- data/tracks/php/exercises/etl/example.php +12 -0
- data/tracks/php/exercises/nucleotide-count/example.php +25 -0
- data/tracks/php/exercises/nucleotide-count/nucleotide-count_test.php +36 -0
- data/tracks/php/exercises/pig-latin/example.php +25 -29
- data/tracks/php/exercises/pig-latin/pig-latin_test.php +26 -19
- data/tracks/php/exercises/space-age/example.php +65 -0
- data/tracks/php/exercises/space-age/space-age_test.php +70 -0
- data/tracks/php/exercises/triangle/example.php +43 -0
- data/tracks/php/exercises/triangle/triangle_test.php +140 -0
- data/tracks/pony/exercises/anagram/example.pony +6 -6
- data/tracks/pony/exercises/anagram/test.pony +3 -4
- data/tracks/pony/exercises/bob/test.pony +23 -23
- data/tracks/pony/exercises/difference-of-squares/test.pony +11 -11
- data/tracks/pony/exercises/hamming/example.pony +3 -3
- data/tracks/pony/exercises/hamming/test.pony +16 -16
- data/tracks/pony/exercises/hello-world/test.pony +5 -4
- data/tracks/pony/exercises/leap/test.pony +8 -8
- data/tracks/python/config.json +18 -0
- data/tracks/python/exercises/diamond/diamond_test.py +33 -0
- data/tracks/python/exercises/diamond/example.py +15 -0
- data/tracks/python/exercises/linked-list/example.py +47 -0
- data/tracks/python/exercises/linked-list/linked_list.py +13 -0
- data/tracks/python/exercises/linked-list/linked_list_test.py +49 -0
- data/tracks/python/exercises/list-ops/example.py +55 -0
- data/tracks/python/exercises/list-ops/list_ops.py +38 -0
- data/tracks/python/exercises/list-ops/list_ops_test.py +136 -0
- data/tracks/ruby/bin/generate +22 -2
- data/tracks/ruby/config.json +12 -83
- data/tracks/ruby/exercises/allergies/allergies_test.rb +0 -1
- data/tracks/ruby/exercises/atbash-cipher/atbash_cipher_test.rb +0 -1
- data/tracks/ruby/exercises/beer-song/beer_song_test.rb +1 -2
- data/tracks/ruby/exercises/binary/example.rb +0 -1
- data/tracks/ruby/exercises/binary-search-tree/binary_search_tree_test.rb +1 -1
- data/tracks/ruby/exercises/bowling/.version +1 -0
- data/tracks/ruby/exercises/bowling/bowling_test.rb +109 -133
- data/tracks/ruby/exercises/bowling/example.rb +7 -7
- data/tracks/ruby/exercises/bowling/example.tt +27 -0
- data/tracks/ruby/exercises/circular-buffer/circular_buffer_test.rb +0 -2
- data/tracks/ruby/exercises/clock/example.rb +0 -2
- data/tracks/ruby/exercises/connect/connect_test.rb +0 -1
- data/tracks/ruby/exercises/custom-set/custom_set_test.rb +0 -1
- data/tracks/ruby/exercises/diamond/diamond_test.rb +0 -1
- data/tracks/ruby/exercises/etl/etl_test.rb +1 -1
- data/tracks/ruby/exercises/house/house_test.rb +0 -1
- data/tracks/ruby/exercises/isogram/isogram_test.rb +2 -2
- data/tracks/ruby/exercises/largest-series-product/example.tt +0 -3
- data/tracks/ruby/exercises/largest-series-product/largest_series_product_test.rb +0 -4
- data/tracks/ruby/exercises/linked-list/linked_list_test.rb +1 -1
- data/tracks/ruby/exercises/meetup/meetup_test.rb +0 -1
- data/tracks/ruby/exercises/nth-prime/example.tt +0 -2
- data/tracks/ruby/exercises/nth-prime/nth_prime_test.rb +0 -2
- data/tracks/ruby/exercises/ocr-numbers/ocr_numbers_test.rb +1 -2
- data/tracks/ruby/exercises/protein-translation/protein_translation_test.rb +0 -1
- data/tracks/ruby/exercises/proverb/proverb_test.rb +1 -3
- data/tracks/ruby/exercises/queen-attack/example.rb +3 -1
- data/tracks/ruby/exercises/queen-attack/queen_attack_test.rb +34 -8
- data/tracks/ruby/exercises/robot-simulator/robot_simulator_test.rb +1 -1
- data/tracks/ruby/exercises/strain/strain_test.rb +2 -2
- data/tracks/ruby/exercises/tournament/.version +1 -0
- data/tracks/ruby/exercises/tournament/example.rb +54 -0
- data/tracks/ruby/exercises/tournament/example.tt +23 -0
- data/tracks/ruby/exercises/tournament/tournament_test.rb +92 -0
- data/tracks/ruby/exercises/transpose/.version +1 -0
- data/tracks/ruby/exercises/transpose/example.rb +14 -0
- data/tracks/ruby/exercises/transpose/example.tt +22 -0
- data/tracks/ruby/exercises/transpose/transpose_test.rb +303 -0
- data/tracks/ruby/lib/bowling_cases.rb +46 -0
- data/tracks/ruby/lib/isogram_cases.rb +1 -1
- data/tracks/ruby/lib/tournament_cases.rb +45 -0
- data/tracks/ruby/lib/transpose_cases.rb +45 -0
- data/tracks/rust/config.json +2 -0
- data/tracks/rust/exercises/bowling/.gitignore +7 -0
- data/tracks/rust/exercises/bowling/Cargo.toml +3 -0
- data/tracks/rust/exercises/bowling/example.rs +134 -0
- data/tracks/rust/exercises/bowling/tests/bowling.rs +373 -0
- data/tracks/rust/exercises/grains/.gitignore +7 -0
- data/tracks/rust/exercises/grains/Cargo.toml +3 -0
- data/tracks/rust/exercises/grains/example.rs +11 -0
- data/tracks/rust/exercises/grains/src/lib.rs +7 -0
- data/tracks/rust/exercises/grains/tests/grains.rs +63 -0
- data/tracks/rust/problems.md +2 -0
- data/tracks/scala/README.md +38 -0
- data/tracks/scala/config.json +20 -74
- data/tracks/scala/exercises/accumulate/src/test/scala/accumulate_test.scala +4 -0
- data/tracks/scala/exercises/allergies/src/test/scala/allergies_test.scala +11 -0
- data/tracks/scala/exercises/alphametics/build.sbt +6 -0
- data/tracks/scala/exercises/alphametics/example.scala +125 -0
- data/tracks/scala/exercises/alphametics/src/main/scala/.keep +0 -0
- data/tracks/scala/exercises/alphametics/src/test/scala/AlphameticsTest.scala +62 -0
- data/tracks/scala/exercises/atbash-cipher/src/test/scala/atbash_test.scala +8 -0
- data/tracks/scala/exercises/bank-account/src/test/scala/BankAccountTest.scala +4 -0
- data/tracks/scala/exercises/binary/src/test/scala/binary_test.scala +13 -0
- data/tracks/scala/exercises/binary-search-tree/src/test/scala/BstTest.scala +11 -0
- data/tracks/scala/exercises/bowling/Example.scala +116 -0
- data/tracks/scala/exercises/bowling/build.sbt +3 -0
- data/tracks/scala/exercises/bowling/src/main/scala/Bowling.scala +11 -0
- data/tracks/scala/exercises/bowling/src/test/scala/BowlingSuite.scala +237 -0
- data/tracks/scala/exercises/clock/src/test/scala/ClockTest.scala +50 -0
- data/tracks/scala/exercises/connect/README.md +17 -0
- data/tracks/scala/exercises/connect/src/test/scala/ConnectTest.scala +7 -0
- data/tracks/scala/exercises/crypto-square/src/test/scala/{CrytpoSquareTest.scala → CryptoSquareTest.scala} +9 -0
- data/tracks/scala/exercises/custom-set/src/test/scala/CustomSetTest.scala +36 -0
- data/tracks/scala/exercises/difference-of-squares/src/test/scala/squares_test.scala +8 -0
- data/tracks/scala/exercises/forth/src/test/scala/ForthTest.scala +22 -0
- data/tracks/scala/exercises/hexadecimal/src/test/scala/HexadecimalTest.scala +8 -0
- data/tracks/scala/exercises/kindergarten-garden/src/test/scala/GardenTest.scala +5 -0
- data/tracks/scala/exercises/largest-series-product/src/test/scala/SeriesTest.scala +2 -0
- data/tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala +4 -0
- data/tracks/scala/exercises/luhn/src/test/scala/LuhnTest.scala +4 -0
- data/tracks/scala/exercises/matrix/src/test/scala/MatrixTest.scala +2 -0
- data/tracks/scala/exercises/minesweeper/src/test/scala/MinesweeperTest.scala +6 -0
- data/tracks/scala/exercises/nth-prime/src/test/scala/PrimeTest.scala +5 -0
- data/tracks/scala/exercises/ocr-numbers/src/test/scala/OcrTest.scala +15 -0
- data/tracks/scala/exercises/octal/src/test/scala/OctalTest.scala +7 -0
- data/tracks/scala/exercises/parallel-letter-frequency/src/test/scala/FrequencyTest.scala +8 -0
- data/tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala +5 -0
- data/tracks/scala/exercises/pig-latin/src/test/scala/PigLatinTest.scala +4 -0
- data/tracks/scala/exercises/pythagorean-triplet/src/test/scala/PythagoreanTripletTest.scala +3 -0
- data/tracks/scala/exercises/queen-attack/src/test/scala/QueensTest.scala +5 -0
- data/tracks/scala/exercises/robot-simulator/src/test/scala/RobotTest.scala +16 -8
- data/tracks/scala/exercises/say/src/test/scala/SayTest.scala +34 -17
- data/tracks/scala/exercises/scrabble-score/src/test/scala/scrabble_score_test.scala +6 -0
- data/tracks/scala/exercises/secret-handshake/src/test/scala/SecretHandshakeTest.scala +18 -9
- data/tracks/scala/exercises/series/src/test/scala/SeriesTest.scala +4 -2
- data/tracks/scala/exercises/sieve/src/test/scala/SieveTest.scala +8 -4
- data/tracks/scala/exercises/simple-cipher/src/test/scala/CipherTest.scala +17 -9
- data/tracks/scala/exercises/sublist/src/test/scala/sublist_test.scala +17 -0
- data/tracks/scala/exercises/trinary/src/test/scala/TrinaryTest.scala +14 -7
- data/tracks/scala/exercises/wordy/src/test/scala/WordProblemTest.scala +28 -14
- data/tracks/scala/project/Build.scala +3 -3
- data/tracks/scala/testgen/src/main/scala/BowlingTestGenerator.scala +57 -0
- data/tracks/sml/config.json +41 -6
- data/tracks/sml/exercises/flatten-array/example.sml +6 -0
- data/tracks/sml/exercises/flatten-array/test_flatten_array.sml +10 -0
- data/tracks/sml/exercises/nth-prime/example.sml +46 -0
- data/tracks/sml/exercises/nth-prime/test_nth_prime.sml +14 -0
- data/tracks/sml/exercises/raindrops/example.sml +9 -0
- data/tracks/sml/exercises/raindrops/raindrops.sml +2 -0
- data/tracks/sml/exercises/raindrops/test_raindrops.sml +95 -0
- data/tracks/swift/config.json +269 -328
- data/tracks/swift/exercises/pangram/PangramExample.swift +17 -0
- data/tracks/swift/exercises/pangram/PangramTest.swift +43 -0
- data/tracks/swift/xcodeProject/xSwift.xcodeproj/project.pbxproj +16 -0
- metadata +95 -3
|
@@ -8,58 +8,68 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
test("sets with elements are not empty") {
|
|
11
|
+
pending
|
|
11
12
|
val set = CustomSet.fromList(List(1))
|
|
12
13
|
CustomSet.empty(set) should be (false)
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
// Contains test cases - Sets can report if they contain an element
|
|
16
17
|
test("nothing is contained in an empty set") {
|
|
18
|
+
pending
|
|
17
19
|
val set = CustomSet.fromList(List())
|
|
18
20
|
CustomSet.member(set, 1) should be (false)
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
test("when the element is in the set") {
|
|
24
|
+
pending
|
|
22
25
|
val set = CustomSet.fromList(List(1, 2, 3))
|
|
23
26
|
CustomSet.member(set, 1) should be (true)
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
test("when the element is not in the set") {
|
|
30
|
+
pending
|
|
27
31
|
val set = CustomSet.fromList(List(1, 2, 3))
|
|
28
32
|
CustomSet.member(set, 4) should be (false)
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
// Subset test cases - A set is a subset if all of its elements are contained in the other set
|
|
32
36
|
test("empty set is a subset of another empty set") {
|
|
37
|
+
pending
|
|
33
38
|
val set1 = CustomSet.fromList(List())
|
|
34
39
|
val set2 = CustomSet.fromList(List())
|
|
35
40
|
CustomSet.isSubsetOf(set1, set2) should be (true)
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
test("empty set is a subset of non-empty set") {
|
|
44
|
+
pending
|
|
39
45
|
val set1 = CustomSet.fromList(List())
|
|
40
46
|
val set2 = CustomSet.fromList(List(1))
|
|
41
47
|
CustomSet.isSubsetOf(set1, set2) should be (true)
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
test("non-empty set is not a subset of empty set") {
|
|
51
|
+
pending
|
|
45
52
|
val set1 = CustomSet.fromList(List(1))
|
|
46
53
|
val set2 = CustomSet.fromList(List())
|
|
47
54
|
CustomSet.isSubsetOf(set1, set2) should be (false)
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
test("set is a subset of set with exact same elements") {
|
|
58
|
+
pending
|
|
51
59
|
val set1 = CustomSet.fromList(List(1, 2, 3))
|
|
52
60
|
val set2 = CustomSet.fromList(List(1, 2, 3))
|
|
53
61
|
CustomSet.isSubsetOf(set1, set2) should be (true)
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
test("set is a subset of larger set with same elements") {
|
|
65
|
+
pending
|
|
57
66
|
val set1 = CustomSet.fromList(List(1, 2, 3))
|
|
58
67
|
val set2 = CustomSet.fromList(List(4, 1, 2, 3))
|
|
59
68
|
CustomSet.isSubsetOf(set1, set2) should be (true)
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
test("set is not a subset of set that does not contain its elements") {
|
|
72
|
+
pending
|
|
63
73
|
val set1 = CustomSet.fromList(List(1, 2, 3))
|
|
64
74
|
val set2 = CustomSet.fromList(List(4, 1, 3))
|
|
65
75
|
CustomSet.isSubsetOf(set1, set2) should be (false)
|
|
@@ -67,30 +77,35 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
67
77
|
|
|
68
78
|
// Disjoint test cases - Sets are disjoint if they share no elements
|
|
69
79
|
test("the empty set is disjoint with itself") {
|
|
80
|
+
pending
|
|
70
81
|
val set1 = CustomSet.fromList(List())
|
|
71
82
|
val set2 = CustomSet.fromList(List())
|
|
72
83
|
CustomSet.isDisjointFrom(set1, set2) should be (true)
|
|
73
84
|
}
|
|
74
85
|
|
|
75
86
|
test("empty set is disjoint with non-empty set") {
|
|
87
|
+
pending
|
|
76
88
|
val set1 = CustomSet.fromList(List())
|
|
77
89
|
val set2 = CustomSet.fromList(List(1))
|
|
78
90
|
CustomSet.isDisjointFrom(set1, set2) should be (true)
|
|
79
91
|
}
|
|
80
92
|
|
|
81
93
|
test("non-empty set is disjoint with empty set") {
|
|
94
|
+
pending
|
|
82
95
|
val set1 = CustomSet.fromList(List(1))
|
|
83
96
|
val set2 = CustomSet.fromList(List())
|
|
84
97
|
CustomSet.isDisjointFrom(set1, set2) should be (true)
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
test("sets are not disjoint if they share an element") {
|
|
101
|
+
pending
|
|
88
102
|
val set1 = CustomSet.fromList(List(1, 2))
|
|
89
103
|
val set2 = CustomSet.fromList(List(2, 3))
|
|
90
104
|
CustomSet.isDisjointFrom(set1, set2) should be (false)
|
|
91
105
|
}
|
|
92
106
|
|
|
93
107
|
test("sets are disjoint if they share no elements") {
|
|
108
|
+
pending
|
|
94
109
|
val set1 = CustomSet.fromList(List(1, 2))
|
|
95
110
|
val set2 = CustomSet.fromList(List(3, 4))
|
|
96
111
|
CustomSet.isDisjointFrom(set1, set2) should be (true)
|
|
@@ -98,30 +113,35 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
98
113
|
|
|
99
114
|
// Equal test cases - Sets with the same elements are equal
|
|
100
115
|
test("empty sets are equal") {
|
|
116
|
+
pending
|
|
101
117
|
val set1 = CustomSet.fromList(List())
|
|
102
118
|
val set2 = CustomSet.fromList(List())
|
|
103
119
|
CustomSet.isEqual(set1, set2) should be (true)
|
|
104
120
|
}
|
|
105
121
|
|
|
106
122
|
test("empty set is not equal to non-empty set") {
|
|
123
|
+
pending
|
|
107
124
|
val set1 = CustomSet.fromList(List())
|
|
108
125
|
val set2 = CustomSet.fromList(List(1, 2, 3))
|
|
109
126
|
CustomSet.isEqual(set1, set2) should be (false)
|
|
110
127
|
}
|
|
111
128
|
|
|
112
129
|
test("non-empty set is not equal to empty set") {
|
|
130
|
+
pending
|
|
113
131
|
val set1 = CustomSet.fromList(List(1, 2, 3))
|
|
114
132
|
val set2 = CustomSet.fromList(List())
|
|
115
133
|
CustomSet.isEqual(set1, set2) should be (false)
|
|
116
134
|
}
|
|
117
135
|
|
|
118
136
|
test("sets with the same elements are equal") {
|
|
137
|
+
pending
|
|
119
138
|
val set1 = CustomSet.fromList(List(1, 2))
|
|
120
139
|
val set2 = CustomSet.fromList(List(2, 1))
|
|
121
140
|
CustomSet.isEqual(set1, set2) should be (true)
|
|
122
141
|
}
|
|
123
142
|
|
|
124
143
|
test("sets with different elements are not equal") {
|
|
144
|
+
pending
|
|
125
145
|
val set1 = CustomSet.fromList(List(1, 2, 3))
|
|
126
146
|
val set2 = CustomSet.fromList(List(1, 2, 4))
|
|
127
147
|
CustomSet.isEqual(set1, set2) should be (false)
|
|
@@ -129,18 +149,21 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
129
149
|
|
|
130
150
|
// Add test cases - Unique elements can be added to a set
|
|
131
151
|
test("add to empty set") {
|
|
152
|
+
pending
|
|
132
153
|
val set = CustomSet.fromList(List())
|
|
133
154
|
val expected = CustomSet.fromList(List(3))
|
|
134
155
|
CustomSet.isEqual(CustomSet.insert(set, 3 ), expected) should be (true)
|
|
135
156
|
}
|
|
136
157
|
|
|
137
158
|
test("add to non-empty set") {
|
|
159
|
+
pending
|
|
138
160
|
val set = CustomSet.fromList(List(1, 2, 4))
|
|
139
161
|
val expected = CustomSet.fromList(List(1, 2, 3, 4))
|
|
140
162
|
CustomSet.isEqual(CustomSet.insert(set, 3 ), expected) should be (true)
|
|
141
163
|
}
|
|
142
164
|
|
|
143
165
|
test("adding an existing element does not change the set") {
|
|
166
|
+
pending
|
|
144
167
|
val set = CustomSet.fromList(List(1, 2, 3))
|
|
145
168
|
val expected = CustomSet.fromList(List(1, 2, 3))
|
|
146
169
|
CustomSet.isEqual(CustomSet.insert(set, 3 ), expected) should be (true)
|
|
@@ -148,6 +171,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
148
171
|
|
|
149
172
|
// Intersection test cases - Intersect returns a set of all shared elements
|
|
150
173
|
test("intersection of two empty sets is an empty set") {
|
|
174
|
+
pending
|
|
151
175
|
val set1 = CustomSet.fromList(List())
|
|
152
176
|
val set2 = CustomSet.fromList(List())
|
|
153
177
|
val expected = CustomSet.fromList(List())
|
|
@@ -155,6 +179,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
155
179
|
}
|
|
156
180
|
|
|
157
181
|
test("intersection of an empty set and non-empty set is an empty set") {
|
|
182
|
+
pending
|
|
158
183
|
val set1 = CustomSet.fromList(List())
|
|
159
184
|
val set2 = CustomSet.fromList(List(3, 2, 5))
|
|
160
185
|
val expected = CustomSet.fromList(List())
|
|
@@ -162,6 +187,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
162
187
|
}
|
|
163
188
|
|
|
164
189
|
test("intersection of a non-empty set and an empty set is an empty set") {
|
|
190
|
+
pending
|
|
165
191
|
val set1 = CustomSet.fromList(List(1, 2, 3, 4))
|
|
166
192
|
val set2 = CustomSet.fromList(List())
|
|
167
193
|
val expected = CustomSet.fromList(List())
|
|
@@ -169,6 +195,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
169
195
|
}
|
|
170
196
|
|
|
171
197
|
test("intersection of two sets with no shared elements is an empty set") {
|
|
198
|
+
pending
|
|
172
199
|
val set1 = CustomSet.fromList(List(1, 2, 3))
|
|
173
200
|
val set2 = CustomSet.fromList(List(4, 5, 6))
|
|
174
201
|
val expected = CustomSet.fromList(List())
|
|
@@ -176,6 +203,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
176
203
|
}
|
|
177
204
|
|
|
178
205
|
test("intersection of two sets with shared elements is a set of the shared elements") {
|
|
206
|
+
pending
|
|
179
207
|
val set1 = CustomSet.fromList(List(1, 2, 3, 4))
|
|
180
208
|
val set2 = CustomSet.fromList(List(3, 2, 5))
|
|
181
209
|
val expected = CustomSet.fromList(List(2, 3))
|
|
@@ -184,6 +212,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
184
212
|
|
|
185
213
|
// Difference test cases - Difference (or Complement) of a set is a set of all elements that are only in the first set
|
|
186
214
|
test("difference of two empty sets is an empty set") {
|
|
215
|
+
pending
|
|
187
216
|
val set1 = CustomSet.fromList(List())
|
|
188
217
|
val set2 = CustomSet.fromList(List())
|
|
189
218
|
val expected = CustomSet.fromList(List())
|
|
@@ -191,6 +220,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
191
220
|
}
|
|
192
221
|
|
|
193
222
|
test("difference of empty set and non-empty set is an empty set") {
|
|
223
|
+
pending
|
|
194
224
|
val set1 = CustomSet.fromList(List())
|
|
195
225
|
val set2 = CustomSet.fromList(List(3, 2, 5))
|
|
196
226
|
val expected = CustomSet.fromList(List())
|
|
@@ -198,6 +228,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
198
228
|
}
|
|
199
229
|
|
|
200
230
|
test("difference of a non-empty set and an empty set is the non-empty set") {
|
|
231
|
+
pending
|
|
201
232
|
val set1 = CustomSet.fromList(List(1, 2, 3, 4))
|
|
202
233
|
val set2 = CustomSet.fromList(List())
|
|
203
234
|
val expected = CustomSet.fromList(List(1, 2, 3, 4))
|
|
@@ -205,6 +236,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
205
236
|
}
|
|
206
237
|
|
|
207
238
|
test("difference of two non-empty sets is a set of elements that are only in the first set") {
|
|
239
|
+
pending
|
|
208
240
|
val set1 = CustomSet.fromList(List(3, 2, 1))
|
|
209
241
|
val set2 = CustomSet.fromList(List(2, 4))
|
|
210
242
|
val expected = CustomSet.fromList(List(1, 3))
|
|
@@ -213,6 +245,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
213
245
|
|
|
214
246
|
// Union test cases - Union returns a set of all elements in either set
|
|
215
247
|
test("union of empty sets is an empty set") {
|
|
248
|
+
pending
|
|
216
249
|
val set1 = CustomSet.fromList(List())
|
|
217
250
|
val set2 = CustomSet.fromList(List())
|
|
218
251
|
val expected = CustomSet.fromList(List())
|
|
@@ -220,6 +253,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
220
253
|
}
|
|
221
254
|
|
|
222
255
|
test("union of an empty set and non-empty set is the non-empty set") {
|
|
256
|
+
pending
|
|
223
257
|
val set1 = CustomSet.fromList(List())
|
|
224
258
|
val set2 = CustomSet.fromList(List(2))
|
|
225
259
|
val expected = CustomSet.fromList(List(2))
|
|
@@ -227,6 +261,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
227
261
|
}
|
|
228
262
|
|
|
229
263
|
test("union of a non-empty set and empty set is the non-empty set") {
|
|
264
|
+
pending
|
|
230
265
|
val set1 = CustomSet.fromList(List(1, 3))
|
|
231
266
|
val set2 = CustomSet.fromList(List())
|
|
232
267
|
val expected = CustomSet.fromList(List(1, 3))
|
|
@@ -234,6 +269,7 @@ class CustomSetTest extends FunSuite with Matchers {
|
|
|
234
269
|
}
|
|
235
270
|
|
|
236
271
|
test("union of non-empty sets contains all unique elements") {
|
|
272
|
+
pending
|
|
237
273
|
val set1 = CustomSet.fromList(List(1, 3))
|
|
238
274
|
val set2 = CustomSet.fromList(List(2, 3))
|
|
239
275
|
val expected = CustomSet.fromList(List(3, 2, 1))
|
|
@@ -7,41 +7,49 @@ class SquaresTest extends FlatSpec with Matchers {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
it should "calc sum of squares to 5" in {
|
|
10
|
+
pending
|
|
10
11
|
val result = Squares().sumOfSquares(5)
|
|
11
12
|
result should equal (55)
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
it should "calc difference of sums to 5" in {
|
|
16
|
+
pending
|
|
15
17
|
val result = Squares().difference(5)
|
|
16
18
|
result should equal (170)
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
it should "calc square of sums to 10" in {
|
|
22
|
+
pending
|
|
20
23
|
val result = Squares().squareOfSums(10)
|
|
21
24
|
result should equal (3025)
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
it should "calc sum of squares to 10" in {
|
|
28
|
+
pending
|
|
25
29
|
val result = Squares().sumOfSquares(10)
|
|
26
30
|
result should equal (385)
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
it should "calc difference of sums to 10" in {
|
|
34
|
+
pending
|
|
30
35
|
val result = Squares().difference(10)
|
|
31
36
|
result should equal (2640)
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
it should "calc square of sums to 100" in {
|
|
40
|
+
pending
|
|
35
41
|
val result = Squares().squareOfSums(100)
|
|
36
42
|
result should equal (25502500)
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
it should "calc sum of squares to 100" in {
|
|
46
|
+
pending
|
|
40
47
|
val result = Squares().sumOfSquares(100)
|
|
41
48
|
result should equal (338350)
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
it should "calc difference of sums to 100" in {
|
|
52
|
+
pending
|
|
45
53
|
val result = Squares().difference(100)
|
|
46
54
|
result should equal (25164150)
|
|
47
55
|
}
|
|
@@ -11,6 +11,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
"numbers" should "just get pushed onto the stack" in {
|
|
14
|
+
pending
|
|
14
15
|
forth.eval("1 2 3 4 5") match {
|
|
15
16
|
case Right(state) => state.toString should equal("1 2 3 4 5")
|
|
16
17
|
case Left(error) => fail("error pushing numbers on stack - " + error)
|
|
@@ -18,6 +19,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
"non-word characters" should "be handled as separators" in {
|
|
22
|
+
pending
|
|
21
23
|
// Note the Ogham Space Mark ( ), this is a spacing character.
|
|
22
24
|
// Also note that if Regex is used for your solution then handling
|
|
23
25
|
// Unicode requires and additional flag in the Regex string "(?U)".
|
|
@@ -28,6 +30,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
"basic arithmetic" should "evaluate" in {
|
|
33
|
+
pending
|
|
31
34
|
forth.eval("1 2 + 4 -") match {
|
|
32
35
|
case Right(state) => state.toString should equal("-1")
|
|
33
36
|
case Left(error) => fail("error handling basic arithmetic - " + error)
|
|
@@ -35,6 +38,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
"basic mul/div" should "evaluate" in {
|
|
41
|
+
pending
|
|
38
42
|
forth.eval("2 4 * 3 /") match {
|
|
39
43
|
case Right(state) => state.toString should equal("2")
|
|
40
44
|
case Left(error) => fail("error handling basic mul/div - " + error)
|
|
@@ -42,6 +46,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
"division by zero" should "return error" in {
|
|
49
|
+
pending
|
|
45
50
|
forth.eval("4 2 2 - /") match {
|
|
46
51
|
case Right(state) => fail("division by zero should return error")
|
|
47
52
|
case Left(error) => error should equal(ForthError.DivisionByZero)
|
|
@@ -49,6 +54,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
"dup" should "dupe the top of the stack" in {
|
|
57
|
+
pending
|
|
52
58
|
forth.eval("1 DUP") match {
|
|
53
59
|
case Right(state) => state.toString should equal("1 1")
|
|
54
60
|
case Left(error) => fail("error handling dup - " + error)
|
|
@@ -61,6 +67,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
"dup on empty stack" should "result in error" in {
|
|
70
|
+
pending
|
|
64
71
|
forth.eval("dup") match {
|
|
65
72
|
case Right(state) => fail("dup on empty stack should return error")
|
|
66
73
|
case Left(error) => error should equal(ForthError.StackUnderflow)
|
|
@@ -68,6 +75,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
"drop" should "remove an item from the stack" in {
|
|
78
|
+
pending
|
|
71
79
|
forth.eval("1 2 drop") match {
|
|
72
80
|
case Right(state) => state.toString should equal("1")
|
|
73
81
|
case Left(error) => fail("error handling drop - " + error)
|
|
@@ -75,6 +83,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
"drop on 1 item stack" should "result in empty" in {
|
|
86
|
+
pending
|
|
78
87
|
forth.eval("1 drop") match {
|
|
79
88
|
case Right(state) => state.toString should equal("")
|
|
80
89
|
case Left(error) => fail("error handling drop on 1 item stack - " + error)
|
|
@@ -82,6 +91,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
"drop on empty stack" should "result in error" in {
|
|
94
|
+
pending
|
|
85
95
|
forth.eval("drop") match {
|
|
86
96
|
case Right(state) => fail("drop on empty stack should return error")
|
|
87
97
|
case Left(error) => error should equal(ForthError.StackUnderflow)
|
|
@@ -89,6 +99,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
"swap" should "swap the top of the stack" in {
|
|
102
|
+
pending
|
|
92
103
|
forth.eval("1 2 swap") match {
|
|
93
104
|
case Right(state) => state.toString should equal("2 1")
|
|
94
105
|
case Left(error) => fail("error handling swap - " + error)
|
|
@@ -101,6 +112,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
"swap on empty" should "result in error" in {
|
|
115
|
+
pending
|
|
104
116
|
forth.eval("swap") match {
|
|
105
117
|
case Right(state) => fail("swap on empty stack should return error")
|
|
106
118
|
case Left(error) => error should equal(ForthError.StackUnderflow)
|
|
@@ -108,6 +120,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
108
120
|
}
|
|
109
121
|
|
|
110
122
|
"swap on single item stack" should "result in error" in {
|
|
123
|
+
pending
|
|
111
124
|
forth.eval("1 swap") match {
|
|
112
125
|
case Right(state) => fail("swap on single item stack should return error")
|
|
113
126
|
case Left(error) => error should equal(ForthError.StackUnderflow)
|
|
@@ -115,6 +128,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
115
128
|
}
|
|
116
129
|
|
|
117
130
|
"over" should "dupe second item in stack" in {
|
|
131
|
+
pending
|
|
118
132
|
forth.eval("1 2 over") match {
|
|
119
133
|
case Right(state) => state.toString should equal("1 2 1")
|
|
120
134
|
case Left(error) => fail("error handling over - " + error)
|
|
@@ -127,6 +141,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
127
141
|
}
|
|
128
142
|
|
|
129
143
|
"over on empty" should "result in error" in {
|
|
144
|
+
pending
|
|
130
145
|
forth.eval("over") match {
|
|
131
146
|
case Right(state) => fail("over on empty stack should return error")
|
|
132
147
|
case Left(error) => error should equal(ForthError.StackUnderflow)
|
|
@@ -134,6 +149,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
134
149
|
}
|
|
135
150
|
|
|
136
151
|
"over on single item stack" should "result in error" in {
|
|
152
|
+
pending
|
|
137
153
|
forth.eval("1 over") match {
|
|
138
154
|
case Right(state) => fail("over on single item stack should return error")
|
|
139
155
|
case Left(error) => error should equal(ForthError.StackUnderflow)
|
|
@@ -141,6 +157,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
141
157
|
}
|
|
142
158
|
|
|
143
159
|
"define a new word and usage" should "result in stack update" in {
|
|
160
|
+
pending
|
|
144
161
|
forth.eval(": dupe-twice dup dup ;\r 1 dupe-twice") match {
|
|
145
162
|
case Right(state) => state.toString should equal("1 1 1")
|
|
146
163
|
case Left(error) => fail("error handling define new word and use - " + error)
|
|
@@ -148,6 +165,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
"redefine an existing word and usage" should "result in stack update" in {
|
|
168
|
+
pending
|
|
151
169
|
forth.eval(": foo dup ;\r: foo dup dup ;\n1 foo") match {
|
|
152
170
|
case Right(state) => state.toString should equal("1 1 1")
|
|
153
171
|
case Left(error) => fail("error handling redefine word and use - " + error)
|
|
@@ -155,6 +173,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
155
173
|
}
|
|
156
174
|
|
|
157
175
|
"define a built in word" should "result in stack update using redefinition" in {
|
|
176
|
+
pending
|
|
158
177
|
forth.eval(": swap dup ;\r 1 swap") match {
|
|
159
178
|
case Right(state) => state.toString should equal("1 1")
|
|
160
179
|
case Left(error) => fail("error handling redefining built in word and use - " + error)
|
|
@@ -162,6 +181,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
162
181
|
}
|
|
163
182
|
|
|
164
183
|
"defining a word with odd chars" should "update the stack" in {
|
|
184
|
+
pending
|
|
165
185
|
forth.eval(": €A 220371 ; €A") match {
|
|
166
186
|
case Right(state) => state.toString should equal("220371")
|
|
167
187
|
case Left(error) => fail("error handling word definition with odd chars - " + error)
|
|
@@ -169,6 +189,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
"defining a number" should "result in an error" in {
|
|
192
|
+
pending
|
|
172
193
|
forth.eval(": 1 2 ;") match {
|
|
173
194
|
case Right(state) => fail("defining a new word using a number should result in an error")
|
|
174
195
|
case Left(error) => error should equal(ForthError.InvalidWord)
|
|
@@ -176,6 +197,7 @@ class ForthTest extends FlatSpec with Matchers with EitherValues {
|
|
|
176
197
|
}
|
|
177
198
|
|
|
178
199
|
"calling a non-existent word" should "result in an error" in {
|
|
200
|
+
pending
|
|
179
201
|
forth.eval("1 foo") match {
|
|
180
202
|
case Right(state) => fail("calling a non-existent word should result in an error")
|
|
181
203
|
case Left(error) => error should equal(ForthError.InvalidWord)
|
|
@@ -6,36 +6,44 @@ class HexadecimalTest extends FlatSpec with Matchers {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
it should "handle zeros" in {
|
|
9
|
+
pending
|
|
9
10
|
Hexadecimal.hexToInt("00000000") should equal(0)
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
it should "handle single digit" in {
|
|
14
|
+
pending
|
|
13
15
|
Hexadecimal.hexToInt("1") should equal(1)
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
it should "handle single hex digit" in {
|
|
19
|
+
pending
|
|
17
20
|
Hexadecimal.hexToInt("c") should equal(12)
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
it should "handle upper case" in {
|
|
24
|
+
pending
|
|
21
25
|
Hexadecimal.hexToInt("C") should equal(12)
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
it should "handle multiple digits" in {
|
|
29
|
+
pending
|
|
25
30
|
Hexadecimal.hexToInt("10") should equal(16)
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
it should "handle multiple hex digits" in {
|
|
34
|
+
pending
|
|
29
35
|
Hexadecimal.hexToInt("AF") should equal(175)
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
it should "handle complex strings" in {
|
|
39
|
+
pending
|
|
33
40
|
Hexadecimal.hexToInt("19ace") should equal(105166)
|
|
34
41
|
Hexadecimal.hexToInt("ffffff") should equal(16777215)
|
|
35
42
|
Hexadecimal.hexToInt("ffff00") should equal(16776960)
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
it should "handle invalid strings" in {
|
|
46
|
+
pending
|
|
39
47
|
Hexadecimal.hexToInt("carrot") should equal(0)
|
|
40
48
|
Hexadecimal.hexToInt("abczcba") should equal(0)
|
|
41
49
|
}
|
|
@@ -7,6 +7,7 @@ class GardenTest extends FunSuite with Matchers {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
test("alice tests") {
|
|
10
|
+
pending
|
|
10
11
|
Garden.defaultGarden("RC\nGG").getPlants("Alice") should
|
|
11
12
|
equal(List(Plant.Radishes, Plant.Clover, Plant.Grass, Plant.Grass))
|
|
12
13
|
Garden.defaultGarden("VC\nRC").getPlants("Alice") should
|
|
@@ -14,11 +15,13 @@ class GardenTest extends FunSuite with Matchers {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
test("small garden") {
|
|
18
|
+
pending
|
|
17
19
|
Garden.defaultGarden("VVCG\nVVRC").getPlants("Bob") should
|
|
18
20
|
equal(List(Plant.Clover, Plant.Grass, Plant.Radishes, Plant.Clover))
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
test("medium garden") {
|
|
24
|
+
pending
|
|
22
25
|
val garden = Garden.defaultGarden("VVCCGG\nVVCCGG")
|
|
23
26
|
garden.getPlants("Bob") should
|
|
24
27
|
equal(List(Plant.Clover, Plant.Clover, Plant.Clover, Plant.Clover))
|
|
@@ -27,6 +30,7 @@ class GardenTest extends FunSuite with Matchers {
|
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
test("full garden") {
|
|
33
|
+
pending
|
|
30
34
|
val garden = Garden.defaultGarden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")
|
|
31
35
|
garden.getPlants("Alice") should
|
|
32
36
|
equal(List(Plant.Violets, Plant.Radishes, Plant.Violets, Plant.Radishes))
|
|
@@ -53,6 +57,7 @@ class GardenTest extends FunSuite with Matchers {
|
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
test("surprise garden") {
|
|
60
|
+
pending
|
|
56
61
|
val garden = Garden(List("Samantha", "Patricia", "Xander", "Roger"), "VCRRGVRG\nRVGCCGCV")
|
|
57
62
|
garden.getPlants("Patricia") should
|
|
58
63
|
equal(List(Plant.Violets, Plant.Clover, Plant.Radishes, Plant.Violets))
|
|
@@ -10,6 +10,7 @@ class SeriesTest extends FlatSpec with Matchers {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
it should "find largestProduct in long strings" in {
|
|
13
|
+
pending
|
|
13
14
|
Series.largestProduct(6,
|
|
14
15
|
"73167176531330624919225119674426574742355349194934") should equal(Some(23520))
|
|
15
16
|
Series.largestProduct(6,
|
|
@@ -17,6 +18,7 @@ class SeriesTest extends FlatSpec with Matchers {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
it should "find largestProduct boundary conditions" in {
|
|
21
|
+
pending
|
|
20
22
|
Series.largestProduct(0, "") should equal(Some(1))
|
|
21
23
|
Series.largestProduct(0, "123") should equal(Some(1))
|
|
22
24
|
Series.largestProduct(1, "") should equal(None)
|
|
@@ -12,6 +12,7 @@ class DequeTest extends FlatSpec with Matchers {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
it should "handle push then shift" in {
|
|
15
|
+
pending
|
|
15
16
|
val deque = Deque[Char]()
|
|
16
17
|
deque.push('a')
|
|
17
18
|
deque.push('b')
|
|
@@ -21,6 +22,7 @@ class DequeTest extends FlatSpec with Matchers {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
it should "handle unshift then shift" in {
|
|
25
|
+
pending
|
|
24
26
|
val deque = Deque[Char]()
|
|
25
27
|
deque.unshift('a')
|
|
26
28
|
deque.unshift('b')
|
|
@@ -29,6 +31,7 @@ class DequeTest extends FlatSpec with Matchers {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
it should "handle unshift then pop" in {
|
|
34
|
+
pending
|
|
32
35
|
val deque = Deque[Char]()
|
|
33
36
|
deque.unshift('a')
|
|
34
37
|
deque.unshift('b')
|
|
@@ -37,6 +40,7 @@ class DequeTest extends FlatSpec with Matchers {
|
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
it should "handle complex interaction" in {
|
|
43
|
+
pending
|
|
40
44
|
val deque = Deque[Int]()
|
|
41
45
|
deque.push(1)
|
|
42
46
|
deque.push(2)
|
|
@@ -8,11 +8,13 @@ class LuhnTest extends FlatSpec with Matchers {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
it should "create addends" in {
|
|
11
|
+
pending
|
|
11
12
|
Luhn(12121).addends should equal(List(1, 4, 1, 4, 1))
|
|
12
13
|
Luhn(8631).addends should equal(List(7, 6, 6, 1))
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
it should "create checksum" in {
|
|
17
|
+
pending
|
|
16
18
|
// NOTE: this differs from the ruby and js, the checksum really should
|
|
17
19
|
// be mod 10 like we are testing here.
|
|
18
20
|
Luhn(4913).checksum should equal(2)
|
|
@@ -20,11 +22,13 @@ class LuhnTest extends FlatSpec with Matchers {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
it should "check validity" in {
|
|
25
|
+
pending
|
|
23
26
|
Luhn(738).isValid should be (false)
|
|
24
27
|
Luhn(8739567).isValid should be (true)
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
it should "create luhn values" in {
|
|
31
|
+
pending
|
|
28
32
|
Luhn(123).create should be (1230)
|
|
29
33
|
Luhn(873956).create should be (8739567)
|
|
30
34
|
Luhn(837263756).create should be (8372637564L)
|
|
@@ -7,11 +7,13 @@ class MatrixTest extends FlatSpec with Matchers {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
it should "extract a col" in {
|
|
10
|
+
pending
|
|
10
11
|
Matrix("1 2\n10 20").cols(0) should be (Vector(1, 10))
|
|
11
12
|
Matrix("1 2\n10 20\n100 200").cols(1) should be (Vector(2, 20, 200))
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
it should "support equality" in {
|
|
16
|
+
pending
|
|
15
17
|
Matrix("1 2\n10 20") should be (Matrix("1 2\n10 20"))
|
|
16
18
|
Matrix("1 2\n10 20") should not be Matrix("20 10\n100 200")
|
|
17
19
|
}
|