]> gitweb.factorcode.org Git - factor.git/blob - extra/memory/piles/piles-tests.factor
6656cb5a6a4d139e8f8b7119921f13e9deb4ce18
[factor.git] / extra / memory / piles / piles-tests.factor
1 ! (c)2009 Joe Groff bsd license
2 USING: accessors alien destructors kernel math
3 memory.piles tools.test ;
4 IN: 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