;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright Â© 2016,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Mes.
;;;
;;; GNU Mes is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Mes is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>

;; Setup output file
(set-current-output-port (open-output-file "test/results/test021.answer"))

(define (newline) (display #\newline))

;; Testing char?
(display "Testing char?\n")
(display (char? #\newline))
(newline)
(display (char? (list 1 2 3)))
(newline)
(display (char? 42))
(newline)
(display (char? '()))
(newline)
(display (char? (cons 1 2)))
(newline)
(display (char? '+))
(newline)
(display (char? 'newline))
(newline)
(display (char? "string"))
(newline)
(display (char? 'foo))
(newline)
(display (char? #(1 2 3)))
(newline)

;; Testing list?
(display "Testing list?\n")
(display (list? #\newline))
(newline)
(display (list? (list 1 2 3)))
(newline)
(display (list? 42))
(newline)
(display (list? '()))
(newline)
(display (list? (cons 1 2)))
(newline)
(display (list? '+))
(newline)
(display (list? 'newline))
(newline)
(display (list? "string"))
(newline)
(display (list? 'foo))
(newline)
(display (list? #(1 2 3)))
(newline)

;; Testing number?
(display "Testing number?\n")
(display (number? #\newline))
(newline)
(display (number? (list 1 2 3)))
(newline)
(display (number? 42))
(newline)
(display (number? '()))
(newline)
(display (number? (cons 1 2)))
(newline)
(display (number? '+))
(newline)
(display (number? 'newline))
(newline)
(display (number? "string"))
(newline)
(display (number? 'foo))
(newline)
(display (number? #(1 2 3)))
(newline)

;; Testing null?
(display "Testing null?\n")
(display (null? #\newline))
(newline)
(display (null? (list 1 2 3)))
(newline)
(display (null? 42))
(newline)
(display (null? '()))
(newline)
(display (null? (cons 1 2)))
(newline)
(display (null? '+))
(newline)
(display (null? 'newline))
(newline)
(display (null? "string"))
(newline)
(display (null? 'foo))
(newline)
(display (null? #(1 2 3)))
(newline)

;; Testing pair?
(display "Testing pair?\n")
(display (pair? #\newline))
(newline)
(display (pair? (list 1 2 3)))
(newline)
(display (pair? 42))
(newline)
(display (pair? '()))
(newline)
(display (pair? (cons 1 2)))
(newline)
(display (pair? '+))
(newline)
(display (pair? 'newline))
(newline)
(display (pair? "string"))
(newline)
(display (pair? 'foo))
(newline)
(display (pair? #(1 2 3)))
(newline)

;; Testing procedure?
(display "Testing procedure?\n")
(display (procedure? #\newline))
(newline)
(display (procedure? (list 1 2 3)))
(newline)
(display (procedure? 42))
(newline)
(display (procedure? '()))
(newline)
(display (procedure? (cons 1 2)))
(newline)
(display (procedure? '+))
(newline)
(display (procedure? 'newline))
(newline)
(display (procedure? "string"))
(newline)
(display (procedure? 'foo))
(newline)
(display (procedure? #(1 2 3)))
(newline)

;; Testing string?
(display "Testing string?\n")
(display (string? #\newline))
(newline)
(display (string? (list 1 2 3)))
(newline)
(display (string? 42))
(newline)
(display (string? '()))
(newline)
(display (string? (cons 1 2)))
(newline)
(display (string? '+))
(newline)
(display (string? 'newline))
(newline)
(display (string? "string"))
(newline)
(display (string? 'foo))
(newline)
(display (string? #(1 2 3)))
(newline)

;; Testing symbol?
(display "Testing symbol?\n")
(display (symbol? #\newline))
(newline)
(display (symbol? (list 1 2 3)))
(newline)
(display (symbol? 42))
(newline)
(display (symbol? '()))
(newline)
(display (symbol? (cons 1 2)))
(newline)
(display (symbol? '+))
(newline)
(display (symbol? 'newline))
(newline)
(display (symbol? "string"))
(newline)
(display (symbol? 'foo))
(newline)
(display (symbol? #(1 2 3)))
(newline)

;; Testing vector?
(display "Testing vector?\n")
(display (vector? #\newline))
(newline)
(display (vector? (list 1 2 3)))
(newline)
(display (vector? 42))
(newline)
(display (vector? '()))
(newline)
(display (vector? (cons 1 2)))
(newline)
(display (vector? '+))
(newline)
(display (vector? 'newline))
(newline)
(display (vector? "string"))
(newline)
(display (vector? 'foo))
(newline)
(display (vector? #(1 2 3)))
(newline)

;; Testing defined?
(display "Testing defined?\n")
(display (defined? 'foo))
(newline)

(define foo 42)
(display (defined? 'foo))
(newline)

(display (defined? 'bar))
(newline)

(define (bar a b) (+ a b))
(display (defined? 'bar))
(newline)

(exit 0)
