factor/library/test/crashes.factor

58 lines
1.3 KiB
Factor

IN: scratchpad
USE: errors
USE: kernel
USE: math
USE: namespaces
USE: parser
USE: stack
USE: strings
USE: test
USE: vectors
USE: lists
! Various things that broke CFactor at various times.
! This should run without issue (and tests nothing useful)
! in Java Factor
"20 <sbuf> \"foo\" set" eval
"garbage-collection" eval
[
[ drop ] [ drop ] catch
[ drop ] [ drop ] catch
] keep-datastack
"hello" str>sbuf "x" set
[ -5 "x" get set-sbuf-length ] [ drop ] catch
[ "x" get sbuf>str drop ] [ drop ] catch
10 <vector> "x" set
[ -2 "x" get set-vector-length ] [ drop ] catch
[ "x" get clone drop ] [ drop ] catch
10 [ [ -1000000 <vector> ] [ drop ] catch ] times
10 [ [ -1000000 <sbuf> ] [ drop ] catch ] times
! Make sure various type checks don't run into header untagging
! problems etc.
! Lotype -vs- lotype
[ ] [ [ 4 car ] [ drop ] catch ] unit-test
! Lotype -vs- hitype
[ ] [ [ 4 vector-length ] [ drop ] catch ] unit-test
[ ] [ [ [ 4 3 ] vector-length ] [ drop ] catch ] unit-test
! Hitype -vs- lotype
[ ] [ [ "hello" car ] [ drop ] catch ] unit-test
! Hitype -vs- hitype
[ ] [ [ "hello" vector-length ] [ drop ] catch ] unit-test
! f -vs- lotype
[ ] [ [ f car ] [ drop ] catch ] unit-test
! f -vs- hitype
[ ] [ [ f vector-length ] [ drop ] catch ] unit-test