blob: 588b16db352e10a6890c648f19b4c5d571135da0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
(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))))
|