]> gitweb.factorcode.org Git - factor.git/blob - extra/central/central-tests.factor
3dbcbf32fcc76ce09f45a0f6fa1d910caad51ef5
[factor.git] / extra / central / central-tests.factor
1 USING: accessors central destructors kernel math tools.test ;
2
3 IN: scratchpad
4
5 CENTRAL: test-central
6
7 [ 3 ] [ 3 [ test-central ] with-test-central ] unit-test
8
9 TUPLE: test-disp-cent value disposed ;
10
11 ! A phony destructor that adds 1 to the value so we can make sure it got called.
12 M: test-disp-cent dispose* dup value>> 1+ >>value drop ;
13
14 DISPOSABLE-CENTRAL: t-d-c
15
16 : test-t-d-c ( -- n )
17     test-disp-cent new 3 >>value [ t-d-c ] with-t-d-c value>> ;
18
19 [ 4 ] [ test-t-d-c ] unit-test