From 43f06890e2689af2ef54c4480fe5790692a24f65 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Wed, 11 Oct 2023 10:04:04 -0600 Subject: deprecate common lisp solutions and write c; it's too much effort to keep up with the requirements for an archive. --- deprecated-cl/tests,approx.lisp | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 deprecated-cl/tests,approx.lisp (limited to 'deprecated-cl/tests,approx.lisp') diff --git a/deprecated-cl/tests,approx.lisp b/deprecated-cl/tests,approx.lisp new file mode 100644 index 0000000..678ff8c --- /dev/null +++ b/deprecated-cl/tests,approx.lisp @@ -0,0 +1,48 @@ +(defpackage lizfcm/tests.approx + (:use :cl + :fiveam + :lizfcm.approx + :lizfcm.utils + :lizfcm/tests) + (:export :approx-suite)) +(in-package :lizfcm/tests.approx) + +(def-suite approx-suite + :in lizfcm-test-suite) +(in-suite approx-suite) + +(test central-derivative-at + :description "derivative at is within bounds" + (let ((f (lambda (x) (* x x))) + (x 2) + (accepted-delta 0.02) + (f-prime-at-x 4) + (delta 0.01)) + (is (within-range-p + (central-derivative-at f x delta) + f-prime-at-x + accepted-delta)))) + +(test fwd-derivative-at + :description "forward derivative at is within bounds" + (let ((f (lambda (x) (* x x))) + (x 2) + (accepted-delta 0.02) + (f-prime-at-x 4) + (delta 0.01)) + (is (within-range-p + (forward-derivative-at f x delta) + f-prime-at-x + accepted-delta)))) + +(test bwd-derivative-at + :description "backward derivative at is within bounds" + (let ((f (lambda (x) (* x x))) + (x 2) + (accepted-delta 0.02) + (f-prime-at-x 4) + (delta 0.01)) + (is (within-range-p + (backward-derivative-at f x delta) + f-prime-at-x + accepted-delta)))) -- cgit v1.2.3-70-g09d2