trackler 2.0.8.33 → 2.0.8.34
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/tracks/csharp/exercises/food-chain/Example.cs +2 -2
- data/tracks/csharp/exercises/food-chain/FoodChain.cs +2 -2
- data/tracks/csharp/exercises/food-chain/FoodChainTest.cs +150 -73
- data/tracks/csharp/exercises/luhn/LuhnTest.cs +5 -8
- data/tracks/csharp/generators/Data/CanonicalDataValue.cs +10 -0
- data/tracks/csharp/generators/Exercises/FoodChainExercise.cs +27 -0
- data/tracks/csharp/generators/Exercises/NthPrimeExercise.cs +1 -3
- data/tracks/csharp/generators/Methods/EqualityTestMethodGenerator.cs +25 -1
- data/tracks/csharp/generators/Methods/TestMethodGenerator.cs +16 -4
- data/tracks/csharp/generators/Methods/TestMethodOptions.cs +1 -0
- data/tracks/csharp/generators/Methods/TestMethodRenderer.cs +15 -7
- data/tracks/csharp/generators/Program.cs +2 -0
- data/tracks/java/exercises/difference-of-squares/src/example/java/{Difference.java → DifferenceOfSquaresCalculator.java} +4 -4
- data/tracks/java/exercises/difference-of-squares/src/main/java/DifferenceOfSquaresCalculator.java +5 -0
- data/tracks/java/exercises/difference-of-squares/src/test/java/{DifferenceTest.java → DifferenceOfSquaresCalculatorTest.java} +18 -11
- data/tracks/java/exercises/sum-of-multiples/src/example/java/SumOfMultiples.java +17 -9
- data/tracks/java/exercises/sum-of-multiples/src/test/java/SumOfMultiplesTest.java +73 -88
- data/tracks/perl6/.travis.yml +3 -0
- data/tracks/python/exercises/bob/bob_test.py +47 -71
- data/tracks/python/exercises/leap/leap_test.py +10 -11
- data/tracks/python/exercises/pangram/pangram_test.py +16 -16
- data/tracks/python/exercises/prime-factors/prime_factors_test.py +11 -21
- data/tracks/python/exercises/sieve/sieve_test.py +32 -24
- data/tracks/swift/.gitignore +3 -0
- data/tracks/swift/.swiftlint.yml +4 -2
- data/tracks/swift/exercises/kindergarten-garden/Sources/KindergartenGardenExample.swift +4 -4
- data/tracks/swift/exercises/kindergarten-garden/Tests/KindergartenGardenTests/KindergartenGardenTests.swift +25 -25
- data/tracks/swift/exercises/meetup/Sources/MeetupExample.swift +6 -6
- data/tracks/swift/exercises/poker/Sources/PokerExample.swift +12 -14
- data/tracks/swift/exercises/robot-simulator/Sources/RobotSimulatorExample.swift +6 -6
- data/tracks/swift/exercises/robot-simulator/Tests/RobotSimulatorTests/RobotSimulatorTests.swift +4 -4
- metadata +7 -5
- data/tracks/java/exercises/difference-of-squares/src/main/java/Difference.java +0 -5
data/tracks/perl6/.travis.yml
CHANGED
@@ -1,123 +1,99 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
from __future__ import unicode_literals
|
4
1
|
import unittest
|
5
2
|
|
6
3
|
import bob
|
7
4
|
|
8
5
|
|
9
|
-
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
10
7
|
|
8
|
+
class BobTests(unittest.TestCase):
|
11
9
|
def test_stating_something(self):
|
12
|
-
self.assertEqual(
|
13
|
-
'Whatever.',
|
14
|
-
bob.hey('Tom-ay-to, tom-aaaah-to.')
|
15
|
-
)
|
10
|
+
self.assertEqual(bob.hey("Tom-ay-to, tom-aaaah-to."), "Whatever.")
|
16
11
|
|
17
12
|
def test_shouting(self):
|
18
|
-
self.assertEqual(
|
19
|
-
|
20
|
-
|
21
|
-
)
|
13
|
+
self.assertEqual(bob.hey("WATCH OUT!"), "Whoa, chill out!")
|
14
|
+
|
15
|
+
def test_shouting_gibberish(self):
|
16
|
+
self.assertEqual(bob.hey("FCECDFCAAB"), "Whoa, chill out!")
|
22
17
|
|
23
18
|
def test_asking_a_question(self):
|
24
19
|
self.assertEqual(
|
25
|
-
|
26
|
-
bob.hey('Does this cryogenic chamber make me look fat?')
|
27
|
-
)
|
20
|
+
bob.hey("Does this cryogenic chamber make me look fat?"), "Sure.")
|
28
21
|
|
29
22
|
def test_asking_a_numeric_question(self):
|
30
|
-
self.assertEqual(
|
31
|
-
|
32
|
-
|
33
|
-
)
|
23
|
+
self.assertEqual(bob.hey("You are, what, like 15?"), "Sure.")
|
24
|
+
|
25
|
+
def test_asking_gibberish(self):
|
26
|
+
self.assertEqual(bob.hey("fffbbcbeab?"), "Sure.")
|
34
27
|
|
35
28
|
def test_talking_forcefully(self):
|
36
29
|
self.assertEqual(
|
37
|
-
'Whatever.
|
38
|
-
bob.hey("Let's go make out behind the gym!")
|
39
|
-
)
|
30
|
+
bob.hey("Let's go make out behind the gym!"), "Whatever.")
|
40
31
|
|
41
32
|
def test_using_acronyms_in_regular_speech(self):
|
42
33
|
self.assertEqual(
|
43
|
-
|
44
|
-
|
34
|
+
bob.hey("It's OK if you don't want to go to the DMV."),
|
35
|
+
"Whatever.")
|
45
36
|
|
46
|
-
def
|
37
|
+
def test_forceful_question(self):
|
47
38
|
self.assertEqual(
|
48
|
-
|
49
|
-
)
|
39
|
+
bob.hey("WHAT THE HELL WERE YOU THINKING?"), "Whoa, chill out!")
|
50
40
|
|
51
41
|
def test_shouting_numbers(self):
|
52
|
-
self.assertEqual(
|
53
|
-
'Whoa, chill out!', bob.hey('1, 2, 3 GO!')
|
54
|
-
)
|
42
|
+
self.assertEqual(bob.hey("1, 2, 3 GO!"), "Whoa, chill out!")
|
55
43
|
|
56
44
|
def test_only_numbers(self):
|
57
|
-
self.assertEqual(
|
58
|
-
'Whatever.', bob.hey('1, 2, 3')
|
59
|
-
)
|
45
|
+
self.assertEqual(bob.hey("1, 2, 3"), "Whatever.")
|
60
46
|
|
61
47
|
def test_question_with_only_numbers(self):
|
62
|
-
self.assertEqual(
|
63
|
-
'Sure.', bob.hey('4?')
|
64
|
-
)
|
48
|
+
self.assertEqual(bob.hey("4?"), "Sure.")
|
65
49
|
|
66
50
|
def test_shouting_with_special_characters(self):
|
67
51
|
self.assertEqual(
|
68
|
-
|
69
|
-
|
70
|
-
)
|
71
|
-
|
72
|
-
def test_shouting_with_umlauts(self):
|
73
|
-
self.assertEqual(
|
74
|
-
'Whoa, chill out!', bob.hey('ÜMLÄÜTS!')
|
75
|
-
)
|
76
|
-
|
77
|
-
def test_calmly_speaking_with_umlauts(self):
|
78
|
-
self.assertEqual(
|
79
|
-
'Whatever.', bob.hey('ÜMLäÜTS!')
|
80
|
-
)
|
52
|
+
bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"),
|
53
|
+
"Whoa, chill out!")
|
81
54
|
|
82
55
|
def test_shouting_with_no_exclamation_mark(self):
|
83
|
-
self.assertEqual(
|
84
|
-
'Whoa, chill out!', bob.hey('I HATE YOU')
|
85
|
-
)
|
56
|
+
self.assertEqual(bob.hey("I HATE YOU"), "Whoa, chill out!")
|
86
57
|
|
87
58
|
def test_statement_containing_question_mark(self):
|
88
59
|
self.assertEqual(
|
89
|
-
|
90
|
-
|
60
|
+
bob.hey("Ending with ? means a question."), "Whatever.")
|
61
|
+
|
62
|
+
def test_non_letters_with_question(self):
|
63
|
+
self.assertEqual(bob.hey(":) ?"), "Sure.")
|
91
64
|
|
92
65
|
def test_prattling_on(self):
|
93
66
|
self.assertEqual(
|
94
|
-
|
95
|
-
)
|
67
|
+
bob.hey("Wait! Hang on. Are you going to be OK?"), "Sure.")
|
96
68
|
|
97
69
|
def test_silence(self):
|
98
|
-
self.assertEqual(
|
99
|
-
'Fine. Be that way!', bob.hey('')
|
100
|
-
)
|
70
|
+
self.assertEqual(bob.hey(""), "Fine. Be that way!")
|
101
71
|
|
102
72
|
def test_prolonged_silence(self):
|
103
|
-
self.assertEqual(
|
104
|
-
|
105
|
-
|
73
|
+
self.assertEqual(bob.hey(" "), "Fine. Be that way!")
|
74
|
+
|
75
|
+
def test_alternate_silence(self):
|
76
|
+
self.assertEqual(bob.hey("\t\t\t\t\t\t\t\t\t\t"), "Fine. Be that way!")
|
106
77
|
|
107
|
-
def
|
78
|
+
def test_multiple_line_question(self):
|
108
79
|
self.assertEqual(
|
109
|
-
|
110
|
-
|
80
|
+
bob.hey("\nDoes this cryogenic chamber make me look fat?\nno"),
|
81
|
+
"Whatever.")
|
111
82
|
|
112
|
-
def
|
83
|
+
def test_starting_with_whitespace(self):
|
84
|
+
self.assertEqual(bob.hey(" hmmmmmmm..."), "Whatever.")
|
85
|
+
|
86
|
+
def test_ending_with_whitespace(self):
|
113
87
|
self.assertEqual(
|
114
|
-
|
115
|
-
|
88
|
+
bob.hey("Okay if like my spacebar quite a bit? "), "Sure.")
|
89
|
+
|
90
|
+
def test_other_whitespace(self):
|
91
|
+
self.assertEqual(bob.hey("\n\r \t"), "Fine. Be that way!")
|
116
92
|
|
117
|
-
def
|
93
|
+
def test_non_question_ending_with_whitespace(self):
|
118
94
|
self.assertEqual(
|
119
|
-
|
120
|
-
|
95
|
+
bob.hey("This is a statement ending with whitespace "),
|
96
|
+
"Whatever.")
|
121
97
|
|
122
98
|
|
123
99
|
if __name__ == '__main__':
|
@@ -3,21 +3,20 @@ import unittest
|
|
3
3
|
from leap import is_leap_year
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
def test_leap_year(self):
|
8
|
-
self.assertIs(is_leap_year(1996), True)
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
class YearTest(unittest.TestCase):
|
9
|
+
def test_year_not_divisible_by_4(self):
|
10
|
+
self.assertFalse(is_leap_year(2015))
|
12
11
|
|
13
|
-
def
|
14
|
-
self.
|
12
|
+
def test_year_divisible_by_4_not_divisible_by_100(self):
|
13
|
+
self.assertTrue(is_leap_year(2016))
|
15
14
|
|
16
|
-
def
|
17
|
-
self.
|
15
|
+
def test_year_divisible_by_100_not_divisible_by_400(self):
|
16
|
+
self.assertFalse(is_leap_year(2100))
|
18
17
|
|
19
|
-
def
|
20
|
-
self.
|
18
|
+
def test_year_divisible_by_400(self):
|
19
|
+
self.assertTrue(is_leap_year(2000))
|
21
20
|
|
22
21
|
|
23
22
|
if __name__ == '__main__':
|
@@ -1,45 +1,45 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
import unittest
|
4
2
|
|
5
3
|
from pangram import is_pangram
|
6
4
|
|
7
5
|
|
8
|
-
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
9
7
|
|
10
|
-
|
8
|
+
class PangramTests(unittest.TestCase):
|
9
|
+
def test_sentence_empty(self):
|
11
10
|
self.assertFalse(is_pangram(''))
|
12
11
|
|
13
|
-
def
|
12
|
+
def test_pangram_with_only_lower_case(self):
|
14
13
|
self.assertTrue(
|
15
14
|
is_pangram('the quick brown fox jumps over the lazy dog'))
|
16
15
|
|
17
|
-
def
|
18
|
-
self.assertFalse(
|
19
|
-
|
16
|
+
def test_missing_character_x(self):
|
17
|
+
self.assertFalse(
|
18
|
+
is_pangram('a quick movement of the enemy will '
|
19
|
+
'jeopardize five gunboats'))
|
20
20
|
|
21
|
-
def
|
21
|
+
def test_another_missing_character_x(self):
|
22
22
|
self.assertFalse(
|
23
23
|
is_pangram('the quick brown fish jumps over the lazy dog'))
|
24
24
|
|
25
25
|
def test_pangram_with_underscores(self):
|
26
26
|
self.assertTrue(
|
27
|
-
is_pangram(
|
27
|
+
is_pangram('the_quick_brown_fox_jumps_over_the_lazy_dog'))
|
28
28
|
|
29
29
|
def test_pangram_with_numbers(self):
|
30
30
|
self.assertTrue(
|
31
|
-
is_pangram(
|
31
|
+
is_pangram('the 1 quick brown fox jumps over the 2 lazy dogs'))
|
32
32
|
|
33
33
|
def test_missing_letters_replaced_by_numbers(self):
|
34
34
|
self.assertFalse(
|
35
|
-
is_pangram(
|
35
|
+
is_pangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog'))
|
36
36
|
|
37
|
-
def
|
37
|
+
def test_pangram_with_mixedcase_and_punctuation(self):
|
38
38
|
self.assertTrue(is_pangram('"Five quacking Zephyrs jolt my wax bed."'))
|
39
39
|
|
40
|
-
def
|
41
|
-
self.
|
42
|
-
|
40
|
+
def test_upper_and_lower_case_versions_of_the_same_character(self):
|
41
|
+
self.assertFalse(
|
42
|
+
is_pangram('the quick brown fox jumped over the lazy FOX'))
|
43
43
|
|
44
44
|
|
45
45
|
if __name__ == '__main__':
|
@@ -3,38 +3,28 @@ import unittest
|
|
3
3
|
from prime_factors import prime_factors
|
4
4
|
|
5
5
|
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
7
|
+
|
6
8
|
class PrimeFactorsTest(unittest.TestCase):
|
7
|
-
def
|
9
|
+
def test_no_factors(self):
|
8
10
|
self.assertEqual(prime_factors(1), [])
|
9
11
|
|
10
|
-
def
|
12
|
+
def test_prime_number(self):
|
11
13
|
self.assertEqual(prime_factors(2), [2])
|
12
14
|
|
13
|
-
def
|
14
|
-
self.assertEqual(prime_factors(3), [3])
|
15
|
-
|
16
|
-
def test_4(self):
|
17
|
-
self.assertEqual(prime_factors(4), [2, 2])
|
18
|
-
|
19
|
-
def test_6(self):
|
20
|
-
self.assertEqual(prime_factors(6), [2, 3])
|
21
|
-
|
22
|
-
def test_8(self):
|
23
|
-
self.assertEqual(prime_factors(8), [2, 2, 2])
|
24
|
-
|
25
|
-
def test_9(self):
|
15
|
+
def test_square_of_a_prime(self):
|
26
16
|
self.assertEqual(prime_factors(9), [3, 3])
|
27
17
|
|
28
|
-
def
|
29
|
-
self.assertEqual(prime_factors(
|
18
|
+
def test_cube_of_a_prime(self):
|
19
|
+
self.assertEqual(prime_factors(8), [2, 2, 2])
|
30
20
|
|
31
|
-
def
|
32
|
-
self.assertEqual(prime_factors(
|
21
|
+
def test_product_of_primes_and_non_primes(self):
|
22
|
+
self.assertEqual(prime_factors(12), [2, 2, 3])
|
33
23
|
|
34
|
-
def
|
24
|
+
def test_product_of_primes(self):
|
35
25
|
self.assertEqual(prime_factors(901255), [5, 17, 23, 461])
|
36
26
|
|
37
|
-
def
|
27
|
+
def test_factors_include_a_large_prime(self):
|
38
28
|
self.assertEqual(prime_factors(93819012551), [11, 9539, 894119])
|
39
29
|
|
40
30
|
|
@@ -3,31 +3,39 @@ import unittest
|
|
3
3
|
from sieve import sieve
|
4
4
|
|
5
5
|
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
7
|
+
|
6
8
|
class SieveTest(unittest.TestCase):
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
9
|
+
def test_no_primes_under_two(self):
|
10
|
+
self.assertEqual(sieve(1), [])
|
11
|
+
|
12
|
+
def test_find_first_prime(self):
|
13
|
+
self.assertEqual(sieve(2), [2])
|
14
|
+
|
15
|
+
def test_find_primes_up_to_10(self):
|
16
|
+
self.assertEqual(sieve(10), [2, 3, 5, 7])
|
17
|
+
|
18
|
+
def test_limit_is_prime(self):
|
19
|
+
self.assertEqual(sieve(13), [2, 3, 5, 7, 11, 13])
|
20
|
+
|
21
|
+
def test_find_primes_up_to_1000(self):
|
22
|
+
self.assertEqual(
|
23
|
+
sieve(1000), [
|
24
|
+
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
|
25
|
+
61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127,
|
26
|
+
131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
|
27
|
+
193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257,
|
28
|
+
263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331,
|
29
|
+
337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401,
|
30
|
+
409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,
|
31
|
+
479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563,
|
32
|
+
569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631,
|
33
|
+
641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709,
|
34
|
+
719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797,
|
35
|
+
809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877,
|
36
|
+
881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967,
|
37
|
+
971, 977, 983, 991, 997
|
38
|
+
])
|
31
39
|
|
32
40
|
|
33
41
|
if __name__ == '__main__':
|
data/tracks/swift/.gitignore
CHANGED
data/tracks/swift/.swiftlint.yml
CHANGED
@@ -10,100 +10,100 @@ class KindergartenGardenTests: XCTestCase {
|
|
10
10
|
|
11
11
|
func testAlicesGarden() {
|
12
12
|
let garden = Garden("RC\nGG")
|
13
|
-
XCTAssertEqual([.
|
13
|
+
XCTAssertEqual([.radishes, .clover, .grass, .grass], garden.plantsForChild("Alice"))
|
14
14
|
}
|
15
15
|
|
16
16
|
func testDifferentGardenForAlice() {
|
17
17
|
let garden = Garden("VC\nRC")
|
18
|
-
XCTAssertEqual([.
|
18
|
+
XCTAssertEqual([.violets, .clover, .radishes, .clover], garden.plantsForChild("Alice"))
|
19
19
|
}
|
20
20
|
|
21
21
|
func testBobsGarden() {
|
22
22
|
let garden = Garden("VVCG\nVVRC")
|
23
|
-
XCTAssertEqual([.
|
23
|
+
XCTAssertEqual([.clover, .grass, .radishes, .clover], garden.plantsForChild("Bob"))
|
24
24
|
}
|
25
25
|
|
26
26
|
func testBobAndCharliesGardens() {
|
27
27
|
let garden = Garden("VVCCGG\nVVCCGG")
|
28
|
-
XCTAssertEqual([.
|
29
|
-
XCTAssertEqual([.
|
28
|
+
XCTAssertEqual([.clover, .clover, .clover, .clover], garden.plantsForChild("Bob"))
|
29
|
+
XCTAssertEqual([.grass, .grass, .grass, .grass], garden.plantsForChild("Charlie"))
|
30
30
|
}
|
31
31
|
|
32
32
|
// MARK: - Test full garden
|
33
33
|
|
34
34
|
func testAlice() {
|
35
|
-
XCTAssertEqual([.
|
35
|
+
XCTAssertEqual([.violets, .radishes, .violets, .radishes], fullGarden.plantsForChild("Alice"))
|
36
36
|
}
|
37
37
|
|
38
38
|
func testBob() {
|
39
|
-
XCTAssertEqual([.
|
39
|
+
XCTAssertEqual([.clover, .grass, .clover, .clover], fullGarden.plantsForChild("Bob"))
|
40
40
|
}
|
41
41
|
|
42
42
|
func testCharlie() {
|
43
|
-
XCTAssertEqual([.
|
43
|
+
XCTAssertEqual([.violets, .violets, .clover, .grass], fullGarden.plantsForChild("Charlie"))
|
44
44
|
}
|
45
45
|
|
46
46
|
func testDavid() {
|
47
|
-
XCTAssertEqual([.
|
47
|
+
XCTAssertEqual([.radishes, .violets, .clover, .radishes], fullGarden.plantsForChild("David"))
|
48
48
|
}
|
49
49
|
|
50
50
|
func testEve() {
|
51
|
-
XCTAssertEqual([.
|
51
|
+
XCTAssertEqual([.clover, .grass, .radishes, .grass], fullGarden.plantsForChild("Eve"))
|
52
52
|
}
|
53
53
|
|
54
54
|
func testFred() {
|
55
|
-
XCTAssertEqual([.
|
55
|
+
XCTAssertEqual([.grass, .clover, .violets, .clover], fullGarden.plantsForChild("Fred"))
|
56
56
|
}
|
57
57
|
|
58
58
|
func testGinny() {
|
59
|
-
XCTAssertEqual([.
|
59
|
+
XCTAssertEqual([.clover, .grass, .grass, .clover], fullGarden.plantsForChild("Ginny"))
|
60
60
|
}
|
61
61
|
|
62
62
|
func testHarriet() {
|
63
|
-
XCTAssertEqual([.
|
63
|
+
XCTAssertEqual([.violets, .radishes, .radishes, .violets], fullGarden.plantsForChild("Harriet"))
|
64
64
|
}
|
65
65
|
|
66
66
|
func testIleana() {
|
67
|
-
XCTAssertEqual([.
|
67
|
+
XCTAssertEqual([.grass, .clover, .violets, .clover], fullGarden.plantsForChild("Ileana"))
|
68
68
|
}
|
69
69
|
|
70
70
|
func testJoseph() {
|
71
|
-
XCTAssertEqual([.
|
71
|
+
XCTAssertEqual([.violets, .clover, .violets, .grass], fullGarden.plantsForChild("Joseph"))
|
72
72
|
}
|
73
73
|
|
74
74
|
func testKincaid() {
|
75
|
-
XCTAssertEqual([.
|
75
|
+
XCTAssertEqual([.grass, .clover, .clover, .grass], fullGarden.plantsForChild("Kincaid"))
|
76
76
|
}
|
77
77
|
|
78
78
|
func testLarry() {
|
79
|
-
XCTAssertEqual([.
|
79
|
+
XCTAssertEqual([.grass, .violets, .clover, .violets], fullGarden.plantsForChild("Larry"))
|
80
80
|
}
|
81
81
|
|
82
82
|
// MARK: - Test disordered garden
|
83
83
|
|
84
84
|
func testPatricia() {
|
85
|
-
XCTAssertEqual([.
|
85
|
+
XCTAssertEqual([.violets, .clover, .radishes, .violets], disorderedGarden.plantsForChild("Patricia"))
|
86
86
|
}
|
87
87
|
|
88
88
|
func testRoger() {
|
89
|
-
XCTAssertEqual([.
|
89
|
+
XCTAssertEqual([.radishes, .radishes, .grass, .clover], disorderedGarden.plantsForChild("Roger"))
|
90
90
|
}
|
91
91
|
|
92
92
|
func testSamantha() {
|
93
|
-
XCTAssertEqual([.
|
93
|
+
XCTAssertEqual([.grass, .violets, .clover, .grass], disorderedGarden.plantsForChild("Samantha"))
|
94
94
|
}
|
95
95
|
|
96
96
|
func testXander() {
|
97
|
-
XCTAssertEqual([.
|
97
|
+
XCTAssertEqual([.radishes, .grass, .clover, .violets], disorderedGarden.plantsForChild("Xander"))
|
98
98
|
}
|
99
99
|
|
100
100
|
// MARK: - Test two gardens, different students
|
101
101
|
|
102
102
|
func testBobAndCharliePerGarden() {
|
103
|
-
XCTAssertEqual([.
|
104
|
-
XCTAssertEqual([.
|
105
|
-
XCTAssertEqual([.
|
106
|
-
XCTAssertEqual([.
|
103
|
+
XCTAssertEqual([.radishes, .radishes, .grass, .clover], garden1.plantsForChild("Bob"))
|
104
|
+
XCTAssertEqual([.violets, .clover, .radishes, .violets], garden2.plantsForChild("Bob"))
|
105
|
+
XCTAssertEqual([.grass, .violets, .clover, .grass], garden1.plantsForChild("Charlie"))
|
106
|
+
XCTAssertEqual([.radishes, .radishes, .grass, .clover], garden2.plantsForChild("Charlie"))
|
107
107
|
}
|
108
108
|
|
109
109
|
static var allTests: [(String, (KindergartenGardenTests) -> () throws -> Void)] {
|