factor/library/compiler/test/simple.factor

48 lines
702 B
Factor
Raw Normal View History

2004-10-01 22:02:54 -04:00
USE: compiler
USE: test
USE: math
USE: kernel
USE: words
USE: kernel
USE: math-internals
2005-02-17 19:01:11 -05:00
USE: memory
2006-05-05 21:41:57 -04:00
IN: temporary
2004-10-01 22:02:54 -04:00
: no-op ;
2004-10-01 22:02:54 -04:00
[ ] [ no-op ] unit-test
: literals 3 5 ;
2004-10-01 22:02:54 -04:00
: tail-call fixnum+ ;
2004-10-01 22:02:54 -04:00
[ 4 ] [ 1 3 tail-call ] unit-test
[ 3 5 ] [ literals ] unit-test
: literals&tail-call 3 5 fixnum+ ;
2004-10-01 22:02:54 -04:00
[ 8 ] [ literals&tail-call ] unit-test
: two-calls dup fixnum* ;
2004-10-01 22:02:54 -04:00
[ 25 ] [ 5 two-calls ] unit-test
: mix-test 3 5 fixnum+ 6 fixnum* ;
2004-10-01 22:02:54 -04:00
[ 48 ] [ mix-test ] unit-test
: indexed-literal-test "hello world" ;
2004-10-01 22:02:54 -04:00
2005-05-12 01:02:39 -04:00
full-gc
full-gc
2004-10-01 22:02:54 -04:00
[ "hello world" ] [ indexed-literal-test ] unit-test
2006-02-28 00:26:45 -05:00
: foo dup [ dup [ ] [ ] if drop ] [ drop ] if ;
2006-02-28 00:26:45 -05:00
[ 10 ] [ 10 2 foo ] unit-test
2006-04-28 18:38:48 -04:00
: foox dup [ foox ] when ; inline
: bar foox ;