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

89 lines
2.8 KiB
Scheme

(begin
(displayln "--- TEST: boolean? ---------------------------------------------")
(displayln (boolean? +))
(displayln (boolean? '()))
(displayln (boolean? #true))
(displayln (boolean? #false))
;(displayln (boolean? #\n))
(displayln (boolean? 'foo))
(displayln (boolean? "foo"))
(displayln (boolean? 123))
(displayln (boolean? (cons 123 456)))
(newline)
(displayln "--- TEST: char? ------------------------------------------------")
(displayln (char? +))
(displayln (char? '()))
(displayln (char? #true))
(displayln (char? #false))
;(displayln (char? #\n))
(displayln (char? 'foo))
(displayln (char? "foo"))
(displayln (char? 123))
(displayln (char? (cons 123 456)))
(newline)
(displayln "--- TEST: null? ------------------------------------------------")
(displayln (null? +))
(displayln (null? '()))
(displayln (null? #true))
(displayln (null? #false))
;(displayln (null? #\n))
(displayln (null? 'foo))
(displayln (null? "foo"))
(displayln (null? 123))
(displayln (null? (cons 123 456)))
(newline)
(displayln "--- TEST: number? ----------------------------------------------")
(displayln (number? +))
(displayln (number? '()))
(displayln (number? #true))
(displayln (number? #false))
;(displayln (number? #\n))
(displayln (number? 'foo))
(displayln (number? "foo"))
(displayln (number? 123))
(displayln (number? (cons 123 456)))
(newline)
(displayln "--- TEST: pair? ------------------------------------------------")
(displayln (pair? +))
(displayln (pair? '()))
(displayln (pair? #true))
(displayln (pair? #false))
;(displayln (pair? #\n))
(displayln (pair? 'foo))
(displayln (pair? "foo"))
(displayln (pair? 123))
(displayln (pair? (cons 123 456)))
(newline)
(displayln "--- TEST: procedure? -------------------------------------------")
(displayln (procedure? +))
(displayln (procedure? '()))
(displayln (procedure? #true))
(displayln (procedure? #false))
;(displayln (procedure? #\n))
(displayln (procedure? 'foo))
(displayln (procedure? "foo"))
(displayln (procedure? 123))
(displayln (procedure? (cons 123 456)))
(newline)
(displayln "--- TEST: string? ----------------------------------------------")
(displayln (string? +))
(displayln (string? '()))
(displayln (string? #true))
(displayln (string? #false))
;(displayln (string? #\n))
(displayln (string? 'foo))
(displayln (string? "foo"))
(displayln (string? 123))
(displayln (string? (cons 123 456)))
(newline)
(displayln "--- TEST: symbol? ----------------------------------------------")
(displayln (symbol? +))
(displayln (symbol? '()))
(displayln (symbol? #true))
(displayln (symbol? #false))
;(displayln (symbol? #\n))
(displayln (symbol? 'foo))
(displayln (symbol? "foo"))
(displayln (symbol? 123))
(displayln (symbol? (cons 123 456)))
)