Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce asserts count and small fixes #1061

Merged
merged 1 commit into from
Nov 2, 2023
Merged
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: 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
Loading