1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
;; -*-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-main-proc (() <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 (conj 2) 2)
(report-test (conj (rational 2 3)) (rational 2 3))
(report-test (conj 2.5) 2.5)
(report-test (conj (complex 1.0 -2.0)) (complex 1.0 2.0))
(report-test (conj (complex -1.0 2.0)) (complex -1.0 -2.0))
(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)))
|