]> gitweb.factorcode.org Git - factor.git/blob - extra/memory/piles/piles-tests.factor
Update some copyright headers to follow the current convention
[factor.git] / extra / memory / piles / piles-tests.factor
1 ! Copyright (C) 2009 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien destructors kernel math
4 memory.piles tools.test ;
5 IN: memory.piles.tests
6
7 { 25 } [
8     [
9         100 <pile> &dispose
10         [ 25 pile-alloc ] [ 50 pile-alloc ] bi
11         swap [ alien-address ] bi@ -
12     ] with-destructors
13 ] unit-test
14
15 { 32 } [
16     [
17         100 <pile> &dispose
18         [ 25 pile-alloc ] [ 8 pile-align 50 pile-alloc ] bi
19         swap [ alien-address ] bi@ -
20     ] with-destructors
21 ] unit-test
22
23 { 75 } [
24     [
25         100 <pile> &dispose
26         dup 25 pile-alloc drop
27         dup 50 pile-alloc drop
28         offset>>
29     ] with-destructors
30 ] unit-test
31
32 { 100 } [
33     [
34         100 <pile> &dispose
35         dup 25 pile-alloc drop
36         dup 75 pile-alloc drop
37         offset>>
38     ] with-destructors
39 ] unit-test
40
41 [
42     [
43         100 <pile> &dispose
44         dup 25 pile-alloc drop
45         dup 76 pile-alloc drop
46     ] with-destructors
47 ] [ not-enough-pile-space? ] must-fail-with