PageRenderTime 71ms CodeModel.GetById 61ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/extra/memory/piles/piles-tests.factor

http://github.com/abeaumont/factor
Unknown | 47 lines | 41 code | 6 blank | 0 comment | 0 complexity | dc22ab1ed5e9458bbae7a522baa1b996 MD5 | raw file
 1! (c)2009 Joe Groff bsd license
 2USING: accessors alien destructors kernel math
 3memory.piles tools.test ;
 4IN: memory.piles.tests
 5
 6[ 25 ] [
 7    [
 8        100 <pile> &dispose
 9        [ 25 pile-alloc ] [ 50 pile-alloc ] bi
10        swap [ alien-address ] bi@ -
11    ] with-destructors
12] unit-test
13
14[ 32 ] [
15    [
16        100 <pile> &dispose
17        [ 25 pile-alloc ] [ 8 pile-align 50 pile-alloc ] bi
18        swap [ alien-address ] bi@ -
19    ] with-destructors
20] unit-test
21
22[ 75 ] [
23    [
24        100 <pile> &dispose
25        dup 25 pile-alloc drop
26        dup 50 pile-alloc drop
27        offset>>
28    ] with-destructors
29] unit-test
30
31[ 100 ] [
32    [
33        100 <pile> &dispose
34        dup 25 pile-alloc drop
35        dup 75 pile-alloc drop
36        offset>>
37    ] with-destructors
38] unit-test
39
40[
41    [
42        100 <pile> &dispose
43        dup 25 pile-alloc drop
44        dup 76 pile-alloc drop
45    ] with-destructors
46] [ not-enough-pile-space? ] must-fail-with
47