File: test743.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 (35 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (3)
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
;; -*-theme-d-*-

;; Copyright (C) 2019  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 test743)

  (import (standard-library core)
	  (tests numerical-test-env))

  (define-main-proc (() <none> nonpure)
    (let-mutable ((b <boolean> #t)
		  (s <symbol> 'def)
		  (i <integer> 2)
		  (r <real> -1.5)
		  (ch <character> #\a)
		  (str <string> "hello")
		  (x-null <null> null))
      (report-boolean-test (equal? (static-cast <object> b) #t) #t)
      (report-boolean-test (equal? #f (static-cast <object> b)) #f)
      (report-boolean-test (equal? (static-cast <object> s) 'abc) #f)
      (report-boolean-test (equal? 'def (static-cast <object> s)) #t)
      (report-boolean-test (equal? (static-cast <object> i) 2) #t)
      (report-boolean-test (equal? 1 (static-cast <object> i)) #f)
      (report-boolean-test (equal? (static-cast <object> r) 2.5) #f)
      (report-boolean-test (equal? -1.5 (static-cast <object> r)) #t)
      (report-boolean-test (equal? (static-cast <object> ch) #\a) #t)
      (report-boolean-test (equal? #\newline (static-cast <object> ch)) #f)
      (report-boolean-test (equal? (static-cast <object> str) "world") #f)
      (report-boolean-test (equal? "hello" (static-cast <object> str)) #t)
      (report-boolean-test (equal? (static-cast <object> x-null) null) #t)
      (report-boolean-test (equal? null (static-cast <object> x-null)) #t))))