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

47 lines
984 B
Factor
Raw Normal View History

! Copyright (C) 2009 Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
2009-08-10 16:27:56 -04:00
USING: accessors alien destructors kernel math
memory.piles tools.test ;
{ 25 } [
2009-08-10 16:27:56 -04:00
[
100 <pile> &dispose
[ 25 pile-alloc ] [ 50 pile-alloc ] bi
swap [ alien-address ] bi@ -
] with-destructors
] unit-test
{ 32 } [
2009-08-10 16:27:56 -04:00
[
100 <pile> &dispose
[ 25 pile-alloc ] [ 8 pile-align 50 pile-alloc ] bi
swap [ alien-address ] bi@ -
] with-destructors
] unit-test
{ 75 } [
2009-08-10 16:27:56 -04:00
[
100 <pile> &dispose
dup 25 pile-alloc drop
dup 50 pile-alloc drop
offset>>
] with-destructors
] unit-test
{ 100 } [
2009-08-10 16:27:56 -04:00
[
100 <pile> &dispose
dup 25 pile-alloc drop
dup 75 pile-alloc drop
offset>>
] with-destructors
] unit-test
[
[
100 <pile> &dispose
dup 25 pile-alloc drop
dup 76 pile-alloc drop
] with-destructors
] [ not-enough-pile-space? ] must-fail-with