diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-09-27 09:53:37 -0600 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-09-27 09:53:37 -0600 |
commit | 1a8c81d07efe55c5a6909aff32359d4b8866af1c (patch) | |
tree | dbaf949a4d20226560d97ef9b48dbdcd71b7ad1a /cl/tests | |
parent | 5e85a662d21081bc27adc1142759659cca59cd62 (diff) | |
download | cmath-1a8c81d07efe55c5a6909aff32359d4b8866af1c.tar.gz cmath-1a8c81d07efe55c5a6909aff32359d4b8866af1c.zip |
keep unit tests but make directory structure more consistent with requirements i did not read
Diffstat (limited to 'cl/tests')
-rw-r--r-- | cl/tests/approx.lisp | 24 | ||||
-rw-r--r-- | cl/tests/maceps.lisp | 27 | ||||
-rw-r--r-- | cl/tests/suite.lisp | 10 | ||||
-rw-r--r-- | cl/tests/table.lisp | 31 | ||||
-rw-r--r-- | cl/tests/vector.lisp | 31 |
5 files changed, 0 insertions, 123 deletions
diff --git a/cl/tests/approx.lisp b/cl/tests/approx.lisp deleted file mode 100644 index 2fd8124..0000000 --- a/cl/tests/approx.lisp +++ /dev/null @@ -1,24 +0,0 @@ -(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)))) diff --git a/cl/tests/maceps.lisp b/cl/tests/maceps.lisp deleted file mode 100644 index cd5ced9..0000000 --- a/cl/tests/maceps.lisp +++ /dev/null @@ -1,27 +0,0 @@ -(defpackage lizfcm/tests.maceps - (:use :cl - :fiveam - :lizfcm.approx - :lizfcm.utils - :lizfcm/tests) - (:export :approx-suite)) -(in-package :lizfcm/tests.maceps) - -(def-suite maceps-suite - :in lizfcm-test-suite) -(in-suite maceps-suite) - -(test maceps - :description "double precision provides precision about (mac eps of single precision) squared" - (let* ((maceps-computation-double (compute-maceps (lambda (x) x) - 1.0d0 - 1.0d0)) - (maceps-computation-single (compute-maceps (lambda (x) x) - 1.0 - 1.0)) - (last-double-h (cadar (last maceps-computation-double))) - (last-single-h (cadar (last maceps-computation-single)))) - (is (within-range-p - (- last-double-h (* last-single-h last-single-h)) - 0 - last-single-h)))) diff --git a/cl/tests/suite.lisp b/cl/tests/suite.lisp deleted file mode 100644 index e23cfaf..0000000 --- a/cl/tests/suite.lisp +++ /dev/null @@ -1,10 +0,0 @@ -(in-package :cl-user) -(defpackage lizfcm/tests - (:use :cl - :fiveam) - (:export :run! - :lizfcm-test-suite)) -(in-package :lizfcm/tests) - -(def-suite lizfcm-test-suite - :description "The ultimate parent test suite") diff --git a/cl/tests/table.lisp b/cl/tests/table.lisp deleted file mode 100644 index 33d4e86..0000000 --- a/cl/tests/table.lisp +++ /dev/null @@ -1,31 +0,0 @@ -(defpackage lizfcm/tests.table - (:use :cl - :fiveam - :lizfcm.utils - :lizfcm/tests) - (:export :approx-suite)) -(in-package :lizfcm/tests.table) - -(def-suite table-suite - :in lizfcm-test-suite) -(in-suite table-suite) - -(defun fib (n) - (cond ((< n 2) n) - (t (+ (fib (- n 1)) (fib (- n 2)))))) - -(test table-of-fib-vals - :description "table generates correctly" - (let* ((headers '("n" "fib(n)")) - (n-values '((1) (2) (3) (4))) - (expected `(("n" "fib(n)") - (1 ,(fib 1)) - (2 ,(fib 2)) - (3 ,(fib 3)) - (4 ,(fib 4)))) - (tabled (lizfcm.utils:table (:headers headers - :domain-order (n) - :domain-values n-values) - (fib n)))) - (is (equal expected tabled)))) - diff --git a/cl/tests/vector.lisp b/cl/tests/vector.lisp deleted file mode 100644 index 3ffe5a8..0000000 --- a/cl/tests/vector.lisp +++ /dev/null @@ -1,31 +0,0 @@ -(defpackage lizfcm/tests.vector - (:use :cl - :fiveam - :lizfcm.vector - :lizfcm.utils - :lizfcm/tests) - (:export :vector-suite)) -(in-package :lizfcm/tests.vector) - -(def-suite vector-suite - :in lizfcm-test-suite) -(in-suite vector-suite) - -(test p-norm - :description "computes p-norm" - (let ((v '(1 1)) - (length (sqrt 2)) - (2-norm (p-norm 2))) - (is (within-range-p (funcall 2-norm v) - length - 0.00001)))) - -(test vector-distance - :description "computes distance via norm" - (let ((v1 '(0 0)) - (v2 '(1 1)) - (dist (sqrt 2))) - (is (within-range-p (distance v1 v2 (p-norm 2)) - dist - 0.00001)))) - |