1
0
mirror of synced 2026-04-25 20:01:51 +00:00
Files
Interlisp.medley/internal/test/env/program-analysis/hand/browser-part1.u.~1~

177 lines
6.5 KiB
Plaintext

;; Function To Be Tested: BROWSER (Part I) (Program Analysis)
;;
;; Source: Lisp Library Modules Manual (Lyric Beta Release 2)
;; Browser, Page 11
;; Section: Program Analysis (Library)
;;
;; Created By: John Park
;;
;; Creation Date: March 10, 1987
;;
;; Last Update: March 12, 1987
;;
;; Filed As: {ERIS}<lispcore>test>program-analysis>browser-part1.u
;;
;;
;; Syntax: (BROWSER T/NIL)
;;
;; Function Description: BROWSER modifies the SHOW PATHS command of Masterscope so that
;; the command's output is displayed as an undirected graph. It creates a new window
;; for each SHOW PATHS command, but will reuse a window if that window has an earlier
;; instance of the same SHOW PATHS command displayed in it. Part 1 of this test is
;; to determine if masterscope is unaffected when the BROWSER is not enabled or
;; (IL:BROWSER NIL). Part I also tests to see if grapher is automatically loaded
;; by browser.
;;
;; Argument(s): T or NIL (SEE Browser documentation)
;;
;; Returns: IL:MSPATHS
;;
;; Constraints/Limitations: ; Part 1 of this test is to determine if masterscope is
;; unaffected when the BROWSER is not enabled or (IL:BROWSER NIL)
;; Part 2 tests masterscope modification by BROWSER. This is test part 2, which
;; is stored in {eris}<lispcore>test>program-analysis>browser-part2.u
;; Part 1 test must be run first before Part 2 test since the former loads functions
;; utilized by the latter. Since Browser calls LAYOUTFOREST module of GRAPHER to
;; display the graph at a user-designated location, user interface is required and
;; testing will not be totally automatic. Instructions will be given for user input
;; during testing. The test will utilize do-test and the interlisp function bksysfuf.
;; Comments or messages are incorporated within each command file, which will be run
;; by using the function bksysbuf. Each test setup is titled "BROWSER-TEST-SETUP",
;; which executes the command string. The do-test form within the command file will
;; return T or "testfailed" This test file requires MASTERSCOPE, TEDIT, BROWSER, and
;; GRAPHER packages
;;
;; The tree structure of the functions being analyzed are as follows:
;;
;; Top-GFuntion
;; |
;; GFun-A------------------------GFun-B
;; | |
;; --------------------- --------------------
;; | | | | | |
;; GFun-A1 GFun-A2 GFun-A3 GFun-B1 GFun-B2 GFun-B3
;; |
;; --------------
;; | |
;; GFun-C1 GFun-A1
;;
;;
;; Messages will be printed before each command in the command files is executed
;; for user monitoring. Test result is logged on
;; {eris}<lispcore>test>program-analysis>browser.report
(DO-TEST "BROWSER-TEST-SETUP"
(PROGN
(SETQ TEST-RESULT "{ERIS}<LISPCORE>TEST>PROGRAM-ANALYSIS>BROWSER.REPORT")
(DEFUN R-FORMAT (STATUS)
(FORMAT *OUTPUT* "~%COMMAND: MASTERSCOPE~%LISP VERSION: ~A ~%STATUS: ~A DATE: ~A TESTER: ~A~%" (LISP-IMPLEMENTATION-VERSION) STATUS (IL:DATE) IL:USERNAME))
(DEFUN ITEM-FORMAT-S (COMMAND-LANGUAGE)
(FORMAT *OUTPUT* "~%COMMAND: BROWSER TEST-ITEM: ~A~%LISP VERSION: ~A ~%STATUS: ~A DATE: ~A TESTER: ~A~%" COMMAND-LANGUAGE (LISP-IMPLEMENTATION-VERSION) 'SUCCESS (IL:DATE) IL:USERNAME))
(DEFUN ITEM-FORMAT-F (COMMAND-LANGUAGE)
(FORMAT *OUTPUT* "~%COMMAND: BROWSER TEST-ITEM: ~A~%LISP VERSION: ~A ~%STATUS: ~A DATE: ~A TESTER: ~A~%" COMMAND-LANGUAGE (LISP-IMPLEMENTATION-VERSION) 'FAIL (IL:DATE) IL:USERNAME))
(DEFUN PASS-FAIL (COMMAND-LANGUAGE TEST-ITEM)
(IF (EQ TEST-ITEM T) (ITEM-FORMAT-S COMMAND-LANGUAGE)
(ITEM-FORMAT-F COMMAND-LANGUAGE)))
(SETQ {CORE}PATHS "{CORE}PATHS")
(DEFUN PAUSE NIL (PROGN
(IL:PLAYTUNE '((262 . 15000) (440 . 15000) (349 . 15000)))
(SLEEP 2)))
(SETQ BROWSERW (IL:CREATEW '(100 100 325 90) NIL NIL T))
(SETQ BROWSER-COMMAND-STRING
";Loading browser will automatically load grapher package.
; This part of the test determines if grapher is loaded.
(PAUSE)
(IL:PAGEHEIGHT 0)
(DELETE 'IL:GRAPHER IL:SYSFILES)
(IL:LOAD? '{ERINYES}<LYRIC>LIBRARY>MASTERSCOPE.LCOM 'IL:SYSLOAD)
(IL:LOAD '{ERINYES}<LYRIC>LIBRARY>BROWSER.LCOM 'IL:SYSLOAD)
(IF (OR (MEMBER 'IL:GRAPHER IL:SYSFILES)
(MEMBER 'IL:GRAPHER IL:FILELST))
(SETQ GRAPHER-LDFLG T)
(PROGN (SETQ GRAPHER-LDFLG NIL)
(IL:LOAD '{ERINYES}<LYRIC>LIBRARY>GRAPHER.LCOM 'IL:SYSLOAD)))
; This part of test determines if the variables BROWSERFORMAT and BROWSERBOXING
; are bound.
(PAUSE)
(IF (AND (BOUNDP 'IL:BROWSERFORMAT) (BOUNDP 'IL:BROWSERBOXING))
(SETQ BROWSER-VARIABLES T)
(SETQ BROWSER-VARIABLES NIL))
; Reinitialize and Define functions to be analyzed....
(PAUSE)
. ERASE
(DEFUN TOP-GFUNTION NIL (AND (GFUN-A) (GFUN-B)))
(DEFUN GFUN-A NIL (OR (GFUN-A1) (GFUN-A2) (GFUN-A3)))
(DEFUN GFUN-B NIL (OR (GFUN-B1) (GFUN-B2) (GFUN-B3)))
(DEFUN GFUN-A1 NIL T)
(DEFUN GFUN-A2 NIL NIL)
(DEFUN GFUN-A3 NIL T)
(DEFUN GFUN-B1 NIL (AND (GFUN-C1)(GFUN-A1)))
(DEFUN GFUN-B2 NIL NIL)
(DEFUN GFUN-B3 NIL T)
(DEFUN GFUN-C1 NIL NIL)
; Start analyzing functions in gtop-function and others...
(PAUSE)
. ANALYZE TOP-GFUNTION
. ANALYZE GFUN-A
. ANALYZE GFUN-B
. ANALYZE GFUN-A1
. ANALYZE GFUN-A2
. ANALYZE GFUN-A3
. ANALYZE GFUN-B1
. ANALYZE GFUN-B2
. ANALYZE GFUN-B3
. ANALYZE GFUN-C1
; Browser is now loaded and activated
(PAUSE)
; Part 1 of this test is to determine if masterscope is unaffected when
; the BROWSER is not enabled or (IL:BROWSER NIL)
(IL:BROWSER NIL)
; Browser is now deactivated ...
(PAUSE)
; This will cause masterscope to diaplay graphs in a teletype mode
; or in the exec.
; show paths should display the following path, which should look like;
; 1.gfun-a1 gfun-a top-gfuntion
; 2. gfun-b1 gfun-b top-gfuntion
(PAUSE)
(DRIBBLE '{CORE}PATHS)
. SHOW PATHS TO GFUN-A1 FROM TOP-GFUNTION
(DRIBBLE)
; analyzing the file that contains the masterscope interaction (show paths)
(SETQ PATHS (OPEN {CORE}PATHS))
(DO (( i 0 (1+ i)))
((= i 5) t)
(READ-LINE PATHS))
(IF (AND (STRING-EQUAL (READ-LINE PATHS) '|1.gfun-a1 gfun-a top-gfuntion|)
(STRING-EQUAL (READ-LINE PATHS) '|2. gfun-b1 gfun-b top-gfuntion|))
(SETQ BROWSER-DISABLED-FLG T)(SETQ BROWSER-DISABLED-FLG NIL))
(CLOSE PATHS)
(DELETE-FILE '{CORE}PATHS)
(DO-TEST 'BROWSER-TEST-RESULT
(PROGN (SETQ *OUTPUT* (OPEN TEST-RESULT :DIRECTION :OUTPUT
:IF-EXISTS :APPEND))
(PASS-FAIL 'BROWSER-VARIABLES-BOUND? BROWSER-VARIABLES)
(PASS-FAIL 'GRAGPER-LOADED? GRAPHER-LDFLG)
(PASS-FAIL 'BROWSER-DISABLED BROWSER-DISABLED-FLG)
(CLOSE *OUTPUT*)
(IDENTITY T)
)
)
")
(IL:BKSYSBUF BROWSER-COMMAND-STRING)
)
)
STOP