1
0
mirror of synced 2026-05-01 14:06:47 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/12-4-+.TEST

74 lines
2.0 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-PLUS.TEST
;;
;;
;; Syntax: (+ &REST NUMBERS)
;;
;; Function Description:
;; This returns the sum of the arguments. If there are no arguments, the result
;; is 0, which is an identity for this operation.
;;
;; Compatibility note: While + is compatible with its use in Zetalisp,
;; it is incompatible with Maclisp, which uses + for fixnum-only
;; addition.
;;
;; Argument(s): NUMBERS - numbers
;;
;; Returns: a number
;;
(DO-TEST PLUS-TEST1
(AND (= (+) 0)
(= (+ 0) 0)
(= (+ 1) 1)
(= (+ -1) -1)
(= (+ 10 20) 30)
(= (+ 10 -20) -10)
(= (+ -100 -200) -300)
(= (+ -100 200) 100)
(= (+ 1000 2000 3000) 6000)
(= (+ 10000 20000 30000 40000) 100000)
(= (+ -10000 20000 -30000 40000) 20000)))
(DO-TEST PLUS-TEST2
(AND (= (+ 1000000 2000000) 3000000)
(= (+ 1000000 -2000000) -1000000)
(= (+ -10000000 -20000000) -30000000)
(= (+ -10000000 20000000) 10000000)
(= (+ 100000000 200000000 300000000) 600000000)
(= (+ 1000000000 2000000000 3000000000 4000000000)
10000000000)
(= (+ -1000000000 2000000000 -3000000000 4000000000)
2000000000)))
(DO-TEST PLUS-TEST3
(AND (= (+ (/ 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))
(= (+ (/ -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))))
STOP