From e53d10f4eafaa64e6805c89cc1a1ec9eea5dabd3 Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Sun, 13 Jan 2008 11:41:17 +0100 Subject: [PATCH] protosystem tests for the new system. --- unittests-protoObj.lisp | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 unittests-protoObj.lisp diff --git a/unittests-protoObj.lisp b/unittests-protoObj.lisp new file mode 100644 index 0000000..7358b54 --- /dev/null +++ b/unittests-protoObj.lisp @@ -0,0 +1,77 @@ +;;; -*- mode: lisp -*- +;;; Copyright (c) 2007, by A.J. Rossini +;;; See COPYRIGHT file for any additional restrictions (BSD license). +;;; Since 1991, ANSI was finally finished. Edited for ANSI Common Lisp. + +;;; This is semi-external to lispstat core packages. The dependency +;;; should be that lispstat packages are dependencies for the unit +;;; tests. However, where they will end up is still to be +;;; determined. + +(in-package :cl-user) + +(defpackage :lisp-stat-unittests-proto + (:use :common-lisp :lift :lisp-stat-object-system) + (:export run-lisp-stat-proto-tests run-lisp-stat-proto-test scoreboard)) + +(in-package :lisp-stat-unittests) + +;;; TESTS + +(defun run-lisp-stat-tests () + (run-tests :suite 'lisp-stat)) + +(defun run-lisp-stat-test (&rest x) + (run-test x)) + + +(deftestsuite lisp-stat-object-system () ()) +(deftestsuite lisp-stat-proto-basic (lisp-stat-object-system) ()) +(deftestsuite lisp-stat-proto-use (lisp-stat-object-system) ()) + + +;; EXAMPLES, not for use + +#+nil(progn + (addtest (lisp-stat-lin-alg) eigen + (ensure-same + (eigen #2A((2 3 4) (1 2 4) (2 4 5))) + (list #(10.656854249492381 -0.6568542494923802 -0.9999999999999996) + (list #(0.4999999999999998 0.4999999999999997 0.7071067811865475) + #(-0.49999999999999856 -0.5000000000000011 0.7071067811865474) + #(0.7071067811865483 -0.7071067811865466 -1.2560739669470215e-15)) + NIL))) + + (addtest (lisp-stat-lin-alg) spline + (ensure-same + (spline #(1.0 1.2 1.3 1.8 2.1 2.5) + #(1.2 2.0 2.1 2.0 1.1 2.8) + :xvals 6) + (list (list 1.0 1.3 1.6 1.9 2.2 2.5) + (list 1.2 2.1 2.2750696543866313 1.6465231041904045 1.2186576148879609 2.8)) + :test 'almost=lists))) + +;;;; Object System tests + +(deftestsuite lisp-stat-proto-use (lisp-stat-object-system) + () + (:documentation "Make sure the proto object system is valid.") + (:tests + (create-proto (ensure (object-proto-p (defproto test-me)))) + (create-proto2 (ensure (object-proto-p (defproto2 test-me2)))) + (instance1 (ensure (send test-me :isnew))) + (instance1-2 (ensure (send test-me2 :isnew))) + (instance2 (ensure (send test-me :has-slot 'new))) + (instance2-2 (ensure (send test-me2 :has-slot 'new))) + + (instance5 (ensure (send test-me :has-slot 'new))) + (instance5-2 (ensure (send test-me2 :has-slot 'new))) + (instance5 (ensure (send test-me :own-slots 'new))) + (instance5-2 (ensure (send test-me2 :own-slots 'new))) + (instance5 (ensure (send test-me :has-slot 'new))) + (instance5-2 (ensure (send test-me2 :has-slot 'new))) + (instance5 (ensure (send test-me :has-slot 'new))) + (instance5-2 (ensure (send test-me2 :has-slot 'new))) + )) + + \ No newline at end of file -- 2.11.4.GIT