Add tests to 2.58
parent
30a08639b8
commit
d343170831
|
@ -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)
|
|
@ -0,0 +1,6 @@
|
|||
(load "util.scm")
|
||||
|
||||
(display "\nex-2.59") (newline)
|
||||
|
||||
|
||||
(display "\nex-2.60") (newline)
|
Loading…
Reference in New Issue