Skip to content

Commit

Permalink
Update template
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Jan 14, 2025
1 parent 6db887c commit b8e4bd6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions exercises/practice/high-scores/.meta/generator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
high-scores))
{{#test_cases.scores}}
(deftest scores_test_{{idx}}
(testing "{{description}}"
(is (= {{expected}} (high-scores/scores {{input.scores}})))))
(testing {{string description}}
(is (= {{list expected}} (high-scores/scores {{list input.scores}})))))
{{/test_cases.scores~}}
{{#test_cases.latest}}
(deftest latest_test_{{idx}}
(testing "{{description}}"
(is (= {{expected}} (high-scores/latest {{input.scores}})))))
(testing {{string description}}
(is (= {{expected}} (high-scores/latest {{list input.scores}})))))
{{/test_cases.latest~}}
{{#test_cases.personalBest}}
(deftest personal-best_test_{{idx}}
(testing "{{description}}"
(is (= {{expected}} (high-scores/personal-best {{input.scores}})))))
(testing {{string description}}
(is (= {{expected}} (high-scores/personal-best {{list input.scores}})))))
{{/test_cases.personalBest~}}
{{#test_cases.personalTopThree}}
(deftest personal-top-three_test_{{idx}}
(testing "{{description}}"
(is (= {{expected}} (high-scores/personal-top-three {{input.scores}})))))
(testing {{string description}}
(is (= {{list expected}} (high-scores/personal-top-three {{list input.scores}})))))
{{/test_cases.personalTopThree~}}
16 changes: 8 additions & 8 deletions exercises/practice/high-scores/test/high_scores_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@

(deftest scores_test_1
(testing "List of scores"
(is (= [30 50 20 70] (high-scores/scores [30 50 20 70])))))
(is (= '(30 50 20 70) (high-scores/scores '(30 50 20 70))))))

(deftest latest_test_1
(testing "Latest score"
(is (= 30 (high-scores/latest [100 0 90 30])))))
(is (= 30 (high-scores/latest '(100 0 90 30))))))

(deftest personal-best_test_1
(testing "Personal best"
(is (= 100 (high-scores/personal-best [40 100 70])))))
(is (= 100 (high-scores/personal-best '(40 100 70))))))

(deftest personal-top-three_test_1
(testing "Top 3 scores - Personal top three from a list of scores"
(is (= [100 90 70] (high-scores/personal-top-three [10 30 90 30 100 20 10 0 30 40 40 70 70])))))
(is (= '(100 90 70) (high-scores/personal-top-three '(10 30 90 30 100 20 10 0 30 40 40 70 70))))))

(deftest personal-top-three_test_2
(testing "Top 3 scores - Personal top highest to lowest"
(is (= [30 20 10] (high-scores/personal-top-three [20 10 30])))))
(is (= '(30 20 10) (high-scores/personal-top-three '(20 10 30))))))

(deftest personal-top-three_test_3
(testing "Top 3 scores - Personal top when there is a tie"
(is (= [40 40 30] (high-scores/personal-top-three [40 20 40 30])))))
(is (= '(40 40 30) (high-scores/personal-top-three '(40 20 40 30))))))

(deftest personal-top-three_test_4
(testing "Top 3 scores - Personal top when there are less than 3"
(is (= [70 30] (high-scores/personal-top-three [30 70])))))
(is (= '(70 30) (high-scores/personal-top-three '(30 70))))))

(deftest personal-top-three_test_5
(testing "Top 3 scores - Personal top when there is only one"
(is (= [40] (high-scores/personal-top-three [40])))))
(is (= '(40) (high-scores/personal-top-three '(40))))))

0 comments on commit b8e4bd6

Please sign in to comment.