93 lines
2.7 KiB
Plaintext
93 lines
2.7 KiB
Plaintext
;; Function To Be Tested: USE (EXEC Command)
|
|
;;
|
|
;; Source: Xerox Common Lisp Implementation Notes (Lyric Beta Release)
|
|
;; Section 20.2 (The Evaluator), Page 26
|
|
;;
|
|
;; Section: The Evaluator
|
|
;;
|
|
;; Created By: John Park
|
|
;;
|
|
;; Creation Date: Feb 4, 1987
|
|
;;
|
|
;; Last Update: Feb 27, 1987
|
|
;;
|
|
;; Filed As: {ERIS}<lispcore>test>exec>USE-event.u
|
|
;;
|
|
;;
|
|
;; Syntax: USE NEW [FOR OLD] [IN EventSpec]
|
|
;;
|
|
;; Function Description: Substitutes NEW for OLD in the events specified by
|
|
;; EventSpec, and redoes the result. NEW and OLD can include lists or symbols.
|
|
;;
|
|
;; Argument(s): EvenSpec (number or sequence)
|
|
;;
|
|
;; Returns: Results of substituted variables in the previous event
|
|
;;
|
|
;; Constraints/Limitations: Due to the nature of Programmer's Assistant commands,
|
|
;; testing them willbe accomplished by using the interlisp function bksysbuf
|
|
;; in do-test form. Comments are incorporated within each command file.
|
|
;; The do-test test setup is titled "USE", which executes the command
|
|
;; string. The do-test form within the command file will return T or "test "quote"
|
|
;; failed in file "unknown". " This test file requires TEDIT package.
|
|
;; The test result will be logged automatically in the following file:
|
|
;; {ERIS}<lispcore>test>exec>test.report
|
|
|
|
(DO-TEST "USE-TEST-SETUP"
|
|
(PROGN
|
|
(SETQ TEST-RESULT "{ERIS}<LISPCORE>TEST>EXEC>TEST.REPORT")
|
|
(DEFUN R-FORMAT (STATUS)
|
|
(FORMAT *OUTPUT* "~%COMMAND: USE ~%STATUS: ~A DATE: ~A TESTER: ~A~%" STATUS (IL:DATE) IL:USERNAME))
|
|
(SETQ USE-COMMAND-STRING
|
|
|
|
"(setq sin-val (sin 0))
|
|
;; The following will use COS instead of SIN in the previous event
|
|
USE COS for SIN
|
|
(= sin-val (cos 0)) ; Should return T
|
|
(setq val-1 (sin 1.5))
|
|
(setq val-2 (sin 2.0))
|
|
;; The following should substitute COS for every occurrence of SIN in the previous
|
|
;; two events, and substitute (- X) for every occurence of X, and reexecute them.
|
|
USE COS (- X) for SIN X IN -2 and -1
|
|
(and (= val-1 (cos -1.5))
|
|
(= val-2 (cos -2.0))
|
|
)
|
|
(fboundp 'tan)
|
|
(boundp 'sin)
|
|
(boundp 'pi)
|
|
(setq new-variable 'xyz)
|
|
;; The following should return nil
|
|
USE FBOUNDP FOR BOUNDP
|
|
(fboundp '*package*)
|
|
(boundp '*package*)
|
|
;; The following has the same effect as USE BOUNDP FOR FBOUNDP and should return T
|
|
USE BOUNDP FOR FBOUNDP IN F FBOUNDP
|
|
(setq sin 'trig-function)
|
|
;;
|
|
FBOUNDP(SIN)
|
|
;; The following is equivalent to USE BOUNDP FOR FBOUNDP IN -1
|
|
USE BOUNDP
|
|
(makunbound 'sin)
|
|
(DO-TEST 'USE-TEST-RESULT
|
|
(PROG2 (SETQ *OUTPUT* (OPEN TEST-RESULT :DIRECTION :OUTPUT
|
|
:IF-EXISTS :APPEND))
|
|
(IF (AND (= SIN-VAL (COS 0))
|
|
(AND (= VAL-1 (COS -1.5))
|
|
(= VAL-2 (COS -2.0))
|
|
)
|
|
)
|
|
(PROGN (R-FORMAT 'SUCCESS) T)
|
|
(PROGN (R-FORMAT 'FAIL) NIL))
|
|
(CLOSE *OUTPUT*)
|
|
)
|
|
)
|
|
")
|
|
|
|
(IL:BKSYSBUF USE-COMMAND-STRING)
|
|
)
|
|
)
|
|
STOP
|
|
|
|
|
|
|
|
|