Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions exercises/practice/high-scores/.meta/generator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
high-scores))

{{#test_cases.scores}}
(deftest scores_test_{{idx}}
(deftest ^:scores scores_test_{{idx}}
(testing {{context}}
(is (= {{expected}} (high-scores/scores {{input.scores}})))))
{{/test_cases.scores}}

{{#test_cases.latest}}
(deftest latest_test_{{idx}}
(deftest ^:latest latest_test_{{idx}}
(testing {{context}}
(is (= {{expected}} (high-scores/latest {{input.scores}})))))
{{/test_cases.latest}}

{{#test_cases.personalBest}}
(deftest personal-best_test_{{idx}}
(deftest ^:personal-best personal-best_test_{{idx}}
(testing {{context}}
(is (= {{expected}} (high-scores/personal-best {{input.scores}})))))
{{/test_cases.personalBest}}

{{#test_cases.personalTopThree}}
(deftest personal-top-three_test_{{idx}}
(deftest ^:personal-top-three personal-top-three_test_{{idx}}
(testing {{context}}
(is (= {{expected}} (high-scores/personal-top-three {{input.scores}})))))
{{/test_cases.personalTopThree}}
8 changes: 8 additions & 0 deletions exercises/practice/high-scores/project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(defproject high-scores "0.1.0-SNAPSHOT"
:description "high-scores exercise."
:url "https://github.com/exercism/clojure/tree/master/exercises/high-scores"
:dependencies [[org.clojure/clojure "1.12.0"]]
:test-selectors {:scores :scores
:latest :latest
:personal-best :personal-best
:personal-top-three :personal-top-three})
4 changes: 0 additions & 4 deletions exercises/practice/high-scores/project.edn

This file was deleted.

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 @@ -2,34 +2,34 @@
(:require [clojure.test :refer [deftest testing is]]
high-scores))

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

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

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

(deftest personal-top-three_test_1
(deftest ^:personal-top-three 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))))))

(deftest personal-top-three_test_2
(deftest ^:personal-top-three 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))))))

(deftest personal-top-three_test_3
(deftest ^:personal-top-three 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))))))

(deftest personal-top-three_test_4
(deftest ^:personal-top-three 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))))))

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