1 ;;; This is the union runtime testcase. It ensures that values within a
2 ;;; union embedded within a struct can be set and read correctly.
4 ;; Create new instances of SmallStruct and BigStruct for later use
5 (define small (new-SmallStruct))
6 (SmallStruct-jill-set small 200)
8 (define big (new-BigStruct))
9 (BigStruct-smallstruct-set big small)
10 (BigStruct-jack-set big 300)
12 ;; Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
13 ;; Ensure values in EmbeddedUnionTest are set correctly for each.
14 (define eut (new-EmbeddedUnionTest))
16 ;; First check the SmallStruct in EmbeddedUnionTest
17 (EmbeddedUnionTest-number-set eut 1)
18 (EmbeddedUnionTest-uni-small-set (EmbeddedUnionTest-uni-get eut)
20 (let ((Jill1 (SmallStruct-jill-get
21 (EmbeddedUnionTest-uni-small-get
22 (EmbeddedUnionTest-uni-get eut)))))
23 (if (not (= Jill1 200))
25 (display "Runtime test 1 failed.")
28 (let ((Num1 (EmbeddedUnionTest-number-get eut)))
31 (display "Runtime test 2 failed.")