;; -*-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-simple-proc main (() <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))))
