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))))
|