-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update clj-kondo settings and refactor test file imports
The clj-kondo command in the lint task has been updated to run in parallel, setting the fail level as a warning. This amendment should improve performance by running in a non-blocking mode. The clojure.test import usage in the book_2_
- Loading branch information
Denis Smet
committed
Feb 11, 2024
1 parent
652cea3
commit 25af23c
Showing
2 changed files
with
22 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,33 @@ | ||
(ns sicp.chapter-2.part-5.book-2-5-test | ||
(:require | ||
[clojure.test :refer [deftest is]] | ||
[sicp.chapter-2.part-5.book-2-5 :refer [add | ||
div | ||
install-rational-package | ||
install-scheme-number-package | ||
make-rational | ||
make-scheme-number | ||
mul | ||
sub]])) | ||
[sicp.chapter-2.part-5.book-2-5 :as b25])) | ||
|
||
(install-scheme-number-package) | ||
(install-rational-package) | ||
(deftest install-test | ||
(is (= :done (b25/install-scheme-number-package))) | ||
(is (= :done (b25/install-rational-package))) | ||
(is (= :done (b25/install-complex-package)))) | ||
|
||
(deftest add-test | ||
(is (= (make-scheme-number 3) (add (make-scheme-number 1) (make-scheme-number 2)))) | ||
(is (= (make-scheme-number 4) (add (make-scheme-number 2) (make-scheme-number 2)))) | ||
(is (= (make-rational 4 1) (add (make-rational 2 1) (make-rational 2 1)))) | ||
(is (= (make-rational 1 1) (add (make-rational 2 3) (make-rational 1 3))))) | ||
(is (= (b25/make-scheme-number 3) (b25/add (b25/make-scheme-number 1) (b25/make-scheme-number 2)))) | ||
(is (= (b25/make-scheme-number 4) (b25/add (b25/make-scheme-number 2) (b25/make-scheme-number 2)))) | ||
(is (= (b25/make-rational 4 1) (b25/add (b25/make-rational 2 1) (b25/make-rational 2 1)))) | ||
(is (= (b25/make-rational 1 1) (b25/add (b25/make-rational 2 3) (b25/make-rational 1 3))))) | ||
|
||
(deftest sub-test | ||
(is (= (make-scheme-number 1) (sub (make-scheme-number 4) (make-scheme-number 3)))) | ||
(is (= (make-scheme-number -6) (sub (make-scheme-number 4) (make-scheme-number 10)))) | ||
(is (= (make-rational 0 1) (sub (make-rational 2 1) (make-rational 2 1)))) | ||
(is (= (make-rational 1 3) (sub (make-rational 2 3) (make-rational 1 3))))) | ||
(is (= (b25/make-scheme-number 1) (b25/sub (b25/make-scheme-number 4) (b25/make-scheme-number 3)))) | ||
(is (= (b25/make-scheme-number -6) (b25/sub (b25/make-scheme-number 4) (b25/make-scheme-number 10)))) | ||
(is (= (b25/make-rational 0 1) (b25/sub (b25/make-rational 2 1) (b25/make-rational 2 1)))) | ||
(is (= (b25/make-rational 1 3) (b25/sub (b25/make-rational 2 3) (b25/make-rational 1 3))))) | ||
|
||
(deftest mul-test | ||
(is (= (make-scheme-number 12) (mul (make-scheme-number 4) (make-scheme-number 3)))) | ||
(is (= (make-scheme-number -40) (mul (make-scheme-number -4) (make-scheme-number 10)))) | ||
(is (= (make-rational 4 1) (mul (make-rational 2 1) (make-rational 2 1)))) | ||
(is (= (make-rational 2 9) (mul (make-rational 2 3) (make-rational 1 3))))) | ||
(is (= (b25/make-scheme-number 12) (b25/mul (b25/make-scheme-number 4) (b25/make-scheme-number 3)))) | ||
(is (= (b25/make-scheme-number -40) (b25/mul (b25/make-scheme-number -4) (b25/make-scheme-number 10)))) | ||
(is (= (b25/make-rational 4 1) (b25/mul (b25/make-rational 2 1) (b25/make-rational 2 1)))) | ||
(is (= (b25/make-rational 2 9) (b25/mul (b25/make-rational 2 3) (b25/make-rational 1 3))))) | ||
|
||
(deftest div-test | ||
(is (= (make-scheme-number 20) (div (make-scheme-number 100) (make-scheme-number 5)))) | ||
(is (= (make-scheme-number 1/2) (div (make-scheme-number 3) (make-scheme-number 6)))) | ||
(is (= (make-rational 1 1) (div (make-rational 2 1) (make-rational 2 1)))) | ||
(is (= (make-rational 2 1) (div (make-rational 2 3) (make-rational 1 3))))) | ||
(is (= (b25/make-scheme-number 20) (b25/div (b25/make-scheme-number 100) (b25/make-scheme-number 5)))) | ||
(is (= (b25/make-scheme-number 1/2) (b25/div (b25/make-scheme-number 3) (b25/make-scheme-number 6)))) | ||
(is (= (b25/make-rational 1 1) (b25/div (b25/make-rational 2 1) (b25/make-rational 2 1)))) | ||
(is (= (b25/make-rational 2 1) (b25/div (b25/make-rational 2 3) (b25/make-rational 1 3))))) |