1
0
mirror of synced 2026-05-05 07:34:31 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/12-8-MASK-FIELD.TEST

47 lines
1.2 KiB
Plaintext

;; Function To Be Tested: mask-field
;;
;; Source: Common Lisp by Guy Steele
;; Section 12.8: Byte Manipulation Functions
;; on Numbers Page: 226
;;
;; Created By: John Park
;;
;; Creation Date: July 24, 86
;;
;; Last Update:
;;
;; Filed as: {eris}<lispcore>cml>test>12-8-mask-field.test
;;
;; Syntax: mask-field bytespec integer
;;
;; Function Description: This is similar to ldb; however, the result contains
;; the specified byte of integer in the position specified by bytespec, rather
;; than in position 0 as with ldb. The result therefore agrees with integer
;; in the byte specified but has zero-bits everywhere else.
;;
;;
;; Argument(s): bytespec: list integer
;;
;; Returns: non-negative integer
;;
;; Constraints/limitations: None
(do-test-group mask-field-setup
:before (progn
(setq byte-spec8-0 (byte 8 0))
(setq byte-spec8-1 (byte 8 1))
(setq byte-spec8-2 (byte 8 2))
(setq byte-spec8-3 (byte 8 3))
(setq byte-spec8-4 (byte 8 4)))
(do-test mask-field-test
(and (eq (mask-field byte-spec8-0 15) 15)
(eq (mask-field byte-spec8-1 15) 14)
(eq (mask-field byte-spec8-2 15) 12)
(eq (mask-field byte-spec8-3 15) 8)
(eq (mask-field byte-spec8-4 15) 0))))
STOP