1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: cl-photo-tests.lisp
6 ;;;; Purpose: Cl-Photo tests file
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Apr 2003
12 ;;;; This file is Copyright (c) 2000-2003 by Kevin M. Rosenberg
13 ;;;; *************************************************************************
15 (defpackage #:cl-photo-tests
16 (:use #:cl-photo #:cl #:rtest #:kmrcl))
17 (in-package #:cl-photo-tests)
21 (defun verify-results (alist blist)
24 (lambda (a b) (numbers-within-percentage a b 0.01))
27 (defmacro def-numeric-test (name test &rest values)
29 (let ((results (multiple-value-list ,test)))
30 (verify-results results ',values))
34 :gl.1 (gaussian-lens :focal-length 50 :object-distance 100) 100)
37 :gl.2 (gaussian-lens :focal-length 50 :image-distance 200) 66.66667)
40 :gl.3 (gaussian-lens :object-distance 100 :image-distance 100) 50)
43 :aov.1 (aov 50 36 24) 39.5977 26.9915 46.7930)
46 :fov.1 (fov 50 24 16 :magnification 1 :units :mm)
47 24 16 28.8444 1 100 100)
50 :fov.2 (fov 50 24 16 :magnification 1 :units :feet)
51 0.07874 0.052494 0.094634 1 0.328084 100)
54 :fov.3 (fov 50 24 16 :image-distance 100 :units :mm)
55 24 16 28.8444 1 100 100)
58 :fov.4 (fov 50 24 16 :image-distance 100 :units :feet)
59 0.07874 0.052494 0.094634 1 0.328084 100)
62 :fov.5 (fov 50 24 16 :object-distance 100 :units :mm)
63 24 16 28.8444 1 100 100)
66 :fov.6 (fov 50 24 16 :object-distance (cl-photo::mm->feet 100) :units :feet)
67 0.07874 0.052494 0.094634 1 0.328084 100)
70 :mag.1 (magnification :focal-length 50 :image-distance 100 :units :mm) 1)
73 :mag.2 (magnification :focal-length 50 :image-distance 100 :units :feet) 1)
76 :mag.3 (magnification :focal-length 50 :object-distance 100 :units :mm) 1)
79 :mag.4 (magnification :focal-length 50 :object-distance (cl-photo::mm->feet 100)
83 :mag.5 (magnification :image-distance 100 :object-distance 100 :units :mm) 1)
86 :mag.6 (magnification :image-distance 100 :object-distance (cl-photo::mm->feet 100)
90 :cu.1 (close-up :focal-length 65 :magnification 5 :units :mm)
94 :cu.2 (close-up :focal-length 65 :object-distance 78 :units :mm)
98 :cu.3 (close-up :focal-length 65 :image-distance 390 :units :mm)
102 :cu.4 (close-up :object-distance 78 :image-distance 390 :units :mm)
106 :cu.5 (close-up :object-distance 78 :magnification 5 :units :mm)
110 :cu.6 (close-up :image-distance 390 :magnification 5 :units :mm)
114 :cu.7 (close-up :focal-length 65 :magnification 5 :units :feet)
115 65 0.2559055 390 5 6)
118 :cu.8 (close-up :focal-length 65 :object-distance 0.2559055 :units :feet)
119 65 0.2559055 390 5 6)
122 :cu.9 (close-up :focal-length 65 :image-distance 390 :units :feet)
123 65 0.2559055 390 5 6)
126 :cu.10 (close-up :object-distance 0.2559055 :image-distance 390 :units :feet)
127 65 0.2559055 390 5 6)
130 :cu.11 (close-up :object-distance 0.2559055 :magnification 5 :units :feet)
131 65 0.2559055 390 5 6)
134 :cu.12 (close-up :image-distance 390 :magnification 5 :units :feet)
135 65 0.2559055 390 5 6)