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
|
;; -*-theme-d-*-
;; Copyright (C) 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 test671)
(import (standard-library core)
(standard-library math)
(standard-library console-io)
(tests numerical-test-env))
(define-main-proc (() <none> nonpure)
(report-test (+ 1 2) 3)
(report-test (+ 1 2.5) 3.5)
(report-test (+ 1.5 2) 3.5)
(report-test (+ 1.5 2.5) 4.0)
(report-test (- 1 2) -1)
(report-test (- 1 2.5) -1.5)
(report-test (- 1.5 2) -0.5)
(report-test (- 1.5 2.5) -1.0)
(report-test (* 1 2) 2)
(report-test (* 1 2.5) 2.5)
(report-test (* 1.5 2) 3.0)
(report-test (* 1.5 2.5) 3.75)
(report-test (/ 1 2) (rational 1 2))
(report-test (/ 1 2.5) 0.4)
(report-test (/ 1.5 2) 0.75)
(report-test (/ 1.5 2.5) 0.6)
(report-test (- 1) -1)
(report-test (- 1.5) -1.5)
(report-test (min 2 3) 2)
(report-test (min -2.0 -3.0) -3.0)
(report-test (max 5 4) 5)
(report-test (max 2.0 -5.0) 2.0)
(report-test (min (rational 9 5) (rational -5 4)) (rational -5 4))
(report-test (max (rational -9 4) (rational 3 2)) (rational 3 2))))
|