From a81cbeaabce6755449d4e96bf0cc8a4cf10a62a6 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sat, 11 Jan 2025 12:45:45 +0100 Subject: [PATCH] two-fer: add generator and regenerate tests --- .../practice/two-fer/.meta/generator.template | 8 ++++++++ .../practice/two-fer/test/two_fer_test.clj | 20 +++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 exercises/practice/two-fer/.meta/generator.template diff --git a/exercises/practice/two-fer/.meta/generator.template b/exercises/practice/two-fer/.meta/generator.template new file mode 100644 index 000000000..7b1dbdaf0 --- /dev/null +++ b/exercises/practice/two-fer/.meta/generator.template @@ -0,0 +1,8 @@ +(ns two-fer-test + (:require [clojure.test :refer [deftest testing is]] + two-fer)) +{{#test_cases.twoFer}} +(deftest two-fer_test_{{idx}} + (testing "{{description}}" + (is (= "{{expected}}" (two-fer/two-fer{{#input.name}} "{{input.name}}"{{/input.name}}))))) +{{/test_cases.twoFer}} diff --git a/exercises/practice/two-fer/test/two_fer_test.clj b/exercises/practice/two-fer/test/two_fer_test.clj index a1ac32968..6be75ad22 100644 --- a/exercises/practice/two-fer/test/two_fer_test.clj +++ b/exercises/practice/two-fer/test/two_fer_test.clj @@ -1,12 +1,16 @@ (ns two-fer-test - (:require [clojure.test :refer [deftest is]] - two-fer)) + (:require [clojure.test :refer [deftest testing is]] + two-fer)) -(deftest two-fer-test - (is (= "One for you, one for me." (two-fer/two-fer)))) +(deftest two-fer_test_1 + (testing "no name given" + (is (= "One for you, one for me." (two-fer/two-fer))))) -(deftest name-alice-test - (is (= "One for Alice, one for me." (two-fer/two-fer "Alice")))) +(deftest two-fer_test_2 + (testing "a name given" + (is (= "One for Alice, one for me." (two-fer/two-fer "Alice"))))) + +(deftest two-fer_test_3 + (testing "another name given" + (is (= "One for Bob, one for me." (two-fer/two-fer "Bob"))))) -(deftest name-bob-test - (is (= "One for Bob, one for me." (two-fer/two-fer "Bob"))))