123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- ;;; 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/test018.answer"))
- ; Test integer functionality
- (display "= tests:\n")
- (display (= 0 0 0 0 0 0 0 0 0))
- (display #\newline)
- (display (= -1 -1))
- (display #\newline)
- (display (= 1 1))
- (display #\newline)
- (display (= -1 1))
- (display #\newline)
- (display (= 1 -1))
- (display #\newline)
- (display "> tests:\n")
- (display (> 4 3 2 1 0 -1 -2 -3 -4))
- (display #\newline)
- (display (> -1 -1))
- (display #\newline)
- (display (> 1 1))
- (display #\newline)
- (display (> -1 1))
- (display #\newline)
- (display (> 1 -1))
- (display #\newline)
- (display ">= tests:\n")
- (display (> 4 3 2 1 0 0 0 -1 -2 -3 -4))
- (display #\newline)
- (display (> -1 -1))
- (display #\newline)
- (display (> 1 1))
- (display #\newline)
- (display (> -1 1))
- (display #\newline)
- (display (> 1 -1))
- (display #\newline)
- (display "< tests:\n")
- (display (< -4 -3 -2 -1 0 1 2 3 4))
- (display #\newline)
- (display (< -1 -1))
- (display #\newline)
- (display (< 1 1))
- (display #\newline)
- (display (< -1 1))
- (display #\newline)
- (display (< 1 -1))
- (display #\newline)
- (display "<= tests:\n")
- (display (<= -4 -3 -2 -1 0 0 0 1 2 3 4))
- (display #\newline)
- (display (<= -1 -1))
- (display #\newline)
- (display (<= 1 1))
- (display #\newline)
- (display (<= -1 1))
- (display #\newline)
- (display (<= 1 -1))
- (display #\newline)
- ; Test char functionality
- (display "char=? tests:\n")
- (display (char=? #\A #\A #\A #\A #\A))
- (display #\newline)
- (display (char=? #\B #\B))
- (display #\newline)
- (display (char=? #\C #\C))
- (display #\newline)
- (display (char=? #\B #\C))
- (display #\newline)
- (display (char=? #\C #\B))
- (display #\newline)
- ; Test string functionality
- (display "string=? tests:\n")
- (display (string=? "" "" "" "" ""))
- (display #\newline)
- (display (string=? "foo" "foo"))
- (display #\newline)
- (display (string=? "bar" "bar"))
- (display #\newline)
- (display (string=? "foo" "bar"))
- (display #\newline)
- (display (string=? "bar" "foo"))
- (display #\newline)
- ; Test eq? functionality per r7rs
- (display "\neq? tests:\n")
- (display (eq? 'a 'a))
- (display #\newline)
- ;; WTF guile shell shows #t and put it in file and it is #f??
- (display (eq? '(a) '(a)))
- (display #\newline)
- (display (eq? (list 'a) (list 'a)))
- (display #\newline)
- ;; WTF guile shell shows #t and put it in file and it is #f??
- (display (eq? "a" "a"))
- (display #\newline)
- (display (eq? "" ""))
- (display #\newline)
- (display (eq? '() '()))
- (display #\newline)
- (display (eq? 2 2))
- (display #\newline)
- (display (eq? #\A #\A))
- (display #\newline)
- (display (eq? car car))
- (display #\newline)
- (display (let ((n (+ 2 3))) (eq? n n)))
- (display #\newline)
- (display (let ((n '(a))) (eq? n n)))
- (display #\newline)
- (display (let ((n '#())) (eq? n n)))
- (display #\newline)
- (display (let ((p (lambda (x) x))) (eq? p p)))
- (display #\newline)
- ; Test equal? functionality per r7rs
- (display "\nequal? tests:\n")
- (display (equal? 'a 'a))
- (display #\newline)
- (display (equal? '(a) '(a)))
- (display #\newline)
- (display (equal? '(a (b) c) '(a (b) c)))
- (display #\newline)
- (display (equal? "abc" "abc"))
- (display #\newline)
- (display (equal? 2 2))
- (display #\newline)
- (display (equal? (make-vector 5 'a) (make-vector 5 'a)))
- (display #\newline)
- (display (equal? (lambda (x) x) (lambda (y) y)))
- (display #\newline)
- ;; Now to test further
- (display (equal? (cons 1 2) (cons 1 2)))
- (display #\newline)
- (display (equal? (cons 1 2) (cons 1 '())))
- (display #\newline)
- (display (equal? #((cons 1 2) (cons 3 '())) #((cons 1 2) (cons 3 '()))))
- (display #\newline)
- (display (equal? #((cons 1 2) (cons 3 '())) #((cons 1 2) (cons 4 '()))))
- (display #\newline)
- (display (equal? (list #(1 2) #(3 4)) (list #(1 2) #(3 4))))
- (display #\newline)
- (display (equal? (list #(1 2) #(3 4)) (list #(1 2) #(3 5))))
- (display #\newline)
- (exit 0)
|