mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-17 08:27:45 +03:00
25 lines
459 B
Plaintext
25 lines
459 B
Plaintext
|
(load "Test.carp")
|
||
|
(use Test)
|
||
|
|
||
|
(Debug.sanitize-addresses)
|
||
|
|
||
|
(deftype Num [val Int])
|
||
|
|
||
|
(deftest test
|
||
|
(assert-equal test
|
||
|
&(Box.init @"foo")
|
||
|
&(Box.init @"foo")
|
||
|
"init works as expected")
|
||
|
(assert-equal test
|
||
|
2
|
||
|
(Box.unbox (Box.init 2))
|
||
|
"unbox works as expected")
|
||
|
(assert-equal test
|
||
|
1
|
||
|
(let-do [box (Box.init (Num.init 0))]
|
||
|
(Num.set-val! (Box.peek &box) 1)
|
||
|
@(Num.val (Box.peek &box)))
|
||
|
"peek works as expected"
|
||
|
)
|
||
|
)
|