From a293f947054fda08974791fab449adb275b5950e Mon Sep 17 00:00:00 2001 From: Jeff Parker Date: Sun, 24 Mar 2019 08:19:13 -0600 Subject: [PATCH 1/5] Add test I don't know the syntax, but would like to add a test that asks for top three (causing a sort) followed by a latest to see if the program sorted in place. --- exercises/high-scores/canonical-data.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exercises/high-scores/canonical-data.json b/exercises/high-scores/canonical-data.json index b90579582b..a161099d0d 100644 --- a/exercises/high-scores/canonical-data.json +++ b/exercises/high-scores/canonical-data.json @@ -77,6 +77,14 @@ }, "expected": [40] } + { + "description": "Recent after a call to sort", + "property": "personalTopThree", "latest", + "input": { + "scores": [10, 20, 30, 40, 25] + }, + "expected": [25] + } ] } ] From 03afbdcea60c0f601f54da65887279d6d00deeb4 Mon Sep 17 00:00:00 2001 From: Jeff Parker Date: Wed, 9 Feb 2022 15:59:57 -0700 Subject: [PATCH 2/5] Update canonical-data.json Add tests for immutability after calling personal best Some solutions sort the array to find the largest. This breaks any subsequent call for recent scores, and isn't as fast as calling max. These two tests call recent and scores to verify that the scores have not changed. --- exercises/high-scores/canonical-data.json | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/exercises/high-scores/canonical-data.json b/exercises/high-scores/canonical-data.json index 52b442d9b0..d1e67a214b 100644 --- a/exercises/high-scores/canonical-data.json +++ b/exercises/high-scores/canonical-data.json @@ -112,6 +112,30 @@ }, "expected": [25] } + { + "uuid": "ddb0efc0-9a86-4f82-bc30-21ae0bdc6418", + "description": "Latest score after personal best", + "property": "latestAfterBest", + "input": { + "scores": [20, 70, 15, 25, 30] + }, + "expected": 30, + "scenarios": [ + "immutable" + ] + }, + { + "uuid": "6a0fd2d1-4cc4-46b9-a5bb-2fb667ca2364", + "description": "Scores after personal best", + "property": "scoresAfterBest", + "input": { + "scores": [20, 70, 15, 25, 30] + }, + "expected": [20, 70, 15, 25, 30], + "scenarios": [ + "immutable" + ] + } ] } ] From 5ce5ac2d9f499824c4ec6998ac2b8872a67dd072 Mon Sep 17 00:00:00 2001 From: Jeff Parker Date: Wed, 9 Feb 2022 16:15:25 -0700 Subject: [PATCH 3/5] Update canonical-data.json Add missing commas --- exercises/high-scores/canonical-data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/high-scores/canonical-data.json b/exercises/high-scores/canonical-data.json index d1e67a214b..a1b9c3766f 100644 --- a/exercises/high-scores/canonical-data.json +++ b/exercises/high-scores/canonical-data.json @@ -103,7 +103,7 @@ }, "expected": [30, 50, 20, 70], "scenarios": ["immutable"] - } + }, { "description": "Recent after a call to sort", "property": "personalTopThree", "latest", @@ -111,7 +111,7 @@ "scores": [10, 20, 30, 40, 25] }, "expected": [25] - } + }, { "uuid": "ddb0efc0-9a86-4f82-bc30-21ae0bdc6418", "description": "Latest score after personal best", From 6bce49ed1329c6023bc43370e929805e55d20b2b Mon Sep 17 00:00:00 2001 From: Jeff Parker Date: Fri, 11 Feb 2022 21:02:47 -0700 Subject: [PATCH 4/5] Update canonical-data.json Removed redundant test that two property strings, rather than one "property": "personalTopThree", "latest", --- exercises/high-scores/canonical-data.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/exercises/high-scores/canonical-data.json b/exercises/high-scores/canonical-data.json index a1b9c3766f..3e63477111 100644 --- a/exercises/high-scores/canonical-data.json +++ b/exercises/high-scores/canonical-data.json @@ -104,14 +104,6 @@ "expected": [30, 50, 20, 70], "scenarios": ["immutable"] }, - { - "description": "Recent after a call to sort", - "property": "personalTopThree", "latest", - "input": { - "scores": [10, 20, 30, 40, 25] - }, - "expected": [25] - }, { "uuid": "ddb0efc0-9a86-4f82-bc30-21ae0bdc6418", "description": "Latest score after personal best", From 7d1ae02da708365114f9f01e2600783e4f753ce2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 12 Feb 2022 12:15:21 +0000 Subject: [PATCH 5/5] [CI] Format code --- exercises/high-scores/canonical-data.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/exercises/high-scores/canonical-data.json b/exercises/high-scores/canonical-data.json index 3e63477111..2a3cdce134 100644 --- a/exercises/high-scores/canonical-data.json +++ b/exercises/high-scores/canonical-data.json @@ -112,9 +112,7 @@ "scores": [20, 70, 15, 25, 30] }, "expected": 30, - "scenarios": [ - "immutable" - ] + "scenarios": ["immutable"] }, { "uuid": "6a0fd2d1-4cc4-46b9-a5bb-2fb667ca2364", @@ -124,9 +122,7 @@ "scores": [20, 70, 15, 25, 30] }, "expected": [20, 70, 15, 25, 30], - "scenarios": [ - "immutable" - ] + "scenarios": ["immutable"] } ] }