Skip to content

Commit

Permalink
matching-brackets: Add generator and regenerate tests (#804)
Browse files Browse the repository at this point in the history
* update function template

* add generator and regenerate tests
  • Loading branch information
tasxatzial authored Jan 31, 2025
1 parent 8918e4e commit a35d32c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions exercises/practice/matching-brackets/.meta/generator.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(ns matching-brackets-test
(:require [clojure.test :refer [deftest testing is]]
matching-brackets))

{{#test_cases.isPaired}}
(deftest valid?_test_{{idx}}
(testing {{description}}
(is ({{#expected}}true?{{else}}false?{{/expected}} (matching-brackets/valid? {{input.value}})))))
{{/test_cases.isPaired}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns matching-brackets)

(defn valid?
"Returns true if the given string has properly matched brackets; otherwise, returns false."
[s]
;; function body
)
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
(deftest valid?_test_11
(testing "unopened closing brackets"
(is (false? (matching-brackets/valid? "{[)][]}")))))

(deftest valid?_test_12
(testing "unpaired and nested brackets"
(is (false? (matching-brackets/valid? "([{])")))))
Expand Down Expand Up @@ -80,4 +80,4 @@

(deftest valid?_test_20
(testing "complex latex expression"
(is (true? (matching-brackets/valid? "\\\\left(\\\\begin{array}{cc} \\\\frac{1}{3} & x\\\\\\\\ \\\\mathrm{e}^{x} &... x^2 \\\\end{array}\\\\right)")))))
(is (true? (matching-brackets/valid? "\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)")))))

0 comments on commit a35d32c

Please sign in to comment.