;; -*-theme-d-*-

;; Copyright (C) 2014  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 test676)

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

  (define-simple-proc main (() <none> nonpure)
    (report-test (- 2) -2)
    (report-test (- -2) 2)
    (report-test (- (rational 2 3)) (rational -2 3))
    (report-test (- (rational -2 3)) (rational 2 3))
    (report-test (- 2.5) -2.5)
    (report-test (- -2.5) 2.5)
    (report-test (- (complex 1.0 -2.0)) (complex -1.0 2.0))
    (report-test (- (complex -1.0 2.0)) (complex 1.0 -2.0))
    (console-newline)

    (report-test (abs 2) 2)
    (report-test (abs -2) 2)
    (report-test (abs (rational 2 3)) (rational 2 3))
    (report-test (abs (rational -2 3)) (rational 2 3))
    (report-test (abs 2.5) 2.5)
    (report-test (abs -2.5) 2.5)
    (report-test (abs (complex 1.0 -2.0)) 2.23606797749979)
    (report-test (abs (complex -1.0 2.0)) 2.23606797749979)
    (console-newline)

    (report-test (square 2) 4)
    (report-test (square -2) 4)
    (report-test (square (rational 2 3)) (rational 4 9))
    (report-test (square (rational -2 3)) (rational 4 9))
    (report-test (square 2.5) 6.25)
    (report-test (square -2.5) 6.25)
    (report-test (square (complex 1.0 -2.0)) (complex -3 -4))
    (report-test (square (complex -1.0 2.0)) (complex -3 -4))
    (console-newline)))
