Skip to content

Commit

Permalink
Reduce asserts count and small fixes (#1061)
Browse files Browse the repository at this point in the history
  • Loading branch information
solar05 authored Nov 2, 2023
1 parent 1964432 commit ecc8309
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/battle_asserts/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
(let [generator (build-generator)
size (count samples)
coll (gen/sample generator (- max-asserts size))
generated (map #(hash-map :expected (apply solution %) :arguments %) coll)]
generated (distinct (map #(hash-map :expected (apply solution %) :arguments %) coll))]
(reduce
(fn [acc task] (conj acc (into (sorted-map) task)))
generated
Expand Down Expand Up @@ -68,9 +68,11 @@
(spit filename yaml))
(println (str "Proceeding " issue-name "..."))
(let [filename (str "issues/" issue-name ".json")
asserts (generate-asserts build-generator solution samples)]
(if disabled
asserts (generate-asserts build-generator solution samples)
asserts-count (count asserts)]
(if (or disabled (not= asserts-count max-asserts))
(do (println (str issue-name " issue is disabled!"))
(println (str issue-name " issue has: " asserts-count " asserts!"))
(write-to-file filename asserts))
(let [signature-errors (util/check-asserts-and-sign asserts @signature)]
(if (empty? signature-errors)
Expand Down
2 changes: 1 addition & 1 deletion src/battle_asserts/issues/book_authors.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:ru "Создайте функцию, которая извлекает имена авторов из книг."})

(def signature
{:input [{:argument-name "names" :type {:name "array" :nested {:name "hash" :nested {:name "string"}}}}]
{:input [{:argument-name "books" :type {:name "array" :nested {:name "hash" :nested {:name "string"}}}}]
:output {:type {:name "array" :nested {:name "string"}}}})

(defn arguments-generator []
Expand Down

0 comments on commit ecc8309

Please sign in to comment.