/[cells]/cells/test-ephemeral.lisp
ViewVC logotype

Contents of /cells/test-ephemeral.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Fri Dec 9 18:59:33 2005 UTC (8 years, 4 months ago) by ktilton
Branch: MAIN
CVS Tags: HEAD
Add missing test files
1 ;; -*- mode: Lisp; Syntax: Common-Lisp; Package: cells; -*-
2 ;;;
3 ;;; Copyright (c) 1995,2003 by Kenneth William Tilton.
4 ;;;
5 ;;; Permission is hereby granted, free of charge, to any person obtaining a copy
6 ;;; of this software and associated documentation files (the "Software"), to deal
7 ;;; in the Software without restriction, including without limitation the rights
8 ;;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ;;; copies of the Software, and to permit persons to whom the Software is furnished
10 ;;; to do so, subject to the following conditions:
11 ;;;
12 ;;; The above copyright notice and this permission notice shall be included in
13 ;;; all copies or substantial portions of the Software.
14 ;;;
15 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 ;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 ;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 ;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 ;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 ;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 ;;; IN THE SOFTWARE.
22
23 (in-package :cells)
24
25
26 (defmodel m-ephem ()
27 ((m-ephem-a :cell :ephemeral :initform nil :initarg :m-ephem-a :accessor m-ephem-a)
28 (m-test-a :cell nil :initform nil :initarg :m-test-a :accessor m-test-a)
29 (m-ephem-b :cell :ephemeral :initform nil :initarg :m-ephem-b :accessor m-ephem-b)
30 (m-test-b :cell nil :initform nil :initarg :m-test-b :accessor m-test-b)))
31
32 (def-c-output m-ephem-a ()
33 (setf (m-test-a self) new-value))
34
35 (def-c-output m-ephem-b ()
36 (setf (m-test-b self) new-value))
37
38 (def-cell-test m-ephem
39 (let ((m (make-be 'm-ephem :m-ephem-a (c-in nil) :m-ephem-b (c? (* 2 (or (^m-ephem-a) 0))))))
40 (ct-assert (null (slot-value m 'm-ephem-a)))
41 (ct-assert (null (m-ephem-a m)))
42 (ct-assert (null (m-test-a m)))
43 (ct-assert (null (slot-value m 'm-ephem-b)))
44 (ct-assert (null (m-ephem-b m)))
45 (ct-assert (zerop (m-test-b m)))
46 (setf (m-ephem-a m) 3)
47 (ct-assert (null (slot-value m 'm-ephem-a)))
48 (ct-assert (null (m-ephem-a m)))
49 (ct-assert (eql 3 (m-test-a m)))
50 ;
51 (ct-assert (null (slot-value m 'm-ephem-b)))
52 (ct-assert (null (m-ephem-b m)))
53 (ct-assert (eql 6 (m-test-b m)))
54 ))
55
56
57

  ViewVC Help
Powered by ViewVC 1.1.5