1
0
mirror of synced 2026-04-30 21:49:38 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/12-4--.TEST

79 lines
2.2 KiB
Plaintext

;; Function To Be Tested: -
;;
;; Source: Guy L Steele's CLTL
;; Section: 12.4 Arithmetic Operations
;; Page: 199
;;
;; Created By: Kelly Roach
;;
;; Creation Date: July 12,1986
;;
;; Last Update: July 12,1986
;;
;; Filed As: {ERIS}<LISPCORE>CML>TEST>12-4-MINUS.TEST
;;
;;
;; Syntax: (- &REST NUMBERS)
;;
;; Function Description:
;; The function -, when given one argument, returns the negative
;; of that argument.
;;
;; The function -, when given more than one argument, successively subtracts
;; from the first argument all the others, and returns the result.
;; For example, (- 3 4 5) => -6.
;;
;; Compatibility note: While - is compatible with its use in Zetalisp,
;; it is incompatible with Maclisp, which uses - for fixnum-only
;; subtraction.
;; Also, - differs from DIFFERENCE as used in most Lisp
;; systems in the case of one argument.
;;
;; Argument(s): NUMBERS - numbers
;;
;; Returns: a number
;;
(DO-TEST MINUS-TEST1
(AND (= (- 0) 0)
(= (- 1) -1)
(= (- -1) 1)
(= (- 10 20) -10)
(= (- 10 -20) 30)
(= (- -100 -200) 100)
(= (- -100 200) -300)
(= (- 1000 2000 3000) -4000)
(= (- 10000 20000 30000 40000) -80000)
(= (- -10000 20000 -30000 40000) -40000)))
(DO-TEST MINUS-TEST2
(AND (= (- 1000000 2000000) -1000000)
(= (- 1000000 -2000000) 3000000)
(= (- -10000000 -20000000) 10000000)
(= (- -10000000 20000000) -30000000)
(= (- 100000000 200000000 300000000) -400000000)
(= (- 1000000000 2000000000 3000000000 4000000000)
-8000000000)
(= (- -1000000000 2000000000 -3000000000 4000000000)
-4000000000)))
(DO-TEST MINUS-TEST3
(AND (= (- (/ 1 2) (/ 1 2)) 0)
(= (- (/ 2 3) (/ 1 3)) (/ 1 3))
(= (- (/ 5 6) (/ 1 6)) (/ 2 3))
(= (- (/ 1 2) (/ 1 3)) (/ 1 6))
(= (- (/ 1 2) (/ -1 2)) 1)
(= (- (/ 2 3) (/ -1 3)) 1)
(= (- (/ 5 6) (/ -1 6)) 1)
(= (- (/ 1 2) (/ -1 3)) (/ 5 6))
(= (- (/ -1 2) (/ 1 2)) -1)
(= (- (/ -2 3) (/ 1 3)) -1)
(= (- (/ -5 6) (/ 1 6)) -1)
(= (- (/ -1 2) (/ 1 3)) (/ -5 6))
(= (- (/ -1 2) (/ -1 2)) 0)
(= (- (/ -2 3) (/ -1 3)) (/ -1 3))
(= (- (/ -5 6) (/ -1 6)) (/ -2 3))
(= (- (/ -1 2) (/ -1 3)) (/ -1 6))))
STOP