summaryrefslogtreecommitdiff
path: root/cl/tests/approx.lisp
blob: 2fd81241638bf7e47aacaa9e5a035a2aeecb3b1a (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
(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 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
              (derivative-at f x delta)
              f-prime-at-x
              accepted-delta))))