1
0
Fork 0
lesson-lisp/tests/equiv.scm

54 lines
1.8 KiB
Scheme
Raw Normal View History

2023-05-07 10:11:11 -04:00
;;; equal? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; No args
(assert-true (equal?))
; A single arg
(assert-true (equal? '()))
(assert-true (equal? +))
(assert-true (equal? (cons 123 456)))
(assert-true (equal? #false))
(assert-true (equal? #true))
;(assert-true (equal? #\n))
(assert-true (equal? 'foo))
(assert-true (equal? "foo"))
(assert-true (equal? 123))
; Two equal args
(assert-true (equal? '() '()))
(assert-true (equal? + +))
(assert-true (equal? (cons 123 456) (cons 123 456)))
(assert-true (equal? #false #false))
(assert-true (equal? #true #true))
;(assert-true (equal? #\n #\n))
(assert-true (equal? 'foo 'foo))
(assert-true (equal? "foo" "foo"))
(assert-true (equal? 123 123))
; Two different args
(assert-false (equal? '() '(1)))
(assert-false (equal? + -))
(assert-false (equal? (cons 123 456) (cons 123 789)))
(assert-false (equal? #false #true))
(assert-false (equal? #true #false))
;(assert-false (equal? #\n #\t))
(assert-false (equal? 'foo 'bar))
(assert-false (equal? "foo" "bar"))
(assert-false (equal? 123 789))
; Three equal args
(assert-true (equal? '() '() '()))
(assert-true (equal? + + +))
(assert-true (equal? (cons 123 456) (cons 123 456) (cons 123 456)))
(assert-true (equal? #false #false #false))
(assert-true (equal? #true #true #true))
;(assert-true (equal? #\n #\n #\n))
(assert-true (equal? 'foo 'foo 'foo))
(assert-true (equal? "foo" "foo" "foo"))
(assert-true (equal? 123 123 123))
; Three different args
(assert-false (equal? '() '() '(1)))
(assert-false (equal? + + -))
(assert-false (equal? (cons 123 456) (cons 123 456) (cons 123 789)))
(assert-false (equal? #false #false #true))
(assert-false (equal? #true #true #false))
;(assert-false (equal? #\n #\n #\t))
(assert-false (equal? 'foo 'foo 'bar))
(assert-false (equal? "foo" "foo" "bar"))
(assert-false (equal? 123 123 789))