File: test676.thp

package info (click to toggle)
theme-d 7.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,036 kB
  • sloc: lisp: 9,625; sh: 5,321; makefile: 715; ansic: 477
file content (53 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download | duplicates (2)
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)))