1
0
mirror of synced 2026-05-04 23:26:25 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/17-4-BIT-NOR.TEST

58 lines
1.7 KiB
Plaintext

;; Function To Be Tested: bit-nor
;;
;; Source: Common Lisp by Guy Steele
;; Section 17.4: Functions on Arrays of Bits Page: 294
;;
;; Created By: John Park
;;
;; Creation Date: June 11, 86
;;
;; Last Update:
;;
;; Filed as: {eris}<lispcore>cml>test>17-4-bit-nor.test
;;
;; Syntax: bit-nor bit-array1 bit-array2 &optional result-bit-array
;;
;; Function Description: This function performs bit-wise logical Not-OR
;; operation and stores the result in a newly created array. If an array is
;; specified, that array is used to store the result. If t is specified, the
;; result is destructively stored in bit-array1.
;;
;; Argument(s): bit-array1 bit-array2 t or result-bit-array
;; Returns: array with result of bit-wise Not-OR operation.
;;
;; Constraints/limitations: None
(do-test-group bit-nor-tests
:before (progn (setq bit-array1
(make-array 4 :element-type 'bit
:initial-contents '(0 0 1 1)))
(setq bit-array2
(make-array 4 :element-type 'bit
:initial-contents '(0 1 0 1)))
(setq result-bit-array
(make-array 4 :element-type 'bit)))
(do-test bit-nor-test1
(and (bit-nor bit-array1 bit-array2 result-bit-array)
(eq (bit result-bit-array 0) 1)
(eq (bit result-bit-array 1) 0)
(eq (bit result-bit-array 2) 0)
(eq (bit result-bit-array 3) 0)))
(do-test bit-nor-test2
(and (setq new-bit-array (bit-nor bit-array1 bit-array2))
(eq (bit new-bit-array 0) 1)
(eq (bit new-bit-array 1) 0)
(eq (bit new-bit-array 2) 0)
(eq (bit new-bit-array 3) 0)))
(do-test bit-nor-test3
(and (bit-nor bit-array1 bit-array2 t)
(eq (bit bit-array1 0) 1)
(eq (bit bit-array1 1) 0)
(eq (bit bit-array1 2) 0)
(eq (bit bit-array1 3) 0))))
STOP