Skip to content

Commit 6e11019

Browse files
kytrinyxkotp
authored andcommitted
Sync high-scores with problem-specifications
There were a slew of new tests for methods that were not previously a part of the API of the class. None of the methods are mentioned in the instructions for the exercise, and they also don't seem very interesting, so I didn't bring them in. When regenerating the test suite, the tests for the #latest_is_personal_best? method got removed. I deleted the corresponding code in the sample solution, but kotp mentioned that this bit of code provides a good avenue for digging deeper with some students, so I put it back. I've now created a custom inclusion for these tests so they get added to the test suite when regenerating it.
1 parent ed9506b commit 6e11019

File tree

4 files changed

+37
-28
lines changed

4 files changed

+37
-28
lines changed

exercises/practice/high-scores/.docs/instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
Manage a game player's High Score list.
44

5-
Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores.
5+
Your task is to build a high-score component of the classic Frogger game, one of the highest selling and most addictive games of all time, and a classic of the arcade era.
6+
Your task is to write methods that return the highest score from the list, the last added score and the three highest scores.

exercises/practice/high-scores/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"blurb": "Manage a player's High Score list",
2+
"blurb": "Manage a player's High Score list.",
33
"authors": [
44
"pgaspar"
55
],

exercises/practice/high-scores/.meta/tests.toml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,32 @@ description = "Latest score"
1919
description = "Personal best"
2020

2121
[3d996a97-c81c-4642-9afc-80b80dc14015]
22-
description = "Personal top three from a list of scores"
22+
description = "Top 3 scores -> Personal top three from a list of scores"
2323

2424
[1084ecb5-3eb4-46fe-a816-e40331a4e83a]
25-
description = "Personal top highest to lowest"
25+
description = "Top 3 scores -> Personal top highest to lowest"
2626

2727
[e6465b6b-5a11-4936-bfe3-35241c4f4f16]
28-
description = "Personal top when there is a tie"
28+
description = "Top 3 scores -> Personal top when there is a tie"
2929

3030
[f73b02af-c8fd-41c9-91b9-c86eaa86bce2]
31-
description = "Personal top when there are less than 3"
31+
description = "Top 3 scores -> Personal top when there are less than 3"
3232

3333
[16608eae-f60f-4a88-800e-aabce5df2865]
34-
description = "Personal top when there is only one"
34+
description = "Top 3 scores -> Personal top when there is only one"
35+
36+
[2df075f9-fec9-4756-8f40-98c52a11504f]
37+
description = "Top 3 scores -> Latest score after personal top scores"
38+
include = false
39+
40+
[809c4058-7eb1-4206-b01e-79238b9b71bc]
41+
description = "Top 3 scores -> Scores after personal top scores"
42+
include = false
43+
44+
[ddb0efc0-9a86-4f82-bc30-21ae0bdc6418]
45+
description = "Top 3 scores -> Latest score after personal best"
46+
include = false
47+
48+
[6a0fd2d1-4cc4-46b9-a5bb-2fb667ca2364]
49+
description = "Top 3 scores -> Scores after personal best"
50+
include = false

exercises/practice/high-scores/high_scores_test.rb

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,49 @@ class HighScoresTest < Minitest::Test
55
def test_list_of_scores
66
# skip
77
scores = [30, 50, 20, 70]
8-
expected = [30, 50, 20, 70]
9-
assert_equal expected, HighScores.new(scores).scores
8+
assert_equal [30, 50, 20, 70], HighScores.new(scores).scores
109
end
1110

1211
def test_latest_score
1312
skip
1413
scores = [100, 0, 90, 30]
15-
expected = 30
16-
assert_equal expected, HighScores.new(scores).latest
14+
assert_equal 30, HighScores.new(scores).latest
1715
end
1816

1917
def test_personal_best
2018
skip
2119
scores = [40, 100, 70]
22-
expected = 100
23-
assert_equal expected, HighScores.new(scores).personal_best
20+
assert_equal 100, HighScores.new(scores).personal_best
2421
end
2522

26-
def test_personal_top_three_from_a_list_of_scores
23+
def test_top_3_scores_personal_top_three_from_a_list_of_scores
2724
skip
2825
scores = [10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70]
29-
expected = [100, 90, 70]
30-
assert_equal expected, HighScores.new(scores).personal_top_three
26+
assert_equal [100, 90, 70], HighScores.new(scores).personal_top_three
3127
end
3228

33-
def test_personal_top_highest_to_lowest
29+
def test_top_3_scores_personal_top_highest_to_lowest
3430
skip
3531
scores = [20, 10, 30]
36-
expected = [30, 20, 10]
37-
assert_equal expected, HighScores.new(scores).personal_top_three
32+
assert_equal [30, 20, 10], HighScores.new(scores).personal_top_three
3833
end
3934

40-
def test_personal_top_when_there_is_a_tie
35+
def test_top_3_scores_personal_top_when_there_is_a_tie
4136
skip
4237
scores = [40, 20, 40, 30]
43-
expected = [40, 40, 30]
44-
assert_equal expected, HighScores.new(scores).personal_top_three
38+
assert_equal [40, 40, 30], HighScores.new(scores).personal_top_three
4539
end
4640

47-
def test_personal_top_when_there_are_less_than_3
41+
def test_top_3_scores_personal_top_when_there_are_less_than_3
4842
skip
4943
scores = [30, 70]
50-
expected = [70, 30]
51-
assert_equal expected, HighScores.new(scores).personal_top_three
44+
assert_equal [70, 30], HighScores.new(scores).personal_top_three
5245
end
5346

54-
def test_personal_top_when_there_is_only_one
47+
def test_top_3_scores_personal_top_when_there_is_only_one
5548
skip
5649
scores = [40]
57-
expected = [40]
58-
assert_equal expected, HighScores.new(scores).personal_top_three
50+
assert_equal [40], HighScores.new(scores).personal_top_three
5951
end
6052

6153
def test_latest_score_is_not_the_personal_best

0 commit comments

Comments
 (0)