Skip to content

Commit 97e74b6

Browse files
marke000claude
andcommitted
Code review: align test headers, add missing tests, fix bugs
Review fixes: - Align all test section headers to match source files exactly - Document all :num-tests usages with justification comments - Add 22+ missing tests for macros, generators, and functions in core - Add 5 missing tests in random (next-rng$, rng-gen, set-seed!, bind-seed, do-set-seed!) - Add macro tests for vector-of-spec and vector-finite-spec Bug fixes: - integrals: Replace throw with anomaly returns in quasi-monte-carlo-integration and oscillatory-integration - linear_algebra_test: Replace Double/isNaN with m/nan? - intervals: Rename bounds-width to bounds-finite-width, use ::bounds-finite spec - series: Fix long overflow in wynn-epsilon by casting to double Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f766e28 commit 97e74b6

28 files changed

+2185
-1655
lines changed

src/provisdom/math/combinatorics.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
Includes both exact computations for small values and log-space calculations for larger values to
1717
avoid overflow."
1818
(:require
19+
[clojure.core.reducers :as ccr]
1920
[clojure.spec.alpha :as s]
2021
[clojure.spec.gen.alpha :as gen]
21-
[clojure.core.reducers :as ccr]
2222
[provisdom.math.core :as m]
2323
[provisdom.math.special-functions :as special-fns]))
2424

@@ -38,7 +38,7 @@
3838
(s/def ::replacement-count
3939
(s/with-gen
4040
::m/int-non-
41-
#(gen/large-integer* {:min 0 :max mdl})))
41+
#(gen/large-integer* {:max mdl :min 0})))
4242

4343
(defn- n-no-less-than-k?
4444
[{:keys [k n]}]
@@ -185,7 +185,7 @@
185185
(s/fdef rising-factorial
186186
:args (s/with-gen
187187
(s/cat :x ::m/num :n ::m/int-non-)
188-
#(gen/tuple (s/gen ::m/num) (gen/large-integer* {:min 0 :max 20})))
188+
#(gen/tuple (s/gen ::m/num) (gen/large-integer* {:max 20 :min 0})))
189189
:ret ::m/number)
190190

191191
(def pochhammer-symbol
@@ -213,7 +213,7 @@
213213
(s/fdef falling-factorial
214214
:args (s/with-gen
215215
(s/cat :x ::m/num :n ::m/int-non-)
216-
#(gen/tuple (s/gen ::m/num) (gen/large-integer* {:min 0 :max 20})))
216+
#(gen/tuple (s/gen ::m/num) (gen/large-integer* {:max 20 :min 0})))
217217
:ret ::m/num)
218218

219219
(def falling-pochhammer-symbol
@@ -437,10 +437,10 @@
437437
(s/and (s/cat :k ::m/long-non- :n ::m/long-non-)
438438
n-no-less-than-k?)
439439
#(gen/bind
440-
(gen/large-integer* {:min 0 :max 15})
440+
(gen/large-integer* {:max 15 :min 0})
441441
(fn [k]
442442
(gen/fmap (fn [n] [k n])
443-
(gen/large-integer* {:min k :max 15})))))
443+
(gen/large-integer* {:max 15 :min k})))))
444444
:ret ::m/num)
445445

446446
(defn stirling-number-of-the-first-kind'
@@ -453,10 +453,10 @@
453453
(s/and (s/cat :k ::m/long-non- :n ::m/long-non-)
454454
n-no-less-than-k?)
455455
#(gen/bind
456-
(gen/large-integer* {:min 0 :max 15})
456+
(gen/large-integer* {:max 15 :min 0})
457457
(fn [k]
458458
(gen/fmap (fn [n] [k n])
459-
(gen/large-integer* {:min k :max 15})))))
459+
(gen/large-integer* {:max 15 :min k})))))
460460
:ret ::m/num)
461461

462462
(defn bell-number
@@ -602,12 +602,12 @@
602602
:two (s/and (s/cat :k ::m/int-non- :n ::m/int-non-)
603603
n-no-less-than-k?))
604604
#(gen/one-of
605-
[(gen/fmap vector (gen/large-integer* {:min 0 :max 20}))
605+
[(gen/fmap vector (gen/large-integer* {:max 20 :min 0}))
606606
(gen/bind
607-
(gen/large-integer* {:min 0 :max 20})
607+
(gen/large-integer* {:max 20 :min 0})
608608
(fn [k]
609609
(gen/fmap (fn [n] [k n])
610-
(gen/large-integer* {:min k :max 20}))))]))
610+
(gen/large-integer* {:max 20 :min k}))))]))
611611
:ret ::m/num)
612612

613613
;;;INTEGER PARTITIONS
@@ -649,11 +649,11 @@
649649
:args (s/with-gen
650650
(s/cat :n ::m/int-non- :max-part (s/? ::m/int-non-))
651651
#(gen/one-of
652-
[(gen/fmap vector (gen/large-integer* {:min 0 :max 15}))
652+
[(gen/fmap vector (gen/large-integer* {:max 15 :min 0}))
653653
(gen/fmap (fn [[n mp]] [n mp])
654654
(gen/tuple
655-
(gen/large-integer* {:min 0 :max 15})
656-
(gen/large-integer* {:min 0 :max 15})))]))
655+
(gen/large-integer* {:max 15 :min 0})
656+
(gen/large-integer* {:max 15 :min 0})))]))
657657
:ret (s/coll-of (s/coll-of ::m/int-non-)))
658658

659659
(defn count-integer-partitions

0 commit comments

Comments
 (0)