Add tests to 2.58

main
Felix Martin 2020-11-13 11:38:23 -05:00
parent 30a08639b8
commit d343170831
2 changed files with 28 additions and 10 deletions

View File

@ -222,18 +222,30 @@
(else (go-multiplicand (cddr s)))))
(lift (go-multiplicand s)))
(define s '(a * b * (c * e) + d))
(define p '(a * b * (c + e) * d))
; some tests
(assert (sum? p) #f)
(assert (sum? s) #t)
(assert (product? p) #t)
(assert (product? s) #f)
(assert (multiplier p) 'a)
(assert (multiplicand p) '(b * (c + e) * d))
(assert (addend s) '(a * b * (c * e)))
(assert (augend s) 'd)
(assert (product? '(x * x + x)) #f)
(assert (multiplier '(x * x * x)) 'x)
(assert (multiplicand '(x * x * x)) '(x * x))
(assert (addend '(a + b)) 'a)
(assert (augend '(a + b)) 'b)
(assert (multiplier '(a * b)) 'a)
(assert (multiplicand '(a * b)) 'b)
(assert (product? '(x * x + x)) #f)
(assert (sum? '(x * x + x)) #t)
(define x-infix '(x + 3 * (x + y + 2)))
;(display (sum? x-infix)) (newline)
;(display (product? x-infix)) (newline)
;(display (addend x-infix)) (newline)
;(display (augend x-infix)) (newline)
;(display (multiplier x-infix)) (newline)
;(display (multiplicand x-infix)) (newline)
(display x-infix) (newline)
(display (deriv x-infix 'x)) (newline)
(display "\nex-2.59") (newline)
(display "\nex-2.60") (newline)

6
ex-2_59-xx.scm Normal file
View File

@ -0,0 +1,6 @@
(load "util.scm")
(display "\nex-2.59") (newline)
(display "\nex-2.60") (newline)