47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
;; Function To Be Tested: lognand
|
|
;;
|
|
;; Source: Common Lisp by Guy Steele
|
|
;; Section 12.7: Logical Operations on Numbers Page: 221
|
|
;;
|
|
;; Created By: John Park
|
|
;;
|
|
;; Creation Date: July 11, 86
|
|
;;
|
|
;; Last Update:
|
|
;;
|
|
;; Filed as: {eris}<lispcore>cml>test>12-7-lognand.test
|
|
;;
|
|
;; Syntax: lognand integer1 integer2
|
|
;;
|
|
;; Function Description:
|
|
;; These are the other six non-trivial bit-wise logical operations
|
|
;; on two arguments. Because they are not associative,
|
|
;; they take exactly two arguments rather than any non-negative number
|
|
;; of arguments.
|
|
;;
|
|
;;
|
|
;; (LOGNAND N1 N2) = (LOGNOT (LOGAND N1 N2))
|
|
;; (LOGNOR N1 N2) = (LOGNOT (LOGIOR N1 N2))
|
|
;; (LOGANDC1 N1 N2) = (LOGAND (LOGNOT N1) N2)
|
|
;; (LOGANDC2 N1 N2) = (LOGAND N1 (LOGNOT N2))
|
|
;; (LOGIORC1 N1 N2) = (LOGIOR (LOGNOT N1) N2)
|
|
;; (LOGIORC2 N1 N2) = (LOGIOR N1 (LOGNOT N2))
|
|
;;
|
|
;;
|
|
;; Argument(s): INTEGER1 - an integer
|
|
;; INTEGER2 - an integer
|
|
;;
|
|
;; Returns: a number
|
|
;;
|
|
|
|
|
|
|
|
(do-test lognand-test
|
|
(and (eq (logand 1 (lognand 0 0)) 1)
|
|
(eq (logand 1 (lognand 0 1)) 1)
|
|
(eq (logand 1 (lognand 1 0)) 1)
|
|
(eq (logand 1 (lognand 1 1)) 0)))
|
|
|
|
|
|
STOP
|