;; -*-theme-d-*-

;; Copyright (C) 2014-2018  Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.

;; Expected results: translation and running OK

(define-proper-program (tests test234)

  (import (standard-library core)
	  (standard-library rational)
	  (standard-library real-math)
	  (standard-library complex)
	  (standard-library console-io)
	  (tests numerical-test-env))

  (define-simple-proc main (() <none> nonpure)
    (report-boolean-test (equal? 2 2) #t)
    (report-boolean-test (equal? 2 -5) #f)
    (report-boolean-test (equal? 2 (rational 2 1)) #f)
    (report-boolean-test (equal? 2 (rational -1 2)) #f)
    (report-boolean-test (equal? 2 2.0) #f)
    (report-boolean-test (equal? 2 -1.1) #f)
    (report-boolean-test (equal? 2 (complex 2.0 0.0)) #f)
    (report-boolean-test (equal? 2 (complex 2.0 1.0)) #f)
    (report-boolean-test (equal? (rational 2 2) 1) #f)
    (report-boolean-test (equal? (rational 2 3) 2) #f)
    (report-boolean-test (equal? (rational 2 2) (rational 3 3)) #t)
    (report-boolean-test (equal? (rational 2 3) (rational 4 5)) #f)
    (report-boolean-test (equal? (rational 4 5) 0.8) #f)
    (report-boolean-test (equal? (rational 2 3) 0.5) #f)
    (report-boolean-test (equal? (rational 4 5) (complex 0.8 0.0)) #f)    
    (report-boolean-test (equal? (rational 4 5) (complex 0.5 0.0)) #f)    
    (report-boolean-test (equal? 2.0 2) #f)
    (report-boolean-test (equal? 4.5 -5) #f)
    (report-boolean-test (equal? 4.5 (rational 9 2)) #f)
    (report-boolean-test (equal? 4.5 (rational -9 2)) #f)
    (report-boolean-test (equal? 4.5 4.5) #t)
    (report-boolean-test (equal? 4.5 -1.1) #f)
    (report-boolean-test (equal? 4.5 (complex 4.5 0.0)) #f)
    (report-boolean-test (equal? 4.5 (complex 0.3 1.0)) #f)
    (report-boolean-test (equal? (complex 1.0 0.0) 1) #f)
    (report-boolean-test (equal? (complex -1.0 2.0) -1) #f)
    (report-boolean-test (equal? (complex 0.2 0.0) (rational 1 5)) #f)
    (report-boolean-test (equal? (complex 0.2 1.0) (rational 2 5)) #f)
    (report-boolean-test (equal? (complex 0.2 0.0) 0.2) #f)
    (report-boolean-test (equal? (complex 0.2 0.0) 0.3) #f)
    (report-boolean-test (equal? (complex 5.0 4.0) (complex 5.0 4.0)) #t)
    (report-boolean-test (equal? (complex 5.0 4.0) (complex -5.0 4.0)) #f)
    (console-newline)

    (report-boolean-test (= 2 2) #t)
    (report-boolean-test (= 2 -5) #f)
    (report-boolean-test (= 2 (rational 2 1)) #t)
    (report-boolean-test (= 2 (rational -1 2)) #f)
    (report-boolean-test (= 2 2.0) #t)
    (report-boolean-test (= 2 -1.1) #f)
    (report-boolean-test (= 2 (complex 2.0 0.0)) #t)
    (report-boolean-test (= 2 (complex 2.0 1.0)) #f)
    (report-boolean-test (= (rational 2 2) 1) #t)
    (report-boolean-test (= (rational 2 3) 2) #f)
    (report-boolean-test (= (rational 2 2) (rational 3 3)) #t)
    (report-boolean-test (= (rational 2 3) (rational 4 5)) #f)
    (report-boolean-test (= (rational 4 5) 0.8) #t)
    (report-boolean-test (= (rational 2 3) 0.5) #f)
    (report-boolean-test (= (rational 4 5) (complex 0.8 0.0)) #t)    
    (report-boolean-test (= (rational 4 5) (complex 0.5 0.0)) #f)    
    (report-boolean-test (= 2.0 2) #t)
    (report-boolean-test (= 4.5 -5) #f)
    (report-boolean-test (= 4.5 (rational 9 2)) #t)
    (report-boolean-test (= 4.5 (rational -9 2)) #f)
    (report-boolean-test (= 4.5 4.5) #t)
    (report-boolean-test (= 4.5 -1.1) #f)
    (report-boolean-test (= 4.5 (complex 4.5 0.0)) #t)
    (report-boolean-test (= 4.5 (complex 0.3 1.0)) #f)
    (report-boolean-test (= (complex 1.0 0.0) 1) #t)
    (report-boolean-test (= (complex -1.0 2.0) -1) #f)
    (report-boolean-test (= (complex 0.2 0.0) (rational 1 5)) #t)
    (report-boolean-test (= (complex 0.2 1.0) (rational 2 5)) #f)
    (report-boolean-test (= (complex 0.2 0.0) 0.2) #t)
    (report-boolean-test (= (complex 0.2 0.0) 0.3) #f)
    (report-boolean-test (= (complex 5.0 4.0) (complex 5.0 4.0)) #t)
    (report-boolean-test (= (complex 5.0 4.0) (complex -5.0 4.0)) #f)
    (console-newline)

    (report-boolean-test (< 2 3) #t)
    (report-boolean-test (< 2 1) #f)
    (report-boolean-test (< 2 (rational 10 2)) #t)
    (report-boolean-test (< 2 (rational -1 2)) #f)
    (report-boolean-test (< 2 4.5) #t)
    (report-boolean-test (< 2 1.1) #f)
    (report-boolean-test (< (rational 4 5) 1) #t)
    (report-boolean-test (< (rational 4 5) -1) #f)
    (report-boolean-test (< (rational 4 5) (rational 10 2)) #t)
    (report-boolean-test (< (rational 4 5) (rational -1 2)) #f)
    (report-boolean-test (< (rational 4 5) 1.5) #t)
    (report-boolean-test (< (rational 4 5) 0.5) #f)
    (report-boolean-test (< 2.2 3) #t)
    (report-boolean-test (< 2.2 1.1) #f)
    (report-boolean-test (< 2.2 (rational 11 2)) #t)
    (report-boolean-test (< 2.2 (rational 2 3)) #f)
    (report-boolean-test (< 2.2 3.5) #t)
    (report-boolean-test (< 2.2 1.5) #f)
    (console-newline)

    (report-boolean-test (<= 2 3) #t)
    (report-boolean-test (<= 2 1) #f)
    (report-boolean-test (<= 2 (rational 10 2)) #t)
    (report-boolean-test (<= 2 (rational -1 2)) #f)
    (report-boolean-test (<= 2 4.5) #t)
    (report-boolean-test (<= 2 1.1) #f)
    (report-boolean-test (<= (rational 4 5) 1) #t)
    (report-boolean-test (<= (rational 4 5) -1) #f)
    (report-boolean-test (<= (rational 4 5) (rational 10 2)) #t)
    (report-boolean-test (<= (rational 4 5) (rational -1 2)) #f)
    (report-boolean-test (<= (rational 4 5) 1.5) #t)
    (report-boolean-test (<= (rational 4 5) 0.5) #f)
    (report-boolean-test (<= 2.2 3) #t)
    (report-boolean-test (<= 2.2 1.1) #f)
    (report-boolean-test (<= 2.2 (rational 11 2)) #t)
    (report-boolean-test (<= 2.2 (rational 2 3)) #f)
    (report-boolean-test (<= 2.2 3.5) #t)
    (report-boolean-test (<= 2.2 1.5) #f)
    (console-newline)

    (report-boolean-test (> 2 3) #f)
    (report-boolean-test (> 2 1) #t)
    (report-boolean-test (> 2 (rational 10 2)) #f)
    (report-boolean-test (> 2 (rational -1 2)) #t)
    (report-boolean-test (> 2 4.5) #f)
    (report-boolean-test (> 2 1.1) #t)
    (report-boolean-test (> (rational 4 5) 1) #f)
    (report-boolean-test (> (rational 4 5) -1) #t)
    (report-boolean-test (> (rational 4 5) (rational 10 2)) #f)
    (report-boolean-test (> (rational 4 5) (rational -1 2)) #t)
    (report-boolean-test (> (rational 4 5) 1.5) #f)
    (report-boolean-test (> (rational 4 5) 0.5) #t)
    (report-boolean-test (> 2.2 3) #f)
    (report-boolean-test (> 2.2 1.1) #t)
    (report-boolean-test (> 2.2 (rational 11 2)) #f)
    (report-boolean-test (> 2.2 (rational 2 3)) #t)
    (report-boolean-test (> 2.2 3.5) #f)
    (report-boolean-test (> 2.2 1.5) #t)
    (console-newline)

    (report-boolean-test (>= 2 3) #f)
    (report-boolean-test (>= 2 1) #t)
    (report-boolean-test (>= 2 (rational 10 2)) #f)
    (report-boolean-test (>= 2 (rational -1 2)) #t)
    (report-boolean-test (>= 2 4.5) #f)
    (report-boolean-test (>= 2 1.1) #t)
    (report-boolean-test (>= (rational 4 5) 1) #f)
    (report-boolean-test (>= (rational 4 5) -1) #t)
    (report-boolean-test (>= (rational 4 5) (rational 10 2)) #f)
    (report-boolean-test (>= (rational 4 5) (rational -1 2)) #t)
    (report-boolean-test (>= (rational 4 5) 1.5) #f)
    (report-boolean-test (>= (rational 4 5) 0.5) #t)
    (report-boolean-test (>= 2.2 3) #f)
    (report-boolean-test (>= 2.2 1.1) #t)
    (report-boolean-test (>= 2.2 (rational 11 2)) #f)
    (report-boolean-test (>= 2.2 (rational 2 3)) #t)
    (report-boolean-test (>= 2.2 3.5) #f)
    (report-boolean-test (>= 2.2 1.5) #t)
    (console-newline)))
