2009-10-09 00:06:40 -04:00
|
|
|
USING: alien.c-types alien.data compiler.tree.debugger
|
|
|
|
continuations io.directories io.encodings.ascii io.files
|
|
|
|
io.files.temp io.mmap kernel math sequences sequences.private
|
2009-10-19 05:41:53 -04:00
|
|
|
specialized-arrays tools.test ;
|
|
|
|
SPECIALIZED-ARRAY: uint
|
2008-03-01 17:00:45 -05:00
|
|
|
IN: io.mmap.tests
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-05-15 06:20:42 -04:00
|
|
|
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
|
|
|
[ ] [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test
|
2009-09-28 04:18:27 -04:00
|
|
|
[ ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
|
|
|
|
[ 5 ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file ] unit-test
|
|
|
|
[ 5 ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file-reader ] unit-test
|
2008-05-15 06:20:42 -04:00
|
|
|
[ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
|
2009-10-09 00:06:40 -04:00
|
|
|
|
|
|
|
SPECIALIZED-ARRAY: uint
|
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
"mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array
|
|
|
|
integer?
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
"mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array-reader
|
|
|
|
integer?
|
|
|
|
] unit-test
|
|
|
|
|
2008-05-15 06:20:42 -04:00
|
|
|
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
2009-02-26 18:34:26 -05:00
|
|
|
|
|
|
|
|
2009-02-26 20:58:25 -05:00
|
|
|
[ "mmap-empty-file.txt" temp-file delete-file ] ignore-errors
|
|
|
|
[ ] [ "mmap-empty-file.txt" temp-file touch-file ] unit-test
|
2009-02-26 18:34:26 -05:00
|
|
|
|
|
|
|
[
|
2009-02-26 20:58:25 -05:00
|
|
|
"mmap-empty-file.txt" temp-file [
|
2009-02-26 18:34:26 -05:00
|
|
|
drop
|
|
|
|
] with-mapped-file
|
2009-02-26 20:58:25 -05:00
|
|
|
] [ bad-mmap-size? ] must-fail-with
|
2009-09-28 04:18:27 -04:00
|
|
|
|
|
|
|
[ t ] [
|
|
|
|
[ "test.txt" <mapped-file> void* <c-direct-array> first-unsafe ]
|
|
|
|
{ nth-unsafe } inlined?
|
|
|
|
] unit-test
|