Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
kondo:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/[email protected]
Expand All @@ -20,7 +20,7 @@ jobs:
clojure -M:kondo --lint src test

tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/[email protected]
Expand Down
1 change: 0 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
pjstadig/humane-test-output {:mvn/version "0.11.0"}
prismatic/schema {:mvn/version "1.4.1"}
metosin/malli {:mvn/version "0.17.0"}
org.clojure/algo.generic {:mvn/version "1.0.1"}
org.clojure/java.classpath {:mvn/version "1.1.0"}
org.clojure/tools.namespace {:mvn/version "1.5.0"}}

Expand Down
9 changes: 7 additions & 2 deletions src/mb/hawk/assert_exprs/approximately_equal.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns mb.hawk.assert-exprs.approximately-equal
"See documentation in `docs/approximately-equal.md`."
(:require
[clojure.algo.generic.math-functions :as algo.generic.math]
[clojure.pprint :as pprint]
[malli.core :as m]
[malli.error :as me]
Expand Down Expand Up @@ -213,11 +212,17 @@
:prefix "(approx " :suffix ")"
(pprint/write-out [(.expected this) (.epsilon this)])))

(defn- approx=
"Return true if the absolute value of the difference between x and y is less than eps.
Simple replacement for algo.generic.math/approx="
[x y eps]
(< (Math/abs (- (double x) (double y))) (double eps)))

(methodical/defmethod =?-diff [Approx Number]
[^Approx this actual]
(let [expected (.expected this)
epsilon (.epsilon this)]
(when-not (algo.generic.math/approx= expected actual epsilon)
(when-not (approx= expected actual epsilon)
(list 'not (list 'approx expected actual (symbol "#_epsilon") epsilon)))))

(deftype Same [k])
Expand Down
Loading